proto.make 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. # $Header$
  2. #PARAMS do not remove this line!
  3. SRC_DIR = $(SRC_HOME)/util/flex
  4. # make file for "flex" tool
  5. # Porting considerations:
  6. #
  7. # For System V Unix machines, add -DUSG to CFLAGS (if it's not
  8. # automatically defined)
  9. # For Vax/VMS, add "-DVMS -DUSG" to CFLAGS.
  10. # For MS-DOS, add "-DMS_DOS -DUSG" to CFLAGS. Create \tmp if not present.
  11. # You will also want to rename flex.skel to something with a three
  12. # character extension, change SKELETON_FILE below appropriately,
  13. # See MSDOS.notes for more info.
  14. # For Amiga, add "-DAMIGA -DUSG" to CFLAGS.
  15. # For SCO Unix, add "-DSCO_UNIX" to CFLAGS.
  16. #
  17. # For C compilers which don't know about "void", add -Dvoid=int to CFLAGS.
  18. #
  19. # If your C compiler is ANSI standard but does not include the <stdlib.h>
  20. # header file (some installations of gcc have this problem), then add
  21. # -DDONT_HAVE_STDLIB_H to CFLAGS.
  22. #
  23. # By default, flex will be configured to generate 8-bit scanners only
  24. # if the -8 flag is given. If you want it to always generate 8-bit
  25. # scanners, add "-DDEFAULT_CSIZE=256" to CFLAGS. Note that doing
  26. # so will double the size of all uncompressed scanners.
  27. #
  28. # If on your system you have trouble building flex due to 8-bit
  29. # character problems, remove the -8 from FLEX_FLAGS and the
  30. # "#define FLEX_8_BIT_CHARS" from the beginning of flexdef.h.
  31. # the first time around use "make first_flex"
  32. # Installation targeting. Files will be installed under the tree rooted
  33. # at DESTDIR. User commands will be installed in BINDIR, library files
  34. # in LIBDIR (which will be created if necessary), auxiliary files in
  35. # AUXDIR, manual pages will be installed in MANDIR with extension MANEXT.
  36. # Raw, unformatted troff source will be installed if INSTALLMAN=man, nroff
  37. # preformatted versions will be installed if INSTALLMAN=cat.
  38. DESTDIR =
  39. BINDIR = $(TARGET_HOME)/bin
  40. AUXDIR = $(TARGET_HOME)/lib/flex
  41. MANDIR = $(TARGET_HOME)/man
  42. MANEXT = 1
  43. INSTALLMAN = man
  44. # MAKE = make
  45. SKELETON_FILE = \"$(AUXDIR)/flex.skel\"
  46. SKELFLAGS = -DDEFAULT_SKELETON_FILE=$(SKELETON_FILE)
  47. INCLUDES = -I$(SRC_DIR) -I.
  48. CFLAGS = $(COPTIONS) -DACK_MOD $(INCLUDES)
  49. LDFLAGS = $(LDOPTIONS)
  50. COMPRESSION =
  51. FLEX_FLAGS = -ist8 -Sflex.skel
  52. # which "flex" to use to generate scan.c from scan.l
  53. FLEX = flex
  54. FLEXOBJS = \
  55. ccl.$(SUF) \
  56. dfa.$(SUF) \
  57. ecs.$(SUF) \
  58. gen.$(SUF) \
  59. main.$(SUF) \
  60. misc.$(SUF) \
  61. nfa.$(SUF) \
  62. parse.$(SUF) \
  63. scan.$(SUF) \
  64. sym.$(SUF) \
  65. tblcmp.$(SUF) \
  66. yylex.$(SUF)
  67. FLEX_C_SOURCES = \
  68. $(SRC_DIR)/ccl.c \
  69. $(SRC_DIR)/dfa.c \
  70. $(SRC_DIR)/ecs.c \
  71. $(SRC_DIR)/gen.c \
  72. $(SRC_DIR)/main.c \
  73. $(SRC_DIR)/misc.c \
  74. $(SRC_DIR)/nfa.c \
  75. $(SRC_DIR)/parse.c \
  76. $(SRC_DIR)/scan.c \
  77. $(SRC_DIR)/sym.c \
  78. $(SRC_DIR)/tblcmp.c \
  79. $(SRC_DIR)/yylex.c
  80. all : flex
  81. flex : $(FLEXOBJS)
  82. $(CC) -o flex $(LDFLAGS) $(FLEXOBJS)
  83. first_flex:
  84. cp $(SRC_DIR)/initscan.c scan.c
  85. make $(MFLAGS) flex
  86. parse.h parse.c : $(SRC_DIR)/parse.y
  87. yacc -d $(SRC_DIR)/parse.y
  88. @mv y.tab.c parse.c
  89. @mv y.tab.h parse.h
  90. scan.c : $(SRC_DIR)/scan.l
  91. $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) $(SRC_DIR)/scan.l >scan.c
  92. scan.$(SUF) : scan.c parse.h $(SRC_DIR)/flexdef.h
  93. main.$(SUF) : $(SRC_DIR)/main.c $(SRC_DIR)/flexdef.h
  94. -mkdir $(AUXDIR)
  95. $(CC) $(CFLAGS) -c $(SKELFLAGS) $(SRC_DIR)/main.c
  96. ccl.$(SUF) : $(SRC_DIR)/ccl.c $(SRC_DIR)/flexdef.h
  97. $(CC) $(CFLAGS) -c $(SRC_DIR)/ccl.c
  98. dfa.$(SUF) : $(SRC_DIR)/dfa.c $(SRC_DIR)/flexdef.h
  99. $(CC) $(CFLAGS) -c $(SRC_DIR)/dfa.c
  100. ecs.$(SUF) : $(SRC_DIR)/ecs.c $(SRC_DIR)/flexdef.h
  101. $(CC) $(CFLAGS) -c $(SRC_DIR)/ecs.c
  102. gen.$(SUF) : $(SRC_DIR)/gen.c $(SRC_DIR)/flexdef.h
  103. $(CC) $(CFLAGS) -c $(SRC_DIR)/gen.c
  104. misc.$(SUF) : $(SRC_DIR)/misc.c $(SRC_DIR)/flexdef.h
  105. $(CC) $(CFLAGS) -c $(SRC_DIR)/misc.c
  106. nfa.$(SUF) : $(SRC_DIR)/nfa.c $(SRC_DIR)/flexdef.h
  107. $(CC) $(CFLAGS) -c $(SRC_DIR)/nfa.c
  108. parse.$(SUF) : parse.c $(SRC_DIR)/flexdef.h
  109. $(CC) $(CFLAGS) -c parse.c
  110. sym.$(SUF) : $(SRC_DIR)/sym.c $(SRC_DIR)/flexdef.h
  111. $(CC) $(CFLAGS) -c $(SRC_DIR)/sym.c
  112. tblcmp.$(SUF) : $(SRC_DIR)/tblcmp.c $(SRC_DIR)/flexdef.h
  113. $(CC) $(CFLAGS) -c $(SRC_DIR)/tblcmp.c
  114. yylex.$(SUF) : $(SRC_DIR)/yylex.c $(SRC_DIR)/flexdef.h
  115. $(CC) $(CFLAGS) -c $(SRC_DIR)/yylex.c
  116. LINTFLAGS = $(LINTOPTIONS) $(INCLUDES)
  117. lint : $(FLEX_C_SOURCES)
  118. $(LINT) $(LINTFLAGS) $(FLEX_C_SOURCES)
  119. install: first_flex $(SRC_DIR)/flex.skel
  120. rm -f $(BINDIR)/flex
  121. cp flex $(BINDIR)/flex
  122. cp $(SRC_DIR)/flex.skel $(AUXDIR)/flex.skel
  123. cp $(SRC_DIR)/flex.1 $(MANDIR)/flex.1
  124. cp $(SRC_DIR)/flexdoc.1 $(MANDIR)/flexdoc.1
  125. clean :
  126. rm -f core errs flex *.$(SUF) parse.c *.lint parse.h tags
  127. tags :
  128. ctags $(FLEX_C_SOURCES)
  129. test : flex
  130. ./flex $(FLEX_FLAGS) $(COMPRESSION) scan.l | diff scan.c -
  131. bigtest :
  132. rm -f scan.c ; $(MAKE) COMPRESSION="-C" test
  133. rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" test
  134. rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" test
  135. rm -f scan.c ; $(MAKE) COMPRESSION="-Cfe" test
  136. rm -f scan.c ; $(MAKE) COMPRESSION="-CFe" test
  137. rm -f scan.c ; $(MAKE) COMPRESSION="-Cf" test
  138. rm -f scan.c ; $(MAKE) COMPRESSION="-CF" test
  139. rm -f scan.c ; $(MAKE)