makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. # Note: this is a modified version of Makefile, for ACK installation. The
  2. # original flex makefile has a capital M (Makefile).
  3. EMHOME = ../..
  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 = $(EMHOME)/bin
  40. AUXDIR = $(EMHOME)/lib/flex
  41. MANDIR = $(EMHOME)/man
  42. MANEXT = 1
  43. INSTALLMAN = man
  44. # MAKE = make
  45. SKELETON_FILE = \"`cd $(AUXDIR); pwd`/flex.skel\"
  46. SKELFLAGS = -DDEFAULT_SKELETON_FILE=$(SKELETON_FILE)
  47. CFLAGS = -O -Dvoid=int -DACK_MOD
  48. LDFLAGS = -s
  49. COMPRESSION =
  50. FLEX_FLAGS = -ist8 -Sflex.skel
  51. # which "flex" to use to generate scan.c from scan.l
  52. FLEX = ./flex
  53. # CC = cc
  54. AR = ar
  55. RANLIB = ranlib
  56. FLEXOBJS = \
  57. ccl.o \
  58. dfa.o \
  59. ecs.o \
  60. gen.o \
  61. main.o \
  62. misc.o \
  63. nfa.o \
  64. parse.o \
  65. scan.o \
  66. sym.o \
  67. tblcmp.o \
  68. yylex.o
  69. FLEX_C_SOURCES = \
  70. ccl.c \
  71. dfa.c \
  72. ecs.c \
  73. gen.c \
  74. main.c \
  75. misc.c \
  76. nfa.c \
  77. parse.c \
  78. scan.c \
  79. sym.c \
  80. tblcmp.c \
  81. yylex.c
  82. all : flex
  83. flex : $(FLEXOBJS)
  84. $(CC) $(CFLAGS) -o flex $(LDFLAGS) $(FLEXOBJS)
  85. first_flex:
  86. cp initscan.c scan.c
  87. $(MAKE) $(MFLAGS) flex
  88. parse.h parse.c : parse.y
  89. $(YACC) -d parse.y
  90. @mv y.tab.c parse.c
  91. @mv y.tab.h parse.h
  92. scan.c : scan.l
  93. $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) scan.l >scan.c
  94. scan.o : scan.c parse.h flexdef.h
  95. main.o : main.c flexdef.h
  96. -mkdir $(AUXDIR)
  97. $(CC) $(CFLAGS) -c $(SKELFLAGS) main.c
  98. ccl.o : ccl.c flexdef.h
  99. dfa.o : dfa.c flexdef.h
  100. ecs.o : ecs.c flexdef.h
  101. gen.o : gen.c flexdef.h
  102. misc.o : misc.c flexdef.h
  103. nfa.o : nfa.c flexdef.h
  104. parse.o : parse.c flexdef.h
  105. sym.o : sym.c flexdef.h
  106. tblcmp.o : tblcmp.c flexdef.h
  107. yylex.o : yylex.c flexdef.h
  108. lint : $(FLEX_C_SOURCES)
  109. lint $(FLEX_C_SOURCES) > flex.lint
  110. install: first_flex flex.skel
  111. rm -f $(BINDIR)flex
  112. cp flex $(BINDIR)/flex
  113. cp flex.skel $(AUXDIR)/flex.skel
  114. cp flex.1 $(MANDIR)/flex.1
  115. cp flexdoc.1 $(MANDIR)/flexdoc.1
  116. clean :
  117. rm -f core errs flex *.o parse.c *.lint parse.h tags
  118. tags :
  119. ctags $(FLEX_C_SOURCES)
  120. test : flex
  121. ./flex $(FLEX_FLAGS) $(COMPRESSION) scan.l | diff scan.c -
  122. bigtest :
  123. rm -f scan.c ; $(MAKE) COMPRESSION="-C" test
  124. rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" test
  125. rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" test
  126. rm -f scan.c ; $(MAKE) COMPRESSION="-Cfe" test
  127. rm -f scan.c ; $(MAKE) COMPRESSION="-CFe" test
  128. rm -f scan.c ; $(MAKE) COMPRESSION="-Cf" test
  129. rm -f scan.c ; $(MAKE) COMPRESSION="-CF" test
  130. rm -f scan.c ; $(MAKE)