Home | History | Annotate | Download | only in VMS
      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 
      5 MAKEFILE  = descrip.mms		    # from [.MISC.VMS]
      6 MAKE	  = $(MMS) /Descr=$(MAKEFILE)
      7 MAKEFLAGS = $(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 
     14 DEFS	  = /Define=("VMS")
     15 LDFLAGS	  = /noMap
     16 
     17 # compiler handling
     18 .ifdef GNUC
     19 CC	  = gcc
     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
     23 C_CHOICE  = "GNUC=1"
     24 .else		! not GNU C
     25 CC	  = cc
     26 GCCINIT	  =
     27 .ifdef DECC
     28 CFLAGS	  = /noList/Prefix=All
     29 LIBS	  =
     30 C_CHOICE  = "DECC=1"
     31 .else		! not DEC C; assume VAX C
     32 CFLAGS	  = /noList/Optimize=noInline
     33 LIBS	  = sys$share:vaxcrtl.exe/Shareable
     34 C_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
     44 YACC	  = bison
     45 YACCFLAGS = /Defines/Fixed_Outfiles
     46 YACCINIT  = set command gnu_bison:[000000]bison
     47 ALLOCA	  = ,[]alloca.obj		# note leading comma
     48 .else
     49 YACCFLAGS = -d
     50 YACCINIT  =
     51 ALLOCA	  =
     52 .ifdef byacc_parser
     53 YACC	  = byacc
     54 .else
     55 .ifdef yacc_parser
     56 YACC	  = yacc
     57 .else
     58 #	none of bison, byacc, or yacc specified
     59 .ifdef no_parser
     60 .else
     61 no_parser=1
     62 .endif	#<none>
     63 .endif	#yacc
     64 .endif	#byacc
     65 .endif	#bison
     66 
     67 # VMS-specific hackery
     68 ECHO	  = write sys$output		# requires single quoted arg
     69 COPY	  = copy_			#
     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
     77 
     78 # You can define this to be "lex.exe" if you want to replace lex at your site.
     79 FLEX	=flex.exe
     80 #	note: there should be no whitespace between `=' and the name,
     81 #	or else $(FLEX_EXEC) below will not function properly.
     82 FLEXLIB	  = flexlib.olb
     83 
     84 # You normally do not need to modify anything below this point.
     85 # ------------------------------------------------------------
     86 
     87 VMSDIR	  = [.MISC.VMS]
     88 MISCDIR	  = [.MISC]
     89 CURDIR	  = sys$disk:[]
     90 
     91 CPPFLAGS  = $(DEFS)/Include=[]
     92 LIBOPT	  = $(CURDIR)crtl.opt		# run-time library(s)
     93 ID_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 
    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
    104 
    105 HEADERS = flexdef.h version.h
    106 
    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)
    111 
    112 LIBSRCS = libmain.c libyywrap.c
    113 LIBOBJS = libmain.obj,libyywrap.obj
    114 
    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
    117 
    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
    122 
    123 DIST_NAME = flex
    124 
    125 # flex options to use when generating scan.c from scan.l
    126 COMPRESSION =
    127 PERF_REPORT = -p
    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)
    131 
    132 MARKER	= make.bootstrap
    133 
    134 ##### targets start here #####
    135 
    136 all : $(FLEX) flex.doc
    137 	@ $(NOOP)
    138 
    139 install : $(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 
    149 flex : $(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 
    161 parse.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 
    173 parse.h : parse.c
    174 	@ $(TOUCH) parse.h
    175 
    176 scan.c : scan.l
    177 	$(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) scan.l > scan.c
    178 
    179 scan.obj : scan.c parse.h flexdef.h config.h
    180 yylex.obj : yylex.c parse.h flexdef.h config.h
    181 
    182 skel.c : flex.skl $(VMSDIR)mkskel.tpu
    183 	$(TPU) /Command=$(VMSDIR)mkskel.tpu flex.skl /Output=skel.c
    184 
    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
    197 
    198 []alloca.obj : alloca.c
    199 	$(CC)$(CFLAGS)/Define=("STACK_DIRECTION=-1","xmalloc=yy_flex_xmalloc") alloca.c
    200 
    201 alloca.c : $(MISCDIR)alloca.c
    202 	$(COPY) $(MISCDIR)alloca.c alloca.c
    203 
    204 config.h : $(VMSDIR)vms-conf.h
    205 	$(COPY) $(VMSDIR)vms-conf.h config.h
    206 
    207 vms-code.c : $(VMSDIR)vms-code.c
    208 	$(COPY) $(VMSDIR)vms-code.c vms-code.c
    209 
    210 test : check
    211 	@ $(NOOP)
    212 check : $(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 
    218 bigcheck :
    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.
    245 flex.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 
    281 mostlyclean :
    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 
    287 clean : 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 
    296 distclean : 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 
    309 realclean : distclean
    310 	@- if f$search("skel.c").nes."" then $(REMOVE) skel.c;*
    311 
    312