1# @(#) $Header: /home/daffy/u0/vern/flex/RCS/Makefile.in,v 1.45 96/09/10 16:59:04 vern Exp $ (LBL)
2
3@SET_MAKE@
4
5# Possible values for DEFS:
6#
7# By default, flex generates 8-bit scanners when using table compression,
8# and 7-bit scanners when using uncompressed tables (-f or -F options).
9# For flex to always generate 8-bit scanners, add "-DDEFAULT_CSIZE=256"
10# to DEFS.
11#
12# For Vax/VMS, add "-DVMS" to DEFS.
13#
14# For MS-DOS, add "-DMS_DOS" to DEFS.  See the directory MISC/MSDOS for
15# additional info.
16
17CFLAGS = @CFLAGS@
18CPPFLAGS = @CPPFLAGS@
19DEFS = @DEFS@
20LDFLAGS = 
21LIBS = @LIBS@
22
23# Installation targeting.  Files will be installed under the tree
24# rooted at prefix.  flex will be installed in bindir, libfl.a in
25# libdir, FlexLexer.h will be installed in includedir, and the manual
26# pages will be installed in mandir with extension manext.
27# 
28# Raw, unformatted troff source will be installed if INSTALLMAN=man,
29# nroff preformatted versions will be installed if INSTALLMAN=cat.
30
31prefix = @prefix@
32exec_prefix = @exec_prefix@
33bindir = $(exec_prefix)/bin
34libdir = $(exec_prefix)/lib
35includedir = $(prefix)/include
36manext = 1
37mandir = $(prefix)/man/man$(manext)
38
39# You can define these to be "lex" and "libl.a" if you want to replace
40# lex at your site.
41FLEX = flex
42FLEXLIB = libfl.a
43
44INSTALLMAN = man
45
46SHELL = /bin/sh
47srcdir = @srcdir@
48VPATH = @srcdir@
49
50LN_S = @LN_S@
51YACC = @YACC@
52CC = @CC@
53AR = ar
54RANLIB = @RANLIB@
55INSTALL = @INSTALL@
56INSTALL_DATA = @INSTALL_DATA@
57INSTALL_PROGRAM = @INSTALL_PROGRAM@
58
59# You normally do not need to modify anything below this point.
60# ------------------------------------------------------------
61
62CPPFLAGS = -I. -I$(srcdir)
63
64.c.o:
65	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
66
67HEADERS = flexdef.h version.h
68
69SOURCES = ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.y \
70	scan.l skel.c sym.c tblcmp.c yylex.c
71OBJECTS = ccl.o dfa.o ecs.o gen.o main.o misc.o nfa.o parse.o \
72	scan.o skel.o sym.o tblcmp.o yylex.o @ALLOCA@
73
74LIBSRCS = libmain.c libyywrap.c
75LIBOBJS = libmain.o libyywrap.o
76
77LINTSRCS = ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.c \
78	scan.c skel.c sym.c tblcmp.c yylex.c
79
80DISTFILES = README NEWS COPYING INSTALL FlexLexer.h \
81	configure.in conf.in Makefile.in mkskel.sh flex.skl \
82	$(HEADERS) $(SOURCES) $(LIBSRCS) MISC \
83	flex.1 scan.c install.sh mkinstalldirs configure
84
85DIST_NAME = flex
86
87# which "flex" to use to generate scan.c from scan.l
88FLEX_EXEC = ./$(FLEX)
89FLEX_FLAGS = -t $(PERF_REPORT)
90COMPRESSION =
91PERF_REPORT = -p
92
93
94all: $(FLEX)
95
96$(FLEX): .bootstrap $(OBJECTS) $(FLEXLIB)
97	$(CC) $(CFLAGS) -o $(FLEX) $(LDFLAGS) $(OBJECTS) $(FLEXLIB) $(LIBS)
98
99.bootstrap: initscan.c
100	@rm -f scan.c
101	cp $(srcdir)/initscan.c scan.c
102	touch .bootstrap
103
104parse.c: parse.y
105	$(YACC) -d $(srcdir)/parse.y
106	@sed '/extern char.*malloc/d' <y.tab.c >parse.tmp
107	@mv parse.tmp parse.c
108	@mv y.tab.h parse.h
109	@rm -f y.tab.c
110
111parse.h: parse.c
112
113scan.c: scan.l
114	$(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) $(srcdir)/scan.l >scan.c
115	@sed s,\"$(srcdir)/scan.l\",\"scan.l\", <scan.c >scan.tmp
116	@mv scan.tmp scan.c
117
118scan.o: scan.c parse.h flexdef.h config.h
119yylex.o: yylex.c parse.h flexdef.h config.h
120
121skel.c: flex.skl mkskel.sh
122	$(SHELL) $(srcdir)/mkskel.sh $(srcdir)/flex.skl >skel.c
123
124main.o: main.c flexdef.h config.h version.h
125ccl.o: ccl.c flexdef.h config.h
126dfa.o: dfa.c flexdef.h config.h
127ecs.o: ecs.c flexdef.h config.h
128gen.o: gen.c flexdef.h config.h
129misc.o: misc.c flexdef.h config.h
130nfa.o: nfa.c flexdef.h config.h
131parse.o: parse.c flexdef.h config.h
132skel.o: skel.c flexdef.h config.h
133sym.o: sym.c flexdef.h config.h
134tblcmp.o: tblcmp.c flexdef.h config.h
135
136alloca.o: alloca.c
137	$(CC) $(CPPFLAGS) $(CFLAGS) -c -Dxmalloc=yy_flex_xmalloc alloca.c
138
139alloca.c: $(srcdir)/MISC/alloca.c
140	@rm -f alloca.c
141	cp $(srcdir)/MISC/alloca.c .
142
143test: check
144check: $(FLEX)
145	$(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) $(srcdir)/scan.l \
146	| sed s,\"$(srcdir)/scan.l\",\"scan.l\", \
147	| diff scan.c -
148	@echo "Check successful, using COMPRESSION=\"$(COMPRESSION)\""
149
150bigcheck:
151	rm -f scan.c ; $(MAKE) COMPRESSION="-C" check
152	rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" check
153	rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" check
154	rm -f scan.c ; $(MAKE) COMPRESSION="-f" check
155	rm -f scan.c ; $(MAKE) COMPRESSION="-Cfea" check
156	rm -f scan.c ; $(MAKE) COMPRESSION="-CFer" check
157	rm -f scan.c ; $(MAKE) COMPRESSION="-l" PERF_REPORT="" check
158	rm -f scan.c ; $(MAKE)
159	@echo "All checks successful"
160
161$(FLEXLIB): $(LIBOBJS)
162	$(AR) cru $(FLEXLIB) $(LIBOBJS)
163	-$(RANLIB) $(FLEXLIB)
164
165$(FLEX).man: flex.1
166	cd $(srcdir) && nroff -man flex.1 >$(FLEX).man
167
168install: $(FLEX) $(FLEXLIB) installdirs install.$(INSTALLMAN)
169	$(INSTALL_PROGRAM) $(FLEX) $(bindir)/$(FLEX)
170	@rm -f $(bindir)/$(FLEX)++
171	cd $(bindir) && $(LN_S) $(FLEX) $(FLEX)++
172	$(INSTALL_DATA) $(FLEXLIB) $(libdir)/$(FLEXLIB)
173	-cd $(libdir) && $(RANLIB) $(FLEXLIB)
174	$(INSTALL_DATA) $(srcdir)/FlexLexer.h $(includedir)/FlexLexer.h
175
176# Note, the following rules delete any vestigial flexdoc installed
177# for a prior flex release.
178install.man: flex.1
179	rm -f $(mandir)/$(FLEX)doc.$(manext)
180	$(INSTALL_DATA) $(srcdir)/flex.1 $(mandir)/$(FLEX).$(manext)
181
182install.cat: $(FLEX).man
183	rm -f $(mandir)/$(FLEX)doc.$(manext)
184	$(INSTALL_DATA) $(srcdir)/$(FLEX).man $(mandir)/$(FLEX).$(manext)
185
186installdirs:
187	$(SHELL) $(srcdir)/mkinstalldirs \
188	  $(bindir) $(libdir) $(includedir) $(mandir)
189
190uninstall:
191	rm -f $(bindir)/$(FLEX) $(bindir)/$(FLEX)++
192	rm -f $(libdir)/$(FLEXLIB)
193	rm -f $(includedir)/FlexLexer.h
194	rm -f $(mandir)/$(FLEX).$(manext) $(mandir)/$(FLEX)doc.$(manext)
195
196tags: $(SOURCES)
197	ctags $(SOURCES)
198
199TAGS: $(SOURCES)
200	etags $(SOURCES)
201
202lint: $(LINTSRCS)
203	lint -Dconst= $(LINTSRCS) > flex.lint
204
205gcc-lint: $(LINTSRCS)
206	gcc -Dlint -Wall $(LINTSRCS) >flex.gcc-lint 2>&1
207
208mostlyclean:
209	rm -f a.out *.bak core errs scan.tmp
210
211clean: mostlyclean
212	rm -f flex parse.c parse.h *.o alloca.c *.lint lex.yy.c lex.yy.cc \
213		$(FLEXLIB) config.log config.cache
214
215distclean: clean
216	rm -f .bootstrap $(FLEX) scan.c tags TAGS Makefile config.status \
217		config.h stamp-h config.log config.cache
218
219maintainer-clean: distclean
220	@echo "This command is intended for maintainers to use;"
221	@echo "it deletes files that may require special tools to rebuild."
222	rm -f $(FLEX).man skel.c flex*.tar.gz flex*.tar.Z
223
224dist: $(FLEX) $(DISTFILES) parse.c parse.h $(srcdir)/$(FLEX).man
225	$(MAKE) DIST_NAME=flex-`sed <version.h 's/[^"]*"//' | sed 's/"//'` dist2
226
227dist2:
228	@rm -rf $(DIST_NAME)
229	@rm -f $(DIST_NAME).tar $(DIST_NAME).tar.Z $(DIST_NAME).tar.gz
230	@mkdir $(DIST_NAME)
231	tar cf - $(DISTFILES) | (cd $(DIST_NAME) && tar xfB -)
232	@mv $(DIST_NAME)/scan.c $(DIST_NAME)/initscan.c
233	@chmod 444 $(DIST_NAME)/initscan.c
234	@chmod +w $(DIST_NAME)/Makefile.in
235	@cp parse.c parse.h $(DIST_NAME)/MISC
236	@col -b <$(srcdir)/$(FLEX).man >$(DIST_NAME)/MISC/flex.man
237	tar chf $(DIST_NAME).tar $(DIST_NAME)
238	compress <$(DIST_NAME).tar >$(DIST_NAME).tar.Z
239	gzip <$(DIST_NAME).tar >$(DIST_NAME).tar.gz
240	@rm $(DIST_NAME).tar
241
242# For an explanation of the following Makefile rules, see node
243# `Automatic Remaking' in GNU Autoconf documentation.
244Makefile: $(srcdir)/Makefile.in config.status
245	CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
246config.status: configure
247	./config.status --recheck
248configure: configure.in
249	cd $(srcdir) && autoconf
250config.h: stamp-h
251stamp-h: conf.in config.status
252	CONFIG_FILES= CONFIG_HEADERS=config.h:conf.in ./config.status
253	echo timestamp >stamp-h
254# conf.in: stamp-h.in
255# stamp-h.in: configure.in acconfig.h
256# 	cd $(srcdir) && autoheader
257# 	config.h.in conf.in
258# 	cho timestamp > $(srcdir)/stamp-h.in
259
260# Tell versions [3.59,3.63) of GNU make not to export all variables.
261# Otherwise a system limit (for SysV at least) may be exceeded.
262.NOEXPORT:
263