1268899Sbapt$! $Id: vmsbuild.com,v 1.2 2014/04/06 19:08:57 tom Exp $ 2234949Sbapt$! VMS build-script for BYACC. Requires installed C compiler 3234949Sbapt$! 4234949Sbapt$! Screen Configurations 5234949Sbapt$! --------------------- 6234949Sbapt$! To build BYACC, type: 7234949Sbapt$! $ @vmsbuild [BYACC [<compiler> [bld_target]]] 8234949Sbapt$! 9234949Sbapt$! where: 10234949Sbapt$! <compiler> :== { decc | vaxc } 11234949Sbapt$! 12234949Sbapt$! The default compiler on VAX hosts is vaxc, else decc (Alpha hosts). 13234949Sbapt$! 14234949Sbapt$! ----------------------------------------------------------- 15234949Sbapt$ hlp = f$edit("''p1'", "UPCASE") 16234949Sbapt$ if "''hlp'" .eqs. "HELP" .or. - 17234949Sbapt "''hlp'" .eqs. "-H" .or. - 18234949Sbapt "''hlp'" .eqs. "-?" .or. - 19234949Sbapt "''hlp'" .eqs. "?" then gosub usage 20234949Sbapt$ goto start 21234949Sbapt$! 22234949Sbapt$ vaxc_config: 23234949Sbapt$ comp = "__vaxc__=1" 24234949Sbapt$ CFLAGS = "/VAXC" 25234949Sbapt$ DEFS = ",HAVE_STRERROR" 26234949Sbapt$ using_vaxc = 1 27234949Sbapt$ return 28234949Sbapt$! 29234949Sbapt$ decc_config: 30234949Sbapt$ comp = "__decc__=1" 31234949Sbapt$ CFLAGS = "/DECC/prefix=all" 32234949Sbapt$ DEFS = ",HAVE_ALARM,HAVE_STRERROR" 33234949Sbapt$ return 34234949Sbapt$! 35234949Sbapt$ usage: 36234949Sbapt$ write sys$output "usage: " 37234949Sbapt$ write sys$output " $ @vmsbuild [BYACC [{decc | vaxc} [<bldtarget>]]]" 38234949Sbapt$ exit 2 39234949Sbapt$! 40234949Sbapt$ start: 41234949Sbapt$! ----------------------------------------------------------- 42234949Sbapt$! pickup user's compiler choice, if any 43234949Sbapt$! ----------------------------------------------------------- 44234949Sbapt$! 45234949Sbapt$ comp = "" 46234949Sbapt$ using_vaxc = 0 47234949Sbapt$ if "''p2'" .nes. "" 48234949Sbapt$ then 49234949Sbapt$ comp = f$edit(p2, "UPCASE") 50234949Sbapt$ if "''comp'" .eqs. "VAXC" 51234949Sbapt$ then 52234949Sbapt$ gosub vaxc_config 53234949Sbapt$ else 54234949Sbapt$ if "''comp'" .eqs. "DECC" 55234949Sbapt$ then 56234949Sbapt$ gosub decc_config 57234949Sbapt$ else 58234949Sbapt$ gosub usage 59234949Sbapt$ endif 60234949Sbapt$ endif 61234949Sbapt$ endif 62234949Sbapt$! ----------------------------------------------------------- 63234949Sbapt$! Build the option-file 64234949Sbapt$! 65234949Sbapt$ open/write optf vms_link.opt 66234949Sbapt$ write optf "closure.obj" 67234949Sbapt$ write optf "error.obj" 68234949Sbapt$ write optf "lalr.obj" 69234949Sbapt$ write optf "lr0.obj" 70234949Sbapt$ write optf "mkpar.obj" 71234949Sbapt$ write optf "output.obj" 72234949Sbapt$ write optf "reader.obj" 73268899Sbapt$ write optf "yaccpar.obj" 74234949Sbapt$ write optf "symtab.obj" 75234949Sbapt$ write optf "verbose.obj" 76234949Sbapt$ write optf "warshall.obj" 77234949Sbapt$! ---------------------------------- 78234949Sbapt$! Look for the compiler used and specify architecture. 79234949Sbapt$! 80234949Sbapt$ CC = "CC" 81234949Sbapt$ if f$getsyi("HW_MODEL").ge.1024 82234949Sbapt$ then 83234949Sbapt$ arch = "__alpha__=1" 84234949Sbapt$ if "''comp'" .eqs. "" then gosub decc_config 85234949Sbapt$ else 86234949Sbapt$ arch = "__vax__=1" 87234949Sbapt$ if "''comp'" .nes. "" then goto screen_config 88234949Sbapt$ if f$search("SYS$SYSTEM:VAXC.EXE").nes."" 89234949Sbapt$ then 90234949Sbapt$ gosub vaxc_config 91234949Sbapt$ else 92234949Sbapt$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes."" 93234949Sbapt$ then 94234949Sbapt$ gosub decc_config 95234949Sbapt$ else 96234949Sbapt$ DEFS = ",HAVE_STRERROR" 97234949Sbapt$ if f$trnlnm("GNU_CC").eqs."" 98234949Sbapt$ then 99234949Sbapt$ write sys$output "C compiler required to rebuild BYACC" 100234949Sbapt$ close optf 101234949Sbapt$ exit 102234949Sbapt$ else 103234949Sbapt$ write optf "gnu_cc:[000000]gcclib.olb/lib" 104234949Sbapt$ comp = "__gcc__=1" 105234949Sbapt$ CC = "GCC" 106234949Sbapt$ endif 107234949Sbapt$ endif 108234949Sbapt$ endif 109234949Sbapt$ endif 110234949Sbapt$! 111234949Sbapt$ screen_config: 112234949Sbapt$! 113234949Sbapt$ if using_vaxc .eq. 1 then write optf "sys$library:vaxcrtl.exe/share" 114234949Sbapt$ close optf 115234949Sbapt$! -------------- vms_link.opt is created ------------- 116234949Sbapt$ if f$edit("''p1'", "UPCASE") .eqs. "VMS_LINK.OPT" 117234949Sbapt$ then 118234949Sbapt$! mms called this script to build vms_link.opt. all done 119234949Sbapt$ exit 120234949Sbapt$ endif 121234949Sbapt$! 122234949Sbapt$ if f$search("SYS$SYSTEM:MMS.EXE").eqs."" 123234949Sbapt$ then 124234949Sbapt$! can also use /Debug /Listing, /Show=All 125234949Sbapt$ 126234949Sbapt$ CFLAGS := 'CFLAGS/Diagnostics /Define=("''DEFS'") /Include=([]) 127234949Sbapt$ 128234949Sbapt$ if "''p3'" .nes. "" then goto 'p3 129234949Sbapt$! 130234949Sbapt$! 131234949Sbapt$ all : 132234949Sbapt$! 133234949Sbapt$ call make closure 134234949Sbapt$ call make error 135234949Sbapt$ call make lalr 136234949Sbapt$ call make lr0 137234949Sbapt$ call make main 138234949Sbapt$ call make mkpar 139234949Sbapt$ call make output 140234949Sbapt$ call make reader 141268899Sbapt$ call make yaccpar 142234949Sbapt$ call make symtab 143234949Sbapt$ call make verbose 144234949Sbapt$ call make warshall 145234949Sbapt$! 146234949Sbapt$ link /exec='target/map/cross main.obj, vms_link/opt 147234949Sbapt$ goto build_last 148234949Sbapt$! 149234949Sbapt$ install : 150234949Sbapt$ WRITE SYS$ERROR "** no rule for install" 151234949Sbapt$ goto build_last 152234949Sbapt$! 153234949Sbapt$ clobber : 154234949Sbapt$ if f$search("BYACC.com") .nes. "" then delete BYACC.com;* 155234949Sbapt$ if f$search("*.exe") .nes. "" then delete *.exe;* 156234949Sbapt$! fallthru 157234949Sbapt$! 158234949Sbapt$ clean : 159234949Sbapt$ if f$search("*.obj") .nes. "" then delete *.obj;* 160234949Sbapt$ if f$search("*.bak") .nes. "" then delete *.bak;* 161234949Sbapt$ if f$search("*.lis") .nes. "" then delete *.lis;* 162234949Sbapt$ if f$search("*.log") .nes. "" then delete *.log;* 163234949Sbapt$ if f$search("*.map") .nes. "" then delete *.map;* 164234949Sbapt$ if f$search("*.opt") .nes. "" then delete *.opt;* 165234949Sbapt$! fallthru 166234949Sbapt$! 167234949Sbapt$ build_last : 168234949Sbapt$ if f$search("*.dia") .nes. "" then delete *.dia;* 169234949Sbapt$ if f$search("*.lis") .nes. "" then purge *.lis 170234949Sbapt$ if f$search("*.obj") .nes. "" then purge *.obj 171234949Sbapt$ if f$search("*.map") .nes. "" then purge *.map 172234949Sbapt$ if f$search("*.opt") .nes. "" then purge *.opt 173234949Sbapt$ if f$search("*.exe") .nes. "" then purge *.exe 174234949Sbapt$ if f$search("*.log") .nes. "" then purge *.log 175234949Sbapt$! fallthru 176234949Sbapt$! 177234949Sbapt$ vms_link_opt : 178234949Sbapt$ exit 1 179234949Sbapt$! 180234949Sbapt$! Runs BYACC from the current directory (used for testing) 181234949Sbapt$ byacc_com : 182234949Sbapt$ if "''f$search("BYACC.com")'" .nes. "" then delete BYACC.com;* 183234949Sbapt$ copy nl: BYACC.com 184234949Sbapt$ open/append test_script BYACC.com 185234949Sbapt$ write test_script "$ temp = f$environment(""procedure"")" 186234949Sbapt$ write test_script "$ temp = temp -" 187234949Sbapt$ write test_script " - f$parse(temp,,,""version"",""syntax_only"") -" 188234949Sbapt$ write test_script " - f$parse(temp,,,""type"",""syntax_only"")" 189234949Sbapt$ write test_script "$ BYACC :== $ 'temp'.exe" 190234949Sbapt$ write test_script "$ define/user_mode sys$input sys$command" 191234949Sbapt$ write test_script "$ define/user_mode sys$output sys$command" 192234949Sbapt$ write test_script "$ BYACC 'p1 'p2 'p3 'p4 'p5 'p6 'p7 'p8" 193234949Sbapt$ close test_script 194234949Sbapt$ write sys$output "** made BYACC.com" 195234949Sbapt$ exit 196234949Sbapt$! 197234949Sbapt$ else 198234949Sbapt$ mms/ignore=warning/macro=('comp','mmstar','arch') 'p3 199234949Sbapt$ endif 200234949Sbapt$ exit 201234949Sbapt$ make: subroutine 202234949Sbapt$ if f$search("''p1'.obj") .eqs. "" 203234949Sbapt$ then 204234949Sbapt$ write sys$output "compiling ''p1'" 205234949Sbapt$ 'CC 'CFLAGS 'p1.c 206234949Sbapt$ if f$search("''p1'.dia") .nes. "" then delete 'p1.dia;* 207234949Sbapt$ endif 208234949Sbapt$exit 209234949Sbapt$ return 210234949Sbapt$ endsubroutine 211