proto.make 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. # $Id$
  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;
  36. DESTDIR =
  37. BINDIR = $(TARGET_HOME)/bin
  38. AUXDIR = $(TARGET_HOME)/lib/flex
  39. # MAKE = make
  40. SKELETON_FILE = \"$(AUXDIR)/flex.skel\"
  41. SKELFLAGS = -DDEFAULT_SKELETON_FILE=$(SKELETON_FILE)
  42. INCLUDES = -I$(SRC_DIR) -I.
  43. CFLAGS = $(COPTIONS) -DACK_MOD $(INCLUDES)
  44. LDFLAGS = $(LDOPTIONS)
  45. COMPRESSION =
  46. FLEX_FLAGS = -ist8 -Sflex.skel
  47. # which "flex" to use to generate scan.c from scan.l
  48. FLEX = flex
  49. FLEXOBJS = \
  50. ccl.$(SUF) \
  51. dfa.$(SUF) \
  52. ecs.$(SUF) \
  53. gen.$(SUF) \
  54. main.$(SUF) \
  55. misc.$(SUF) \
  56. nfa.$(SUF) \
  57. parse.$(SUF) \
  58. scan.$(SUF) \
  59. sym.$(SUF) \
  60. tblcmp.$(SUF) \
  61. yylex.$(SUF)
  62. FLEX_C_SOURCES = \
  63. $(SRC_DIR)/ccl.c \
  64. $(SRC_DIR)/dfa.c \
  65. $(SRC_DIR)/ecs.c \
  66. $(SRC_DIR)/gen.c \
  67. $(SRC_DIR)/main.c \
  68. $(SRC_DIR)/misc.c \
  69. $(SRC_DIR)/nfa.c \
  70. $(SRC_DIR)/parse.c \
  71. $(SRC_DIR)/scan.c \
  72. $(SRC_DIR)/sym.c \
  73. $(SRC_DIR)/tblcmp.c \
  74. $(SRC_DIR)/yylex.c
  75. all : flex
  76. flex : $(FLEXOBJS)
  77. $(CC) -o flex $(LDFLAGS) $(FLEXOBJS)
  78. first_flex:
  79. cp $(SRC_DIR)/initscan.c scan.c
  80. chmod +w scan.c
  81. make $(MFLAGS) flex
  82. parse.h parse.c : $(SRC_DIR)/parse.y
  83. yacc -d $(SRC_DIR)/parse.y
  84. @mv y.tab.c parse.c
  85. @mv y.tab.h parse.h
  86. scan.c : $(SRC_DIR)/scan.l
  87. $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) $(SRC_DIR)/scan.l >scan.c
  88. scan.$(SUF) : scan.c parse.h $(SRC_DIR)/flexdef.h
  89. $(CC) $(CFLAGS) -c scan.c
  90. main.$(SUF) : $(SRC_DIR)/main.c $(SRC_DIR)/flexdef.h
  91. -mkdir $(AUXDIR)
  92. $(CC) $(CFLAGS) -c $(SKELFLAGS) $(SRC_DIR)/main.c
  93. ccl.$(SUF) : $(SRC_DIR)/ccl.c $(SRC_DIR)/flexdef.h
  94. $(CC) $(CFLAGS) -c $(SRC_DIR)/ccl.c
  95. dfa.$(SUF) : $(SRC_DIR)/dfa.c $(SRC_DIR)/flexdef.h
  96. $(CC) $(CFLAGS) -c $(SRC_DIR)/dfa.c
  97. ecs.$(SUF) : $(SRC_DIR)/ecs.c $(SRC_DIR)/flexdef.h
  98. $(CC) $(CFLAGS) -c $(SRC_DIR)/ecs.c
  99. gen.$(SUF) : $(SRC_DIR)/gen.c $(SRC_DIR)/flexdef.h
  100. $(CC) $(CFLAGS) -c $(SRC_DIR)/gen.c
  101. misc.$(SUF) : $(SRC_DIR)/misc.c $(SRC_DIR)/flexdef.h
  102. $(CC) $(CFLAGS) -c $(SRC_DIR)/misc.c
  103. nfa.$(SUF) : $(SRC_DIR)/nfa.c $(SRC_DIR)/flexdef.h
  104. $(CC) $(CFLAGS) -c $(SRC_DIR)/nfa.c
  105. parse.$(SUF) : parse.c $(SRC_DIR)/flexdef.h
  106. $(CC) $(CFLAGS) -c parse.c
  107. sym.$(SUF) : $(SRC_DIR)/sym.c $(SRC_DIR)/flexdef.h
  108. $(CC) $(CFLAGS) -c $(SRC_DIR)/sym.c
  109. tblcmp.$(SUF) : $(SRC_DIR)/tblcmp.c $(SRC_DIR)/flexdef.h
  110. $(CC) $(CFLAGS) -c $(SRC_DIR)/tblcmp.c
  111. yylex.$(SUF) : $(SRC_DIR)/yylex.c $(SRC_DIR)/flexdef.h
  112. $(CC) $(CFLAGS) -c $(SRC_DIR)/yylex.c
  113. LINTFLAGS = $(LINTOPTIONS) $(INCLUDES)
  114. lint : $(FLEX_C_SOURCES)
  115. $(LINT) $(LINTFLAGS) $(FLEX_C_SOURCES)
  116. firstinstall: first_flex $(SRC_DIR)/flex.skel
  117. rm -f $(BINDIR)/flex
  118. cp flex $(BINDIR)/flex
  119. if [ $(DO_MACHINE_INDEP) = y ] ; \
  120. then cp $(SRC_DIR)/flex.skel $(AUXDIR)/flex.skel ; \
  121. mk_manpage $(SRC_DIR)/flex.1 $(TARGET_HOME) ; \
  122. mk_manpage $(SRC_DIR)/flexdoc.1 $(TARGET_HOME) ; \
  123. fi
  124. install: flex $(SRC_DIR)/flex.skel
  125. rm -f $(BINDIR)/flex
  126. cp flex $(BINDIR)/flex
  127. if [ $(DO_MACHINE_INDEP) = y ] ; \
  128. then cp $(SRC_DIR)/flex.skel $(AUXDIR)/flex.skel ; \
  129. mk_manpage $(SRC_DIR)/flex.1 $(TARGET_HOME) ; \
  130. mk_manpage $(SRC_DIR)/flexdoc.1 $(TARGET_HOME) ; \
  131. fi
  132. cmp: flex $(SRC_DIR)/flex.skel
  133. -cmp flex $(BINDIR)/flex
  134. -cmp $(SRC_DIR)/flex.skel $(AUXDIR)/flex.skel
  135. clean :
  136. rm -f core errs flex *.$(SUF) parse.c *.lint parse.h tags scan.c
  137. tags :
  138. ctags $(FLEX_C_SOURCES)
  139. test : flex
  140. ./flex $(FLEX_FLAGS) $(COMPRESSION) scan.l | diff scan.c -
  141. bigtest :
  142. rm -f scan.c ; $(MAKE) COMPRESSION="-C" test
  143. rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" test
  144. rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" test
  145. rm -f scan.c ; $(MAKE) COMPRESSION="-Cfe" test
  146. rm -f scan.c ; $(MAKE) COMPRESSION="-CFe" test
  147. rm -f scan.c ; $(MAKE) COMPRESSION="-Cf" test
  148. rm -f scan.c ; $(MAKE) COMPRESSION="-CF" test
  149. rm -f scan.c ; $(MAKE)