home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / compcomp / flex237 / makefile < prev    next >
Encoding:
Makefile  |  1991-11-05  |  5.0 KB  |  192 lines

  1. # make file for "flex" tool
  2.  
  3. # @(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/Makefile,v 2.9 90/05/26 17:28:44 vern Exp $ (LBL)
  4.  
  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. # If on your system you have trouble building flex due to 8-bit
  28. # character problems, remove the -8 from FLEX_FLAGS and the
  29. # "#define FLEX_8_BIT_CHARS" from the beginning of flexdef.h.
  30.  
  31.  
  32. # the first time around use "make first_flex"
  33.  
  34.  
  35. # Installation targeting.  Files will be installed under the tree rooted
  36. # at DESTDIR.  User commands will be installed in BINDIR, library files
  37. # in LIBDIR (which will be created if necessary), auxiliary files in
  38. # AUXDIR, manual pages will be installed in MANDIR with extension MANEXT.
  39. # Raw, unformatted troff source will be installed if INSTALLMAN=man, nroff
  40. # preformatted versions will be installed if INSTALLMAN=cat.
  41. DESTDIR =
  42. BINDIR = /usr/local
  43. LIBDIR = /usr/local/lib
  44. AUXDIR = c:/flex
  45. MANDIR = /usr/man/manl
  46. MANEXT = l
  47. INSTALLMAN = man
  48.  
  49. # MAKE = make
  50.  
  51.  
  52. SKELETON_FILE = $(DESTDIR)$(AUXDIR)/flex.skl
  53. SKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\"
  54. CFLAGS = -O
  55. LDFLAGS = -s
  56.  
  57. COMPRESSION =
  58. FLEX_FLAGS = -ist8 -Sflex.skl
  59. # which "flex" to use to generate scan.c from scan.l
  60. FLEX = flex
  61. CC = c:/djgpp/bin/gcc
  62. YACC = byacc
  63.  
  64. AR = ar
  65. RANLIB = ranlib
  66.  
  67. FLEXOBJS = \
  68.     ccl.o \
  69.     dfa.o \
  70.     ecs.o \
  71.     gen.o \
  72.     main.o \
  73.     misc.o \
  74.     nfa.o \
  75.     parse.o \
  76.     scan.o \
  77.     sym.o \
  78.     tblcmp.o \
  79.     yylex.o
  80.  
  81. FLEX_C_SOURCES = \
  82.     ccl.c \
  83.     dfa.c \
  84.     ecs.c \
  85.     gen.c \
  86.     main.c \
  87.     misc.c \
  88.     nfa.c \
  89.     parse.c \
  90.     scan.c \
  91.     sym.c \
  92.     tblcmp.c \
  93.     yylex.c
  94.  
  95. FLEX_LIB_OBJS = \
  96.     libmain.o
  97.  
  98. FLEXLIB = flexlib.a
  99.  
  100.  
  101. all : flex $(FLEXLIB)
  102.  
  103. flex : $(FLEXOBJS)
  104.     $(CC) $(CFLAGS) -o flex $(LDFLAGS) $(FLEX_C_SOURCES)
  105.  
  106. first_flex:
  107.     copy initscan.c scan.c
  108.     $(MAKE) $(MFLAGS) flex
  109.  
  110. parse.h parse.c : parse.y
  111.     $(YACC) -d parse.y
  112.     @copy y_tab.c parse.c
  113.     @copy y_tab.h parse.h
  114.  
  115. scan.c : scan.l
  116.     $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) scan.l >scan.c
  117.  
  118. scan.o : scan.c parse.h flexdef.h
  119.  
  120. main.o : main.c flexdef.h
  121.     $(CC) $(CFLAGS) -c main.c
  122.  
  123. ccl.o : ccl.c flexdef.h
  124. dfa.o : dfa.c flexdef.h
  125. ecs.o : ecs.c flexdef.h
  126. gen.o : gen.c flexdef.h
  127. misc.o : misc.c flexdef.h
  128. nfa.o : nfa.c flexdef.h
  129. parse.o : parse.c flexdef.h
  130. sym.o : sym.c flexdef.h
  131. tblcmp.o : tblcmp.c flexdef.h
  132. yylex.o : yylex.c flexdef.h
  133.  
  134. flex.man : flex.1
  135.     nroff -man flex.1 >flex.man
  136.  
  137. $(FLEXLIB) : $(FLEX_LIB_OBJS)
  138.     $(AR) cru $(FLEXLIB) $(FLEX_LIB_OBJS)
  139.  
  140. lint : $(FLEX_C_SOURCES)
  141.     lint $(FLEX_C_SOURCES) > flex.lint
  142.  
  143. distrib :
  144.     copy scan.c initscan.c
  145.     chmod 444 initscan.c
  146.     $(MAKE) $(MFLAGS) clean
  147.  
  148. install: flex $(DESTDIR)$(LIBDIR) flex.skl install.$(INSTALLMAN) install-lib
  149.     install -s -m 755 flex $(DESTDIR)$(BINDIR)/flex
  150.     install -c -m 644 flex.skl $(SKELETON_FILE)
  151.  
  152. install-lib: $(DESTDIR)$(LIBDIR) $(FLEXLIB)
  153.     install -c -m 644 $(FLEXLIB) $(DESTDIR)$(LIBDIR)/libfl.a
  154.     $(RANLIB) $(DESTDIR)$(LIBDIR)/libfl.a
  155.  
  156. $(DESTDIR)$(LIBDIR):
  157.     mkdir $@
  158.  
  159. install.man: flex.1 flexdoc.1
  160.     install -c -m 644 flex.1 $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  161.     install -c -m 644 flexdoc.1 $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  162.  
  163. install.cat: flex.1 flexdoc.1
  164.     nroff -h -man flex.1 > $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  165.     nroff -h -man flexdoc.1 > $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  166.     chmod 644 $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  167.     chmod 644 $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  168.  
  169. clean :
  170.     rm -f core errs flex *.o parse.c *.lint parse.h flex.man tags \
  171.         $(FLEXLIB)
  172.  
  173. tags :
  174.     ctags $(FLEX_C_SOURCES)
  175.  
  176. vms :    flex.man
  177.     $(MAKE) $(MFLAGS) distrib
  178.  
  179. test : flex
  180.     ./flex $(FLEX_FLAGS) $(COMPRESSION) scan.l | diff scan.c -
  181.  
  182. bigtest :
  183.     rm -f scan.c ; $(MAKE) COMPRESSION="-C" test
  184.     rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" test
  185.     rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" test
  186.     rm -f scan.c ; $(MAKE) COMPRESSION="-Cfe" test
  187.     rm -f scan.c ; $(MAKE) COMPRESSION="-CFe" test
  188.     rm -f scan.c ; $(MAKE) COMPRESSION="-Cf" test
  189.     rm -f scan.c ; $(MAKE) COMPRESSION="-CF" test
  190.     rm -f scan.c ; $(MAKE)
  191.