BSD 4_4_Lite2 development
[unix-history] / usr / src / contrib / flex-2.5.2 / MISC / VMS / build.com
CommitLineData
0f0b893c
C
1$! VMS build procedure for flex 2.5.x;
2$ v = 'f$verify(0)'
3$!
4$! usage:
5$! $ @[.MISC.VMS]BUILD.COM compiler parser [test]
6$! where `compiler' is either "GNUC" or "DECC" or "VAXC" or empty
7$! and `parser' is either "BISON" or "BYACC" or "YACC" or empty
8$! and `[test]' is either "CHECK-ONLY" or "NO-CHECK" or empty
9$! empty compiler defaults to VAX C (even under Alpha/VMS);
10$! special "LINK" compiler value does link without compilation;
11$! empty parser defaults to using supplied parse code in [.MISC];
12$! optional test is performed by default.
13$!
14$
15$! we start from [.MISC.VMS], then move to the main source directory
16$ where = f$parse("_._;",f$environ("PROCEDURE")) - "_._;"
17$ set default 'where'
18$ brkt = f$extract(f$length(where)-1,1,where)
19$ if f$locate(".MISC.VMS"+brkt,where).lt.f$length(where) then -
20 set default 'f$string(f$extract(0,1,f$dir()) + "-.-" + brkt)'
21$
22$ p1 := 'p1'
23$ p2 := 'p2'
24$ p3 := 'p3'
25$ if p1.eqs."LINK" then goto link
26$ if p3.eqs."CHECK-ONLY" then goto check
27$ p2 = p2 - "_PARSER"
28$!
29$ CDEFS = "/Define=(""VMS"")" ! =(""VMS"",""DEFAULT_CSIZE=256"")
30$!
31$ if p1.eqs."GNUC"
32$ then CC = "gcc"
33$ CFLAGS = "/noList/Opt=2/Debug/noVerbose"
34$ LIBS = "gnu_cc:[000000]gcclib.olb/Library, sys$library:vaxcrtl.olb/Library"
35$ else CC = "cc"
36$ if p1.eqs."DECC"
37$ then CFLAGS = "/noList/Prefix=All"
38$ LIBS = ""
39$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = CC + "/DECC"
40$ else CFLAGS = "/noList/Optimize=noInline"
41$ LIBS = "sys$share:vaxcrtl.exe/Shareable"
42$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = CC + "/VAXC"
43$ if p1.nes."" .and. p1.nes."VAXC" then exit %x002C
44$ endif
45$ endif
46$!
47$ no_parser = 0
48$ if p2.eqs."BISON"
49$ then YACC = "bison"
50$ YACCFLAGS = "/Defines/Fixed_Outfiles"
51$ ALLOCA = ",[]alloca.obj"
52$ else
53$ YACCFLAGS = "-d"
54$ ALLOCA = ""
55$ if p2.eqs."BYACC" .or. p2.eqs."YACC"
56$ then YACC = f$edit(p2,"LOWERCASE")
57$ else YACC = "! yacc"
58$ if p2.nes."" .and. p2.nes."NO" .and. p2.nes."NONE" then exit %x002C
59$ no_parser = 1
60$ endif
61$ endif
62$!
63$ ECHO = "write sys$output"
64$ COPY = "copy_"
65$ MOVE = "rename_/New_Vers"
66$ MUNG = "search_/Exact/Match=NOR"
67$ PURGE = "purge_/noConfirm/noLog"
68$ REMOVE = "delete_/noConfirm/noLog"
69$ TPU = "edit_/TPU/noJournal/noDisplay/noSection"
70$!
71$ if v then set verify
72$!
73$ 'COPY' [.misc.vms]vms-conf.h config.h
74$ 'COPY' [.misc.vms]vms-code.c vms-code.c
75$ 'COPY' [.misc]flex.man flex.doc
76$ if ALLOCA.nes."" then 'COPY' [.MISC]alloca.c alloca.c
77$ 'COPY' initscan.c scan.c !make.bootstrap
78$!
79$ if f$search("skel.c").nes."" then -
80 if f$cvtime(f$file_attr("skel.c","RDT")).gts. -
81 f$cvtime(f$file_attr("flex.skl","RDT")) then goto skip_mkskel
82$ 'TPU' /Command=[.misc.vms]mkskel.tpu flex.skl /Output=skel.c
83$skip_mkskel:
84$!
85$ if f$search("parse.c").nes."" .and. f$search("parse.h").nes."" then -
86 if f$cvtime(f$file_attr("parse.c","RDT")).gts. -
87 f$cvtime(f$file_attr("parse.y","RDT")) then goto skip_yacc
88$ if f$search("y_tab.%").nes."" then 'REMOVE' y_tab.%;*
89$ if no_parser
90$ then 'COPY' [.misc]parse.% sys$disk:[]y_tab.*
91$ else 'YACC' 'YACCFLAGS' parse.y
92$ endif
93$ 'MUNG' y_tab.c "#module","#line" /Output=parse.c
94$ 'REMOVE' y_tab.c;*
95$ 'MOVE' y_tab.h parse.h
96$skip_yacc:
97$!
98$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] ccl.c
99$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] dfa.c
100$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] ecs.c
101$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] gen.c
102$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] main.c
103$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] misc.c
104$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] nfa.c
105$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] parse.c
106$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] scan.c
107$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] skel.c
108$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] sym.c
109$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] tblcmp.c
110$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] yylex.c
111$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] vms-code.c
112$ if ALLOCA.nes."" then - !bison
113 'CC' 'CFLAGS' /Define=("STACK_DIRECTION=-1","xmalloc=yy_flex_xmalloc") alloca.c
114$!
115$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] libmain.c
116$ 'CC' 'CFLAGS' 'CDEFS' /Include=[] libyywrap.c
117$ library/Obj flexlib.olb/Create libmain.obj,libyywrap.obj/Insert
118$ if f$search("flexlib.olb;-1").nes."" then 'PURGE' flexlib.olb
119$!
120$ open/Write optfile sys$disk:[]crtl.opt
121$ write optfile LIBS
122$ close optfile
123$ if f$search("crtl.opt;-1").nes."" then 'PURGE' crtl.opt
124$!
125$ version = "# flex ""2.5""" !default, overridden by version.h
126$ open/Read/Error=v_h_2 hfile version.h
127$ read/End=v_h_1 hfile version
128$v_h_1: close/noLog hfile
129$v_h_2: version = f$element(1,"""",version)
130$ open/Write optfile sys$disk:[]ident.opt
131$ write optfile "identification=""flex ''version'"""
132$ close optfile
133$ if f$search("ident.opt;-1").nes."" then 'PURGE' ident.opt
134$!
135$link:
136$ link/noMap/Exe=flex.exe ccl.obj,dfa.obj,ecs.obj,gen.obj,main.obj,misc.obj,-
137 nfa.obj,parse.obj,scan.obj,skel.obj,sym.obj,tblcmp.obj,yylex.obj,-
138 vms-code.obj 'ALLOCA' ,flexlib.olb/Lib,-
139 sys$disk:[]crtl.opt/Opt,sys$disk:[]ident.opt/Opt
140$!
141$ if p3.eqs."NO-CHECK" .or. p3.eqs."NOCHECK" then goto done
142$
143$check:
144$ 'ECHO' ""
145$ 'ECHO' " Checking with COMPRESSION="""""
146$ mcr sys$disk:[]flex.exe -t -p scan.l > scan.chk
147$ diff_/Output=_NL:/Maximum_Diff=1 scan.c scan.chk
148$ if $status
149$ then 'ECHO' " Test passed."
150$ 'REMOVE' scan.chk;*
151$ else 'ECHO' "? Test failed!"
152$ endif
153$
154$done:
155$ exit