1###############################################################################
2# Makefile for flex 2.5.0.6 (beta) with Borland C/C++ version 4.02
3#
4# This will probably need to be adjusted for your existing lexer/parser
5# generators.  See definitions for FLEX and YACC near the bottom of the
6# makefile.
7#
8# This makefile builds initflex.exe and flex.exe by default.  It
9# removes initflex.exe after making flex.exe.  After that, you may
10# choose to try alternate compression options for your everyday flex
11# executable.
12#
13# This will build flex with the large model.  Don't use huge, but if you
14# feel like experimenting with other models, post your success stories to 
15# comp.compilers, OK?
16#
17# This makefile does *not* implement the big testing found in "makefile.in".
18#
19# I also assume the availability of sed and the gnu file utilities on the
20# system - they're readily available, so if you don't have them, why not?
21#                                                                 <grin>
22#
23# The resulting generated lexer (the real goal, right?) will compile
24# (and run nicely, too) as a .c file, as well as being included such as
25# extern "C" { #include "lexyyc" } in a .cplusplus file.
26#
27###############################################################################
28
29DEBUG = 1
30
31.autodepend
32
33all:	initflex.exe flex.exe
34	rm initflex.exe initflex.map
35
36###############################################################################
37#
38# standard utilitities? ha.
39#
40
41CC	= bcc
42CPP     = bcc
43
44###############################################################################
45#
46
47MODEL	= l
48
49!if $(DEBUG) == 1
50!message Building with debug.
51debugCompile = -v
52debugLink = /v
53!else
54!message Building without debug.
55debugCompile =
56debugLink =
57!endif
58
59LOADER	= c0$(MODEL).obj
60LIBS	= c$(MODEL).lib
61LINKFLAGS = $(debugLink)
62
63DATASEG	= -dc -Ff
64SizeOPT	= -Os -G-
65Defines =
66
67COMMON	= -A -c -m$(MODEL) $(SizeOPT) $(DATASEG) $(Defines) $(debugCompile)
68CFLAGS  = -o$@ $(COMMON)
69CCFLAGS  = -o$@ $(COMMON) -Pcc
70
71###############################################################################
72
73.SUFFIXES:	.cc
74
75.cc.obj:
76	$(CPP) $(CCFLAGS) $<
77
78.c.obj:
79	$(CPP) $(CFLAGS) $<
80
81###############################################################################
82#
83# source & object files
84#
85
86BASESRC = ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.c \
87	sym.c tblcmp.c yylex.c skel.c
88
89INITSRC = $(BASESRC) initscan.c
90
91INITOBJS = $(INITSRC:.c=.obj)
92
93SRC = $(BASESRC) scan.c
94
95OBJS = $(SRC:.c=.obj)
96
97objects:	$(OBJS)
98	@echo $(OBJS)
99
100###############################################################################
101#
102# Executable
103#
104
105initflex.exe:      $(INITOBJS)
106	tlink $(LINKFLAGS) @&&!
107$(LOADER) $**
108$&.exe
109
110$(LIBS)
111!
112
113flex.exe:      $(OBJS)
114	tlink $(LINKFLAGS) @&&!
115$(LOADER) $**
116$&.exe
117
118$(LIBS)
119!
120
121# 
122###############################################################################
123#
124# Lex files
125#
126
127FLEX	= .\initflex
128FLEX_FLAGS = -ist
129
130scan.c: scan.l
131	$(FLEX) $(FLEX_FLAGS) scan.l >scan.tmp
132	sed s,\"$(srcdir)/scan.l\",\"scan.l\", <scan.tmp >scan.c
133	@rm scan.tmp
134
135###############################################################################
136#
137# YACC files
138#
139
140YACC	= .\bison
141YFLAGS  = -vdyl
142
143parse.c: parse.y
144	$(YACC) -ydl parse.y
145	@sed "/extern char.*malloc/d" <y_tab.c >parse.c
146	@rm -f y_tab.c
147	@mv y_tab.h parse.h
148
149###############################################################################
150#
151# cleanup
152#
153
154clean:
155	-rm *.obj *.map initflex.exe
156
157realclean:	clean
158	-rm flex.exe
159
160#
161# end Makefile
162#
163###############################################################################
164