Makefile 4.7 KB

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