1 # descrip.mms -- makefile for building `flex' using MMS or MMK on VMS;
2 # created manually from Makefile.in
5 MAKEFILE = descrip.mms # from [.MISC.VMS]
6 MAKE = $(MMS) /Descr=$(MAKEFILE)
7 MAKEFLAGS = $(MMSQUALIFIERS)
9 # Possible values for DEFS:
10 # "VMS" -- used just to make sure parentheses aren't empty;
11 # For flex to always generate 8-bit scanners, append
12 # ,"DEFAULT_CSIZE=256" inside /Define=() of DEFS.
14 DEFS = /Define=("VMS")
20 GCCINIT = ! SET COMMAND GNU_CC:[000000]GCC
21 CFLAGS = /noList/Opt=2/Debug/noVerbose
22 LIBS = gnu_cc:[000000]gcclib.olb/Library, sys$library:vaxcrtl.olb/Library
28 CFLAGS = /noList/Prefix=All
31 .else ! not DEC C; assume VAX C
32 CFLAGS = /noList/Optimize=noInline
33 LIBS = sys$share:vaxcrtl.exe/Shareable
39 # mms/macro=("xxxC=1","zzz_parser=1"), where "zzz_parser" is
40 # either "bison_parser" or "byacc_parser" or "yacc_parser",
41 # otherwise assumed to be "no_parser"; and where "xxxC=1" is
42 # either "VAXC=1", "GNUC=1", or "DECC=1" as above
45 YACCFLAGS = /Defines/Fixed_Outfiles
46 YACCINIT = set command gnu_bison:[000000]bison
47 ALLOCA = ,[]alloca.obj # note leading comma
58 # none of bison, byacc, or yacc specified
67 # VMS-specific hackery
68 ECHO = write sys$output # requires single quoted arg
70 MOVE = rename_/New_Vers # within same device only
71 MUNG = search_/Exact/Match=NOR # to strip unwanted `#module' directive
72 NOOP = continue # non-empty command that does nothing
73 PURGE = purge_/noConfirm/noLog # relatively quiet file removal
74 REMOVE = delete_/noConfirm/noLog # ditto
75 TOUCH = append_/New _NL: # requires single file arg
76 TPU = edit_/TPU/noJournal/noDisplay/noSection
78 # You can define this to be "lex.exe" if you want to replace lex at your site.
80 # note: there should be no whitespace between `=' and the name,
81 # or else $(FLEX_EXEC) below will not function properly.
84 # You normally do not need to modify anything below this point.
85 # ------------------------------------------------------------
91 CPPFLAGS = $(DEFS)/Include=[]
92 LIBOPT = $(CURDIR)crtl.opt # run-time library(s)
93 ID_OPT = $(CURDIR)ident.opt # version identification
95 .SUFFIXES : # avoid overhead of umpteen built-in rules
99 $(CC)$(CFLAGS)$(CPPFLAGS) $<
101 VMSHDRS = $(VMSDIR)vms-conf.h # copied to []config.h
102 VMSSRCS = $(VMSDIR)vms-code.c # copied to []vms-code.c
103 VMSOBJS = ,vms-code.obj # note leading comma
105 HEADERS = flexdef.h version.h
107 SOURCES = ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.y \
108 scan.l skel.c sym.c tblcmp.c yylex.c
109 OBJECTS = ccl.obj,dfa.obj,ecs.obj,gen.obj,main.obj,misc.obj,nfa.obj,parse.obj,\
110 scan.obj,skel.obj,sym.obj,tblcmp.obj,yylex.obj $(VMSOBJS) $(ALLOCA)
112 LIBSRCS = libmain.c libyywrap.c
113 LIBOBJS = libmain.obj,libyywrap.obj
115 LINTSRCS = ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.c \
116 scan.c skel.c sym.c tblcmp.c yylex.c
118 DISTFILES = README NEWS COPYING INSTALL FlexLexer.h \
119 configure.in conf.in Makefile.in mkskel.sh flex.skl \
120 $(HEADERS) $(SOURCES) $(LIBSRCS) MISC \
121 flex.1 scan.c install.sh mkinstalldirs configure
125 # flex options to use when generating scan.c from scan.l
128 # which "flex" to use to generate scan.c from scan.l
129 FLEX_EXEC = mcr $(CURDIR)$(FLEX)
130 FLEX_FLAGS = -t $(PERF_REPORT) #$(COMPRESSION)
132 MARKER = make.bootstrap
134 ##### targets start here #####
136 all : $(FLEX) flex.doc
139 install : $(FLEX) flex.doc flex.skl $(FLEXLIB) FlexLexer.h
140 @ $(ECHO) "-- Installation must be done manually."
152 $(FLEX) : $(MARKER) $(OBJECTS) $(FLEXLIB) $(LIBOPT) $(ID_OPT)
153 $(LINK)/Exe=$(FLEX) $(LDFLAGS)\
154 $(OBJECTS),$(FLEXLIB)/Lib,$(LIBOPT)/Opt,$(ID_OPT)/Opt
156 $(MARKER) : initscan.c
157 @- if f$search("scan.c").nes."" then $(REMOVE) scan.c;*
158 $(COPY) initscan.c scan.c
162 @- if f$search("y_tab.%").nes."" then $(REMOVE) y_tab.%;*
164 $(COPY) $(MISCDIR)parse.% $(CURDIR)y_tab.*
167 $(YACC) $(YACCFLAGS) parse.y
169 $(MUNG) y_tab.c "#module","#line" /Output=parse.c
170 @- $(REMOVE) y_tab.c;*
171 $(MOVE) y_tab.h parse.h
177 $(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) scan.l > scan.c
179 scan.obj : scan.c parse.h flexdef.h config.h
180 yylex.obj : yylex.c parse.h flexdef.h config.h
182 skel.c : flex.skl $(VMSDIR)mkskel.tpu
183 $(TPU) /Command=$(VMSDIR)mkskel.tpu flex.skl /Output=skel.c
185 main.obj : main.c flexdef.h config.h version.h
186 ccl.obj : ccl.c flexdef.h config.h
187 dfa.obj : dfa.c flexdef.h config.h
188 ecs.obj : ecs.c flexdef.h config.h
189 gen.obj : gen.c flexdef.h config.h
190 misc.obj : misc.c flexdef.h config.h
191 nfa.obj : nfa.c flexdef.h config.h
192 parse.obj : parse.c flexdef.h config.h
193 skel.obj : skel.c flexdef.h config.h
194 sym.obj : sym.c flexdef.h config.h
195 tblcmp.obj : tblcmp.c flexdef.h config.h
196 vms-code.obj : vms-code.c flexdef.h config.h
198 []alloca.obj : alloca.c
199 $(CC)$(CFLAGS)/Define=("STACK_DIRECTION=-1","xmalloc=yy_flex_xmalloc") alloca.c
201 alloca.c : $(MISCDIR)alloca.c
202 $(COPY) $(MISCDIR)alloca.c alloca.c
204 config.h : $(VMSDIR)vms-conf.h
205 $(COPY) $(VMSDIR)vms-conf.h config.h
207 vms-code.c : $(VMSDIR)vms-code.c
208 $(COPY) $(VMSDIR)vms-code.c vms-code.c
214 @ $(ECHO) " Checking with COMPRESSION="$(COMPRESSION)""
215 $(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) scan.l > scan.chk
216 diff_/Output=_NL:/Maximum_Diff=1 scan.c scan.chk
219 @- if f$search("scan.c").nes."" then $(REMOVE) scan.c;*
220 $(MAKE)$(MAKEFLAGS) /Macro=($(C_CHOICE),"COMPRESSION=""-C""") check
221 @- $(REMOVE) scan.c;*
222 $(MAKE)$(MAKEFLAGS) /Macro=($(C_CHOICE),"COMPRESSION=""-Ce""") check
223 @- $(REMOVE) scan.c;*
224 $(MAKE)$(MAKEFLAGS) /Macro=($(C_CHOICE),"COMPRESSION=""-Cm""") check
225 @- $(REMOVE) scan.c;*
226 $(MAKE)$(MAKEFLAGS) /Macro=($(C_CHOICE),"COMPRESSION=""-f""") check
227 @- $(REMOVE) scan.c;*
228 $(MAKE)$(MAKEFLAGS) /Macro=($(C_CHOICE),"COMPRESSION=""-Cfea""") check
229 @- $(REMOVE) scan.c;*
230 $(MAKE)$(MAKEFLAGS) /Macro=($(C_CHOICE),"COMPRESSION=""-CFer""") check
231 @- $(REMOVE) scan.c;*
232 $(MAKE)$(MAKEFLAGS) /Macro=($(C_CHOICE),"COMPRESSION=""-l""","PERF_REPORT=") check
233 @- $(REMOVE) scan.c;*,scan.chk;*
234 $(MAKE)$(MAKEFLAGS) $(FLEX)
236 @ $(ECHO) "All checks successful"
238 $(FLEXLIB) : $(LIBOBJS)
239 library/Obj $(FLEXLIB)/Create $(LIBOBJS)/Insert
240 @ if f$search("$(FLEXLIB);-1").nes."" then $(PURGE) $(FLEXLIB)
242 # We call it .doc instead of .man, to lessen culture shock. :-}
243 # If MISC/flex.man is out of date relative to flex.1, there's
244 # not much we can do about it with the tools readily available.
246 @ if f$search("$(MISCDIR)flex.man").eqs."" then \
247 $(COPY) flex.1 $(MISCDIR)flex.man
248 $(COPY) $(MISCDIR)flex.man flex.doc
251 # This is completely VMS-specific...
254 # Linker options file specifying run-time library(s) to link against;
255 # choice depends on which C compiler is used, and might be empty.
256 $(LIBOPT) : $(MAKEFILE)
257 @ open/Write optfile $(LIBOPT)
258 @ write optfile "$(LIBS)"
261 # Linker options file putting the version number where the ANALYZE/IMAGE
262 # command will be able to find and report it; assumes that the first line
263 # of version.h has the version number enclosed within the first and second
264 # double quotes on it [as in ``#define FLEX_VERSION "2.5.0"''].
265 $(ID_OPT) : version.h
266 @ version = "# flex ""2.5""" !default, overridden by version.h
267 @- open/Read hfile version.h
268 @- read hfile version
270 @ version = f$element(1,"""",version)
271 @ open/Write optfile $(ID_OPT)
272 @ write optfile "identification=""flex ''version'"""
277 # This is the only stuff moderately useful from the remainder
282 @- if f$search("scan.chk").nes."" then $(REMOVE) scan.chk;*
283 @- if f$search("*.obj;-1").nes."" then $(PURGE) *.obj
284 @- if f$search("*.exe;-1").nes."" then $(PURGE) *.exe
285 @- if f$search("*.opt;-1").nes."" then $(PURGE) *.opt
288 @- if f$search("*.obj").nes."" then $(REMOVE) *.obj;*
289 @- if f$search("parse.h").nes."" then $(REMOVE) parse.h;*
290 @- if f$search("parse.c").nes."" then $(REMOVE) parse.c;*
291 @- if f$search("alloca.c").nes."" .and.-
292 f$search("$(MISCDIR)alloca.c").nes."" then $(REMOVE) alloca.c;*
293 @- if f$search("$(LIBOPT)").nes."" then $(REMOVE) $(LIBOPT);*
294 @- if f$search("$(ID_OPT)").nes."" then $(REMOVE) $(ID_OPT);*
297 @- if f$search("$(MARKER)").nes."" then $(REMOVE) $(MARKER);*
298 @- if f$search("$(FLEX)").nes."" then $(REMOVE) $(FLEX);*
299 @- if f$search("$(FLEXLIB)").nes."" then $(REMOVE) $(FLEXLIB);*
300 @- if f$search("flex.doc").nes."" then $(REMOVE) flex.doc;*
301 @- if f$search("scan.c").nes."" then $(REMOVE) scan.c;*
302 @- if f$search("vms-code.c").nes."" .and.-
303 f$search("$(VMSDIR)vms-code.c").nes."" then $(REMOVE) vms-code.c;*
304 @- if f$search("config.h").nes."" .and.-
305 f$search("$(VMSDIR)vms-conf.h").nes."" then $(REMOVE) config.h;*
306 # @- if f$search("descrip.mms").nes."" .and.-
307 # f$search("$(VMSDIR)descrip.mms").nes."" then $(REMOVE) descrip.mms;*
309 realclean : distclean
310 @- if f$search("skel.c").nes."" then $(REMOVE) skel.c;*