1# descrip.mms -- makefile for building `flex' using MMS or MMK on VMS; 2# created manually from Makefile.in 3# flex 2.5.0 Jan'95 4 5MAKEFILE = descrip.mms # from [.MISC.VMS] 6MAKE = $(MMS) /Descr=$(MAKEFILE) 7MAKEFLAGS = $(MMSQUALIFIERS) 8 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. 13 14DEFS = /Define=("VMS") 15LDFLAGS = /noMap 16 17# compiler handling 18.ifdef GNUC 19CC = gcc 20GCCINIT = ! SET COMMAND GNU_CC:[000000]GCC 21CFLAGS = /noList/Opt=2/Debug/noVerbose 22LIBS = gnu_cc:[000000]gcclib.olb/Library, sys$library:vaxcrtl.olb/Library 23C_CHOICE = "GNUC=1" 24.else ! not GNU C 25CC = cc 26GCCINIT = 27.ifdef DECC 28CFLAGS = /noList/Prefix=All 29LIBS = 30C_CHOICE = "DECC=1" 31.else ! not DEC C; assume VAX C 32CFLAGS = /noList/Optimize=noInline 33LIBS = sys$share:vaxcrtl.exe/Shareable 34C_CHOICE = "VAXC=1" 35.endif 36.endif 37 38# parser handling 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 43.ifdef bison_parser 44YACC = bison 45YACCFLAGS = /Defines/Fixed_Outfiles 46YACCINIT = set command gnu_bison:[000000]bison 47ALLOCA = ,[]alloca.obj # note leading comma 48.else 49YACCFLAGS = -d 50YACCINIT = 51ALLOCA = 52.ifdef byacc_parser 53YACC = byacc 54.else 55.ifdef yacc_parser 56YACC = yacc 57.else 58# none of bison, byacc, or yacc specified 59.ifdef no_parser 60.else 61no_parser=1 62.endif #<none> 63.endif #yacc 64.endif #byacc 65.endif #bison 66 67# VMS-specific hackery 68ECHO = write sys$output # requires single quoted arg 69COPY = copy_ # 70MOVE = rename_/New_Vers # within same device only 71MUNG = search_/Exact/Match=NOR # to strip unwanted `#module' directive 72NOOP = continue # non-empty command that does nothing 73PURGE = purge_/noConfirm/noLog # relatively quiet file removal 74REMOVE = delete_/noConfirm/noLog # ditto 75TOUCH = append_/New _NL: # requires single file arg 76TPU = edit_/TPU/noJournal/noDisplay/noSection 77 78# You can define this to be "lex.exe" if you want to replace lex at your site. 79FLEX =flex.exe 80# note: there should be no whitespace between `=' and the name, 81# or else $(FLEX_EXEC) below will not function properly. 82FLEXLIB = flexlib.olb 83 84# You normally do not need to modify anything below this point. 85# ------------------------------------------------------------ 86 87VMSDIR = [.MISC.VMS] 88MISCDIR = [.MISC] 89CURDIR = sys$disk:[] 90 91CPPFLAGS = $(DEFS)/Include=[] 92LIBOPT = $(CURDIR)crtl.opt # run-time library(s) 93ID_OPT = $(CURDIR)ident.opt # version identification 94 95.SUFFIXES : # avoid overhead of umpteen built-in rules 96.SUFFIXES : .obj .c 97 98.c.obj : 99 $(CC)$(CFLAGS)$(CPPFLAGS) $< 100 101VMSHDRS = $(VMSDIR)vms-conf.h # copied to []config.h 102VMSSRCS = $(VMSDIR)vms-code.c # copied to []vms-code.c 103VMSOBJS = ,vms-code.obj # note leading comma 104 105HEADERS = flexdef.h version.h 106 107SOURCES = 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 109OBJECTS = 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) 111 112LIBSRCS = libmain.c libyywrap.c 113LIBOBJS = libmain.obj,libyywrap.obj 114 115LINTSRCS = 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 117 118DISTFILES = 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 122 123DIST_NAME = flex 124 125# flex options to use when generating scan.c from scan.l 126COMPRESSION = 127PERF_REPORT = -p 128# which "flex" to use to generate scan.c from scan.l 129FLEX_EXEC = mcr $(CURDIR)$(FLEX) 130FLEX_FLAGS = -t $(PERF_REPORT) #$(COMPRESSION) 131 132MARKER = make.bootstrap 133 134##### targets start here ##### 135 136all : $(FLEX) flex.doc 137 @ $(NOOP) 138 139install : $(FLEX) flex.doc flex.skl $(FLEXLIB) FlexLexer.h 140 @ $(ECHO) "-- Installation must be done manually." 141 @ $(ECHO) " $+" 142 143.ifdef GCCINIT 144.FIRST 145 $(GCCINIT) 146 147.endif #GCCINIT 148 149flex : $(FLEX) 150 @ $(NOOP) 151 152$(FLEX) : $(MARKER) $(OBJECTS) $(FLEXLIB) $(LIBOPT) $(ID_OPT) 153 $(LINK)/Exe=$(FLEX) $(LDFLAGS)\ 154 $(OBJECTS),$(FLEXLIB)/Lib,$(LIBOPT)/Opt,$(ID_OPT)/Opt 155 156$(MARKER) : initscan.c 157 @- if f$search("scan.c").nes."" then $(REMOVE) scan.c;* 158 $(COPY) initscan.c scan.c 159 @ $(TOUCH) $(MARKER) 160 161parse.c : parse.y 162 @- if f$search("y_tab.%").nes."" then $(REMOVE) y_tab.%;* 163.ifdef no_parser 164 $(COPY) $(MISCDIR)parse.% $(CURDIR)y_tab.* 165.else 166 $(YACCINIT) 167 $(YACC) $(YACCFLAGS) parse.y 168.endif 169 $(MUNG) y_tab.c "#module","#line" /Output=parse.c 170 @- $(REMOVE) y_tab.c;* 171 $(MOVE) y_tab.h parse.h 172 173parse.h : parse.c 174 @ $(TOUCH) parse.h 175 176scan.c : scan.l 177 $(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) scan.l > scan.c 178 179scan.obj : scan.c parse.h flexdef.h config.h 180yylex.obj : yylex.c parse.h flexdef.h config.h 181 182skel.c : flex.skl $(VMSDIR)mkskel.tpu 183 $(TPU) /Command=$(VMSDIR)mkskel.tpu flex.skl /Output=skel.c 184 185main.obj : main.c flexdef.h config.h version.h 186ccl.obj : ccl.c flexdef.h config.h 187dfa.obj : dfa.c flexdef.h config.h 188ecs.obj : ecs.c flexdef.h config.h 189gen.obj : gen.c flexdef.h config.h 190misc.obj : misc.c flexdef.h config.h 191nfa.obj : nfa.c flexdef.h config.h 192parse.obj : parse.c flexdef.h config.h 193skel.obj : skel.c flexdef.h config.h 194sym.obj : sym.c flexdef.h config.h 195tblcmp.obj : tblcmp.c flexdef.h config.h 196vms-code.obj : vms-code.c flexdef.h config.h 197 198[]alloca.obj : alloca.c 199 $(CC)$(CFLAGS)/Define=("STACK_DIRECTION=-1","xmalloc=yy_flex_xmalloc") alloca.c 200 201alloca.c : $(MISCDIR)alloca.c 202 $(COPY) $(MISCDIR)alloca.c alloca.c 203 204config.h : $(VMSDIR)vms-conf.h 205 $(COPY) $(VMSDIR)vms-conf.h config.h 206 207vms-code.c : $(VMSDIR)vms-code.c 208 $(COPY) $(VMSDIR)vms-code.c vms-code.c 209 210test : check 211 @ $(NOOP) 212check : $(FLEX) 213 @ $(ECHO) "" 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 217 218bigcheck : 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) 235 @- $(PURGE) scan.obj 236 @ $(ECHO) "All checks successful" 237 238$(FLEXLIB) : $(LIBOBJS) 239 library/Obj $(FLEXLIB)/Create $(LIBOBJS)/Insert 240 @ if f$search("$(FLEXLIB);-1").nes."" then $(PURGE) $(FLEXLIB) 241 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. 245flex.doc : flex.1 246 @ if f$search("$(MISCDIR)flex.man").eqs."" then \ 247 $(COPY) flex.1 $(MISCDIR)flex.man 248 $(COPY) $(MISCDIR)flex.man flex.doc 249 250# 251# This is completely VMS-specific... 252# 253 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)" 259 @ close optfile 260 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 269 @- close/noLog hfile 270 @ version = f$element(1,"""",version) 271 @ open/Write optfile $(ID_OPT) 272 @ write optfile "identification=""flex ''version'""" 273 @ close optfile 274 275 276# 277# This is the only stuff moderately useful from the remainder 278# of Makefile.in... 279# 280 281mostlyclean : 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 286 287clean : mostlyclean 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);* 295 296distclean : clean 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;* 308 309realclean : distclean 310 @- if f$search("skel.c").nes."" then $(REMOVE) skel.c;* 311 312