vmsbuild.com revision 234949
1258945Sroberto$! $Id: vmsbuild.com,v 1.1 2000/11/21 00:38:46 tom Exp $ 2280849Scy$! VMS build-script for BYACC. Requires installed C compiler 3258945Sroberto$! 4258945Sroberto$! Screen Configurations 5258945Sroberto$! --------------------- 6258945Sroberto$! To build BYACC, type: 7258945Sroberto$! $ @vmsbuild [BYACC [<compiler> [bld_target]]] 8258945Sroberto$! 9258945Sroberto$! where: 10258945Sroberto$! <compiler> :== { decc | vaxc } 11258945Sroberto$! 12258945Sroberto$! The default compiler on VAX hosts is vaxc, else decc (Alpha hosts). 13258945Sroberto$! 14258945Sroberto$! ----------------------------------------------------------- 15258945Sroberto$ hlp = f$edit("''p1'", "UPCASE") 16258945Sroberto$ if "''hlp'" .eqs. "HELP" .or. - 17258945Sroberto "''hlp'" .eqs. "-H" .or. - 18280849Scy "''hlp'" .eqs. "-?" .or. - 19258945Sroberto "''hlp'" .eqs. "?" then gosub usage 20258945Sroberto$ goto start 21258945Sroberto$! 22258945Sroberto$ vaxc_config: 23258945Sroberto$ comp = "__vaxc__=1" 24258945Sroberto$ CFLAGS = "/VAXC" 25258945Sroberto$ DEFS = ",HAVE_STRERROR" 26258945Sroberto$ using_vaxc = 1 27258945Sroberto$ return 28258945Sroberto$! 29258945Sroberto$ decc_config: 30258945Sroberto$ comp = "__decc__=1" 31258945Sroberto$ CFLAGS = "/DECC/prefix=all" 32258945Sroberto$ DEFS = ",HAVE_ALARM,HAVE_STRERROR" 33258945Sroberto$ return 34280849Scy$! 35258945Sroberto$ usage: 36258945Sroberto$ write sys$output "usage: " 37258945Sroberto$ write sys$output " $ @vmsbuild [BYACC [{decc | vaxc} [<bldtarget>]]]" 38258945Sroberto$ exit 2 39258945Sroberto$! 40258945Sroberto$ start: 41258945Sroberto$! ----------------------------------------------------------- 42258945Sroberto$! pickup user's compiler choice, if any 43258945Sroberto$! ----------------------------------------------------------- 44258945Sroberto$! 45258945Sroberto$ comp = "" 46258945Sroberto$ using_vaxc = 0 47258945Sroberto$ if "''p2'" .nes. "" 48258945Sroberto$ then 49258945Sroberto$ comp = f$edit(p2, "UPCASE") 50258945Sroberto$ if "''comp'" .eqs. "VAXC" 51258945Sroberto$ then 52258945Sroberto$ gosub vaxc_config 53258945Sroberto$ else 54258945Sroberto$ if "''comp'" .eqs. "DECC" 55258945Sroberto$ then 56258945Sroberto$ gosub decc_config 57258945Sroberto$ else 58258945Sroberto$ gosub usage 59258945Sroberto$ endif 60258945Sroberto$ endif 61258945Sroberto$ endif 62258945Sroberto$! ----------------------------------------------------------- 63258945Sroberto$! Build the option-file 64258945Sroberto$! 65258945Sroberto$ open/write optf vms_link.opt 66258945Sroberto$ write optf "closure.obj" 67258945Sroberto$ write optf "error.obj" 68258945Sroberto$ write optf "lalr.obj" 69258945Sroberto$ write optf "lr0.obj" 70258945Sroberto$ write optf "mkpar.obj" 71258945Sroberto$ write optf "output.obj" 72258945Sroberto$ write optf "reader.obj" 73280849Scy$ write optf "skeleton.obj" 74280849Scy$ write optf "symtab.obj" 75280849Scy$ write optf "verbose.obj" 76280849Scy$ write optf "warshall.obj" 77258945Sroberto$! ---------------------------------- 78258945Sroberto$! Look for the compiler used and specify architecture. 79258945Sroberto$! 80258945Sroberto$ CC = "CC" 81258945Sroberto$ if f$getsyi("HW_MODEL").ge.1024 82258945Sroberto$ then 83258945Sroberto$ arch = "__alpha__=1" 84258945Sroberto$ if "''comp'" .eqs. "" then gosub decc_config 85258945Sroberto$ else 86258945Sroberto$ arch = "__vax__=1" 87258945Sroberto$ if "''comp'" .nes. "" then goto screen_config 88258945Sroberto$ if f$search("SYS$SYSTEM:VAXC.EXE").nes."" 89258945Sroberto$ then 90258945Sroberto$ gosub vaxc_config 91258945Sroberto$ else 92258945Sroberto$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes."" 93258945Sroberto$ then 94258945Sroberto$ gosub decc_config 95258945Sroberto$ else 96258945Sroberto$ DEFS = ",HAVE_STRERROR" 97258945Sroberto$ if f$trnlnm("GNU_CC").eqs."" 98258945Sroberto$ then 99258945Sroberto$ write sys$output "C compiler required to rebuild BYACC" 100258945Sroberto$ close optf 101258945Sroberto$ exit 102258945Sroberto$ else 103258945Sroberto$ write optf "gnu_cc:[000000]gcclib.olb/lib" 104258945Sroberto$ comp = "__gcc__=1" 105258945Sroberto$ CC = "GCC" 106258945Sroberto$ endif 107258945Sroberto$ endif 108258945Sroberto$ endif 109258945Sroberto$ endif 110258945Sroberto$! 111258945Sroberto$ screen_config: 112258945Sroberto$! 113258945Sroberto$ if using_vaxc .eq. 1 then write optf "sys$library:vaxcrtl.exe/share" 114258945Sroberto$ close optf 115258945Sroberto$! -------------- vms_link.opt is created ------------- 116258945Sroberto$ if f$edit("''p1'", "UPCASE") .eqs. "VMS_LINK.OPT" 117258945Sroberto$ then 118258945Sroberto$! mms called this script to build vms_link.opt. all done 119258945Sroberto$ exit 120258945Sroberto$ endif 121258945Sroberto$! 122258945Sroberto$ if f$search("SYS$SYSTEM:MMS.EXE").eqs."" 123258945Sroberto$ then 124258945Sroberto$! can also use /Debug /Listing, /Show=All 125258945Sroberto$ 126258945Sroberto$ CFLAGS := 'CFLAGS/Diagnostics /Define=("''DEFS'") /Include=([]) 127258945Sroberto$ 128258945Sroberto$ if "''p3'" .nes. "" then goto 'p3 129258945Sroberto$! 130258945Sroberto$! 131258945Sroberto$ all : 132258945Sroberto$! 133258945Sroberto$ call make closure 134258945Sroberto$ call make error 135258945Sroberto$ call make lalr 136258945Sroberto$ call make lr0 137258945Sroberto$ call make main 138258945Sroberto$ call make mkpar 139258945Sroberto$ call make output 140258945Sroberto$ call make reader 141258945Sroberto$ call make skeleton 142258945Sroberto$ call make symtab 143258945Sroberto$ call make verbose 144258945Sroberto$ call make warshall 145258945Sroberto$! 146258945Sroberto$ link /exec='target/map/cross main.obj, vms_link/opt 147258945Sroberto$ goto build_last 148258945Sroberto$! 149258945Sroberto$ install : 150258945Sroberto$ WRITE SYS$ERROR "** no rule for install" 151258945Sroberto$ goto build_last 152258945Sroberto$! 153258945Sroberto$ clobber : 154258945Sroberto$ if f$search("BYACC.com") .nes. "" then delete BYACC.com;* 155258945Sroberto$ if f$search("*.exe") .nes. "" then delete *.exe;* 156258945Sroberto$! fallthru 157258945Sroberto$! 158258945Sroberto$ clean : 159258945Sroberto$ if f$search("*.obj") .nes. "" then delete *.obj;* 160258945Sroberto$ if f$search("*.bak") .nes. "" then delete *.bak;* 161258945Sroberto$ if f$search("*.lis") .nes. "" then delete *.lis;* 162293894Sglebius$ if f$search("*.log") .nes. "" then delete *.log;* 163258945Sroberto$ if f$search("*.map") .nes. "" then delete *.map;* 164258945Sroberto$ if f$search("*.opt") .nes. "" then delete *.opt;* 165258945Sroberto$! fallthru 166258945Sroberto$! 167258945Sroberto$ build_last : 168258945Sroberto$ if f$search("*.dia") .nes. "" then delete *.dia;* 169258945Sroberto$ if f$search("*.lis") .nes. "" then purge *.lis 170258945Sroberto$ if f$search("*.obj") .nes. "" then purge *.obj 171258945Sroberto$ if f$search("*.map") .nes. "" then purge *.map 172258945Sroberto$ if f$search("*.opt") .nes. "" then purge *.opt 173258945Sroberto$ if f$search("*.exe") .nes. "" then purge *.exe 174258945Sroberto$ if f$search("*.log") .nes. "" then purge *.log 175258945Sroberto$! fallthru 176258945Sroberto$! 177258945Sroberto$ vms_link_opt : 178258945Sroberto$ exit 1 179258945Sroberto$! 180258945Sroberto$! Runs BYACC from the current directory (used for testing) 181258945Sroberto$ byacc_com : 182258945Sroberto$ if "''f$search("BYACC.com")'" .nes. "" then delete BYACC.com;* 183258945Sroberto$ copy nl: BYACC.com 184258945Sroberto$ open/append test_script BYACC.com 185258945Sroberto$ write test_script "$ temp = f$environment(""procedure"")" 186258945Sroberto$ write test_script "$ temp = temp -" 187258945Sroberto$ write test_script " - f$parse(temp,,,""version"",""syntax_only"") -" 188258945Sroberto$ write test_script " - f$parse(temp,,,""type"",""syntax_only"")" 189258945Sroberto$ write test_script "$ BYACC :== $ 'temp'.exe" 190280849Scy$ write test_script "$ define/user_mode sys$input sys$command" 191280849Scy$ write test_script "$ define/user_mode sys$output sys$command" 192280849Scy$ write test_script "$ BYACC 'p1 'p2 'p3 'p4 'p5 'p6 'p7 'p8" 193258945Sroberto$ close test_script 194258945Sroberto$ write sys$output "** made BYACC.com" 195258945Sroberto$ exit 196258945Sroberto$! 197258945Sroberto$ else 198258945Sroberto$ mms/ignore=warning/macro=('comp','mmstar','arch') 'p3 199258945Sroberto$ endif 200258945Sroberto$ exit 201258945Sroberto$ make: subroutine 202258945Sroberto$ if f$search("''p1'.obj") .eqs. "" 203258945Sroberto$ then 204258945Sroberto$ write sys$output "compiling ''p1'" 205280849Scy$ 'CC 'CFLAGS 'p1.c 206258945Sroberto$ if f$search("''p1'.dia") .nes. "" then delete 'p1.dia;* 207258945Sroberto$ endif 208280849Scy$exit 209258945Sroberto$ return 210258945Sroberto$ endsubroutine 211258945Sroberto