1 1.1.1.7 christos $! Id: vmsbuild.com,v 1.2 2014/04/06 19:08:57 tom Exp 2 1.1 christos $! VMS build-script for BYACC. Requires installed C compiler 3 1.1 christos $! 4 1.1 christos $! Screen Configurations 5 1.1 christos $! --------------------- 6 1.1 christos $! To build BYACC, type: 7 1.1 christos $! $ @vmsbuild [BYACC [<compiler> [bld_target]]] 8 1.1 christos $! 9 1.1 christos $! where: 10 1.1 christos $! <compiler> :== { decc | vaxc } 11 1.1 christos $! 12 1.1 christos $! The default compiler on VAX hosts is vaxc, else decc (Alpha hosts). 13 1.1 christos $! 14 1.1 christos $! ----------------------------------------------------------- 15 1.1 christos $ hlp = f$edit("''p1'", "UPCASE") 16 1.1 christos $ if "''hlp'" .eqs. "HELP" .or. - 17 1.1 christos "''hlp'" .eqs. "-H" .or. - 18 1.1 christos "''hlp'" .eqs. "-?" .or. - 19 1.1 christos "''hlp'" .eqs. "?" then gosub usage 20 1.1 christos $ goto start 21 1.1 christos $! 22 1.1 christos $ vaxc_config: 23 1.1 christos $ comp = "__vaxc__=1" 24 1.1 christos $ CFLAGS = "/VAXC" 25 1.1 christos $ DEFS = ",HAVE_STRERROR" 26 1.1 christos $ using_vaxc = 1 27 1.1 christos $ return 28 1.1 christos $! 29 1.1 christos $ decc_config: 30 1.1 christos $ comp = "__decc__=1" 31 1.1 christos $ CFLAGS = "/DECC/prefix=all" 32 1.1 christos $ DEFS = ",HAVE_ALARM,HAVE_STRERROR" 33 1.1 christos $ return 34 1.1 christos $! 35 1.1 christos $ usage: 36 1.1 christos $ write sys$output "usage: " 37 1.1 christos $ write sys$output " $ @vmsbuild [BYACC [{decc | vaxc} [<bldtarget>]]]" 38 1.1 christos $ exit 2 39 1.1 christos $! 40 1.1 christos $ start: 41 1.1 christos $! ----------------------------------------------------------- 42 1.1 christos $! pickup user's compiler choice, if any 43 1.1 christos $! ----------------------------------------------------------- 44 1.1 christos $! 45 1.1 christos $ comp = "" 46 1.1 christos $ using_vaxc = 0 47 1.1 christos $ if "''p2'" .nes. "" 48 1.1 christos $ then 49 1.1 christos $ comp = f$edit(p2, "UPCASE") 50 1.1 christos $ if "''comp'" .eqs. "VAXC" 51 1.1 christos $ then 52 1.1 christos $ gosub vaxc_config 53 1.1 christos $ else 54 1.1 christos $ if "''comp'" .eqs. "DECC" 55 1.1 christos $ then 56 1.1 christos $ gosub decc_config 57 1.1 christos $ else 58 1.1 christos $ gosub usage 59 1.1 christos $ endif 60 1.1 christos $ endif 61 1.1 christos $ endif 62 1.1 christos $! ----------------------------------------------------------- 63 1.1 christos $! Build the option-file 64 1.1 christos $! 65 1.1 christos $ open/write optf vms_link.opt 66 1.1 christos $ write optf "closure.obj" 67 1.1 christos $ write optf "error.obj" 68 1.1 christos $ write optf "lalr.obj" 69 1.1 christos $ write optf "lr0.obj" 70 1.1 christos $ write optf "mkpar.obj" 71 1.1 christos $ write optf "output.obj" 72 1.1 christos $ write optf "reader.obj" 73 1.1.1.5 christos $ write optf "yaccpar.obj" 74 1.1 christos $ write optf "symtab.obj" 75 1.1 christos $ write optf "verbose.obj" 76 1.1 christos $ write optf "warshall.obj" 77 1.1 christos $! ---------------------------------- 78 1.1 christos $! Look for the compiler used and specify architecture. 79 1.1 christos $! 80 1.1 christos $ CC = "CC" 81 1.1 christos $ if f$getsyi("HW_MODEL").ge.1024 82 1.1 christos $ then 83 1.1 christos $ arch = "__alpha__=1" 84 1.1 christos $ if "''comp'" .eqs. "" then gosub decc_config 85 1.1 christos $ else 86 1.1 christos $ arch = "__vax__=1" 87 1.1 christos $ if "''comp'" .nes. "" then goto screen_config 88 1.1 christos $ if f$search("SYS$SYSTEM:VAXC.EXE").nes."" 89 1.1 christos $ then 90 1.1 christos $ gosub vaxc_config 91 1.1 christos $ else 92 1.1 christos $ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes."" 93 1.1 christos $ then 94 1.1 christos $ gosub decc_config 95 1.1 christos $ else 96 1.1 christos $ DEFS = ",HAVE_STRERROR" 97 1.1 christos $ if f$trnlnm("GNU_CC").eqs."" 98 1.1 christos $ then 99 1.1 christos $ write sys$output "C compiler required to rebuild BYACC" 100 1.1 christos $ close optf 101 1.1 christos $ exit 102 1.1 christos $ else 103 1.1 christos $ write optf "gnu_cc:[000000]gcclib.olb/lib" 104 1.1 christos $ comp = "__gcc__=1" 105 1.1 christos $ CC = "GCC" 106 1.1 christos $ endif 107 1.1 christos $ endif 108 1.1 christos $ endif 109 1.1 christos $ endif 110 1.1 christos $! 111 1.1 christos $ screen_config: 112 1.1 christos $! 113 1.1 christos $ if using_vaxc .eq. 1 then write optf "sys$library:vaxcrtl.exe/share" 114 1.1 christos $ close optf 115 1.1 christos $! -------------- vms_link.opt is created ------------- 116 1.1 christos $ if f$edit("''p1'", "UPCASE") .eqs. "VMS_LINK.OPT" 117 1.1 christos $ then 118 1.1 christos $! mms called this script to build vms_link.opt. all done 119 1.1 christos $ exit 120 1.1 christos $ endif 121 1.1 christos $! 122 1.1 christos $ if f$search("SYS$SYSTEM:MMS.EXE").eqs."" 123 1.1 christos $ then 124 1.1 christos $! can also use /Debug /Listing, /Show=All 125 1.1 christos $ 126 1.1 christos $ CFLAGS := 'CFLAGS/Diagnostics /Define=("''DEFS'") /Include=([]) 127 1.1 christos $ 128 1.1 christos $ if "''p3'" .nes. "" then goto 'p3 129 1.1 christos $! 130 1.1 christos $! 131 1.1 christos $ all : 132 1.1 christos $! 133 1.1 christos $ call make closure 134 1.1 christos $ call make error 135 1.1 christos $ call make lalr 136 1.1 christos $ call make lr0 137 1.1 christos $ call make main 138 1.1 christos $ call make mkpar 139 1.1 christos $ call make output 140 1.1 christos $ call make reader 141 1.1.1.5 christos $ call make yaccpar 142 1.1 christos $ call make symtab 143 1.1 christos $ call make verbose 144 1.1 christos $ call make warshall 145 1.1 christos $! 146 1.1 christos $ link /exec='target/map/cross main.obj, vms_link/opt 147 1.1 christos $ goto build_last 148 1.1 christos $! 149 1.1 christos $ install : 150 1.1 christos $ WRITE SYS$ERROR "** no rule for install" 151 1.1 christos $ goto build_last 152 1.1 christos $! 153 1.1 christos $ clobber : 154 1.1 christos $ if f$search("BYACC.com") .nes. "" then delete BYACC.com;* 155 1.1 christos $ if f$search("*.exe") .nes. "" then delete *.exe;* 156 1.1 christos $! fallthru 157 1.1 christos $! 158 1.1 christos $ clean : 159 1.1 christos $ if f$search("*.obj") .nes. "" then delete *.obj;* 160 1.1 christos $ if f$search("*.bak") .nes. "" then delete *.bak;* 161 1.1 christos $ if f$search("*.lis") .nes. "" then delete *.lis;* 162 1.1 christos $ if f$search("*.log") .nes. "" then delete *.log;* 163 1.1 christos $ if f$search("*.map") .nes. "" then delete *.map;* 164 1.1 christos $ if f$search("*.opt") .nes. "" then delete *.opt;* 165 1.1 christos $! fallthru 166 1.1 christos $! 167 1.1 christos $ build_last : 168 1.1 christos $ if f$search("*.dia") .nes. "" then delete *.dia;* 169 1.1 christos $ if f$search("*.lis") .nes. "" then purge *.lis 170 1.1 christos $ if f$search("*.obj") .nes. "" then purge *.obj 171 1.1 christos $ if f$search("*.map") .nes. "" then purge *.map 172 1.1 christos $ if f$search("*.opt") .nes. "" then purge *.opt 173 1.1 christos $ if f$search("*.exe") .nes. "" then purge *.exe 174 1.1 christos $ if f$search("*.log") .nes. "" then purge *.log 175 1.1 christos $! fallthru 176 1.1 christos $! 177 1.1 christos $ vms_link_opt : 178 1.1 christos $ exit 1 179 1.1 christos $! 180 1.1 christos $! Runs BYACC from the current directory (used for testing) 181 1.1 christos $ byacc_com : 182 1.1 christos $ if "''f$search("BYACC.com")'" .nes. "" then delete BYACC.com;* 183 1.1 christos $ copy nl: BYACC.com 184 1.1 christos $ open/append test_script BYACC.com 185 1.1 christos $ write test_script "$ temp = f$environment(""procedure"")" 186 1.1 christos $ write test_script "$ temp = temp -" 187 1.1 christos $ write test_script " - f$parse(temp,,,""version"",""syntax_only"") -" 188 1.1 christos $ write test_script " - f$parse(temp,,,""type"",""syntax_only"")" 189 1.1 christos $ write test_script "$ BYACC :== $ 'temp'.exe" 190 1.1 christos $ write test_script "$ define/user_mode sys$input sys$command" 191 1.1 christos $ write test_script "$ define/user_mode sys$output sys$command" 192 1.1 christos $ write test_script "$ BYACC 'p1 'p2 'p3 'p4 'p5 'p6 'p7 'p8" 193 1.1 christos $ close test_script 194 1.1 christos $ write sys$output "** made BYACC.com" 195 1.1 christos $ exit 196 1.1 christos $! 197 1.1 christos $ else 198 1.1 christos $ mms/ignore=warning/macro=('comp','mmstar','arch') 'p3 199 1.1 christos $ endif 200 1.1 christos $ exit 201 1.1 christos $ make: subroutine 202 1.1 christos $ if f$search("''p1'.obj") .eqs. "" 203 1.1 christos $ then 204 1.1 christos $ write sys$output "compiling ''p1'" 205 1.1 christos $ 'CC 'CFLAGS 'p1.c 206 1.1 christos $ if f$search("''p1'.dia") .nes. "" then delete 'p1.dia;* 207 1.1 christos $ endif 208 1.1 christos $exit 209 1.1 christos $ return 210 1.1 christos $ endsubroutine 211