1 # make file for "flex" tool
3 # @(#) $Id: Makefile,v 1.2 1994/06/24 10:56:32 ceriel Exp $ (LBL)
5 # Porting considerations:
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.
17 # For C compilers which don't know about "void", add -Dvoid=int to CFLAGS.
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.
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.
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.
33 # the first time around use "make first_flex"
36 # Installation targeting. Files will be installed under the tree rooted
37 # at DESTDIR. User commands will be installed in BINDIR, library files
38 # in LIBDIR (which will be created if necessary), auxiliary files in
39 # AUXDIR, manual pages will be installed in MANDIR with extension MANEXT.
40 # Raw, unformatted troff source will be installed if INSTALLMAN=man, nroff
41 # preformatted versions will be installed if INSTALLMAN=cat.
44 LIBDIR = /usr/local/lib
45 AUXDIR = /usr/local/lib
46 MANDIR = /usr/man/manl
53 SKELETON_FILE = $(DESTDIR)$(AUXDIR)/flex.skel
54 SKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\"
59 FLEX_FLAGS = -ist8 -Sflex.skel
60 # which "flex" to use to generate scan.c from scan.l
101 all : flex $(FLEXLIB)
104 $(CC) $(CFLAGS) -o flex $(LDFLAGS) $(FLEXOBJS)
108 $(MAKE) $(MFLAGS) flex
110 parse.h parse.c : parse.y
116 $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) scan.l >scan.c
118 scan.o : scan.c parse.h flexdef.h
120 main.o : main.c flexdef.h
121 $(CC) $(CFLAGS) -c $(SKELFLAGS) main.c
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
135 nroff -man flex.1 >flex.man
137 $(FLEXLIB) : $(FLEX_LIB_OBJS)
138 $(AR) cru $(FLEXLIB) $(FLEX_LIB_OBJS)
140 lint : $(FLEX_C_SOURCES)
141 lint $(FLEX_C_SOURCES) > flex.lint
146 $(MAKE) $(MFLAGS) clean
148 install: flex $(DESTDIR)$(LIBDIR) flex.skel install.$(INSTALLMAN) install-lib
149 install -s -m 755 flex $(DESTDIR)$(BINDIR)/flex
150 install -c -m 644 flex.skel $(SKELETON_FILE)
152 install-lib: $(DESTDIR)$(LIBDIR) $(FLEXLIB)
153 install -c -m 644 $(FLEXLIB) $(DESTDIR)$(LIBDIR)/libfl.a
154 $(RANLIB) $(DESTDIR)$(LIBDIR)/libfl.a
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)
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)
170 rm -f core errs flex *.o parse.c *.lint parse.h flex.man tags \
174 ctags $(FLEX_C_SOURCES)
177 $(MAKE) $(MFLAGS) distrib
180 ./flex $(FLEX_FLAGS) $(COMPRESSION) scan.l | diff scan.c -
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)