1# @(#) $Header: /projects/cvsroot/src/router/flex/MISC/Amiga/SMakefile,v 1.1.1.1 2001/04/08 23:53:37 mhuang Exp $ (LBL)
2
3# If your version of "make" does not define $(MAKE), comment in the
4# definition of "MAKE" below.  (You only need to do this if you intend
5# to do "make bigcheck" or "make dist".)
6MAKE = smake
7
8# Possible values for DEFS:
9#
10# For flex to always generate 8-bit scanners, add "-DDEFAULT_CSIZE=256"
11# to DEFS.
12#
13# For Vax/VMS, add "-DVMS" to DEFS.
14#
15# For MS-DOS, add "-DMS_DOS" to DEFS.  See the directory MISC/MSDOS for
16# additional info.
17
18CFLAGS = data=far ignore=85 noicons stackextend optimize
19DEFS = define=YYBISON=1 define=YY_NEVER_INTERACTIVE=1
20LDFLAGS = noicons
21LIBS =
22
23# Installation targeting.  Files will be installed under the tree
24# rooted at prefix.  flex will be installed in bindir, libfl.lib 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 = Programmer:other # Change this for your AMIGA system.
32exec_prefix = $(prefix)
33bindir = $(exec_prefix)/bin
34libdir = $(exec_prefix)/lib
35includedir = $(prefix)/include
36manext = 1
37mandir = $(prefix)/man/man$(manext)
38
39# You can define this to be "lex" if you want to replace lex at your site.
40FLEX = flex
41
42INSTALLMAN = man
43
44SHELL =
45srcdir = .
46VPATH =
47
48LN_S =
49YACC = bison -y
50SED = sed
51CC = sc
52WMERGE = wmerge # from the CWEB distribution
53AR = oml
54RANLIB =
55INSTALL = copy clone
56INSTALL_DATA = $(INSTALL)
57INSTALL_PROGRAM = $(INSTALL)
58
59# You normally do not need to modify anything below this point.
60# ------------------------------------------------------------
61
62CPPFLAGS = idir=. idir=$(srcdir) $(DEFS)
63
64.c.o:
65	$(CC) $(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	skel.o sym.o tblcmp.o yylex.o \
73	$(libdir)/alloca.o $(libdir)/xmalloc.o
74
75LIBSRCS = libmain.c libyywrap.c
76LIBOBJS = ansilibmain.o ansilibyywrap.o
77
78LINTSRCS = ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.c \
79	scan.c skel.c sym.c tblcmp.c yylex.c
80
81DISTFILES = README NEWS COPYING INSTALL FlexLexer.h \
82	configure.in conf.in Makefile.in mkskel.sh skel.c flex.skl \
83	$(HEADERS) $(SOURCES) $(LIBSRCS) MISC \
84	flex.1 scan.c install.sh mkinstalldirs configure
85
86DIST_NAME = flex
87
88# which "flex" to use to generate scan.c from scan.l
89FLEX_EXEC = ./$(FLEX)
90FLEX_FLAGS = -t $(PERF_REPORT)
91COMPRESSION =
92PERF_REPORT = -p
93
94FLEXLIB = libfl.lib
95
96all: $(FLEX)
97
98$(FLEX): $(OBJECTS) $(FLEXLIB) scan.o
99	$(CC) $(CFLAGS) link to $(FLEX) $(LDFLAGS) $(OBJECTS) scan.o $(FLEXLIB) $(LIBS)
100
101bootflex: $(OBJECTS) $(FLEXLIB) initscan.o
102	$(CC) $(CFLAGS) link to $(FLEX) $(LDFLAGS) $(OBJECTS) initscan.o $(FLEXLIB) $(LIBS)
103
104parse.c: ansiparse.y
105	$(YACC) -d ansiparse.y
106	$(SED) "/extern char.*malloc/d" <y.tab.c >parse.tmp
107	copy parse.tmp parse.c
108	copy y.tab.h parse.h
109	@delete y.tab.c y.tab.h parse.tmp
110ansiparse.y: $(srcdir)/parse.y parse.ych
111	$(WMERGE) $(srcdir)/parse.y parse.ych ansiparse.y
112
113parse.h: parse.c
114
115scan.c: scan.l
116	$(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) $(srcdir)/scan.l >scan.tmp
117	$(SED) s,\"$(srcdir)/scan.l\",\"scan.l\", <scan.tmp >scan.c
118	@delete scan.tmp
119
120scan.o: scan.c parse.h flexdef.h config.h
121initscan.o: initscan.c parse.h flexdef.h config.h
122yylex.o: yylex.c parse.h flexdef.h config.h
123
124skel.c: flex.skl mkskel.sh
125	$(SHELL) $(srcdir)/mkskel.sh $(srcdir)/flex.skl >skel.c
126
127main.o: main.c flexdef.h config.h version.h
128ccl.o: ccl.c flexdef.h config.h
129dfa.o: dfa.c flexdef.h config.h
130ecs.o: ecs.c flexdef.h config.h
131gen.o: gen.c flexdef.h config.h
132misc.o: misc.c flexdef.h config.h
133nfa.o: nfa.c flexdef.h config.h
134parse.o: parse.c flexdef.h config.h
135skel.o: skel.c flexdef.h config.h
136sym.o: sym.c flexdef.h config.h
137tblcmp.o: tblcmp.c flexdef.h config.h
138
139alloca.o: alloca.c
140	$(CC) $(CPPFLAGS) $(CFLAGS) define=xmalloc=yy_flex_xmalloc alloca.c
141
142alloca.c: $(srcdir)/MISC/alloca.c
143	@delete alloca.c
144	copy $(srcdir)/MISC/alloca.c .
145
146test: check
147check: flex
148	$(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) $(srcdir)/scan.l > temp_a
149	$(SED) s,"$(srcdir)/scan.l","scan.l", < temp_a > temp_b
150	-diff scan.c temp_b -l10000 -w
151	@delete temp_?
152	@echo "Check successful, using COMPRESSION='$(COMPRESSION)'"
153
154bigcheck:
155	delete scan.c
156	$(MAKE) COMPRESSION=-C check
157	delete scan.c
158	$(MAKE) COMPRESSION=-Ce check
159	delete scan.c
160	$(MAKE) COMPRESSION=-Cm check
161	delete scan.c
162	$(MAKE) COMPRESSION=-Cfea check
163	delete scan.c
164	$(MAKE) COMPRESSION=-CFer check
165	delete scan.c
166	$(MAKE) COMPRESSION=-l PERF_REPORT= check
167	delete scan.c
168	$(MAKE)
169	@echo "All checks successful"
170
171$(FLEXLIB): $(LIBOBJS)
172	$(AR) $(FLEXLIB) R $(LIBOBJS)
173
174$(FLEX).man: flex.1 # SMAKE can't `cd', sorry.  And, I don't have nroff.
175#	cd $(srcdir), nroff -man flex.1 >$(FLEX).man
176
177install: $(FLEX) $(FLEXLIB)
178	$(INSTALL_PROGRAM) $(FLEX) $(bindir)/$(FLEX)
179#	@delete $(bindir)/$(FLEX)++
180	$(INSTALL_DATA) $(FLEXLIB) $(libdir)/libfl.lib
181	$(INSTALL_DATA) $(srcdir)/FlexLexer.h $(includedir)/FlexLexer.h
182
183ansilibmain.o: ansilibmain.c
184ansilibmain.c: libmain.c libmain.ch
185	$(WMERGE) libmain.c libmain.ch ansilibmain.c
186ansilibyywrap.o: ansilibyywrap.c
187ansilibyywrap.c: libyywrap.c libyywrap.ch
188	$(WMERGE) libyywrap.c libyywrap.ch ansilibyywrap.c
189
190clean:
191	-delete parse.(c|h) ansi\#? \#?.(bak|o|lnk) \
192	alloca.c lex.yy.(c|cc) $(FLEXLIB)
193
194veryclean: clean
195	-delete $(FLEX) scan.c
196