1*00bf4279Sespie$! libiberty/vmsbuild.com -- build liberty.olb for VMS host, VMS target 2*00bf4279Sespie$! 3*00bf4279Sespie$ CC = "gcc /noVerbose/Debug/Incl=([],[-.include])" 4*00bf4279Sespie$ LIBR = "library /Obj" 5*00bf4279Sespie$ LINK = "link" 6*00bf4279Sespie$ DELETE= "delete /noConfirm" 7*00bf4279Sespie$ SEARCH= "search /Exact" 8*00bf4279Sespie$ ECHO = "write sys$output" 9*00bf4279Sespie$ ABORT = "exit %x002C" 10*00bf4279Sespie$! 11*00bf4279Sespie$ LIB_NAME = "liberty.olb" !this is what we're going to construct 12*00bf4279Sespie$ WORK_LIB = "new-lib.olb" !used to guard against an incomplete build 13*00bf4279Sespie$ 14*00bf4279Sespie$! manually copied from Makefile.in 15*00bf4279Sespie$ REQUIRED_OFILES = "argv.o basename.o choose-temp.o concat.o cplus-dem.o "- 16*00bf4279Sespie + "fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o "- 17*00bf4279Sespie + "floatformat.o objalloc.o obstack.o spaces.o strerror.o strsignal.o "- 18*00bf4279Sespie + "xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o" 19*00bf4279Sespie$! anything not caught by link+search of dummy.* should be added here 20*00bf4279Sespie$ EXTRA_OFILES = "" 21*00bf4279Sespie$! 22*00bf4279Sespie$! move to the directory which contains this command procedure 23*00bf4279Sespie$ old_dir = f$environ("DEFAULT") 24*00bf4279Sespie$ new_dir = f$parse("_._;",f$environ("PROCEDURE")) - "_._;" 25*00bf4279Sespie$ set default 'new_dir' 26*00bf4279Sespie$ 27*00bf4279Sespie$ ECHO "Starting libiberty build..." 28*00bf4279Sespie$ create config.h 29*00bf4279Sespie/* libiberty config.h for VMS */ 30*00bf4279Sespie#define NEED_sys_siglist 31*00bf4279Sespie#define NEED_strsignal 32*00bf4279Sespie#define NEED_psignal 33*00bf4279Sespie#define NEED_basename 34*00bf4279Sespie$ LIBR 'WORK_LIB' /Create 35*00bf4279Sespie$ 36*00bf4279Sespie$! first pass: compile "required" modules 37*00bf4279Sespie$ ofiles = REQUIRED_OFILES + " " + EXTRA_OFILES 38*00bf4279Sespie$ pass = 1 39*00bf4279Sespie$ gosub do_ofiles 40*00bf4279Sespie$ 41*00bf4279Sespie$! second pass: process dummy.c, using the first pass' results 42*00bf4279Sespie$ ECHO " now checking run-time library for missing functionality" 43*00bf4279Sespie$ if f$search("dummy.obj").nes."" then DELETE dummy.obj;* 44*00bf4279Sespie$ define/noLog sys$error _NL: !can't use /User_Mode here due to gcc 45*00bf4279Sespie$ define/noLog sys$output _NL: ! driver's use of multiple image activation 46*00bf4279Sespie$ on error then continue 47*00bf4279Sespie$ 'CC' dummy.c 48*00bf4279Sespie$ deassign sys$error !restore, more or less 49*00bf4279Sespie$ deassign sys$output 50*00bf4279Sespie$ if f$search("dummy.obj").eqs."" then goto pass2_failure1 51*00bf4279Sespie$! link dummy.obj, capturing full linker feedback in dummy.map 52*00bf4279Sespie$ oldmsg = f$environ("MESSAGE") 53*00bf4279Sespie$ set message /Facility/Severity/Identification/Text 54*00bf4279Sespie$ define/User sys$output _NL: 55*00bf4279Sespie$ define/User sys$error _NL: 56*00bf4279Sespie$ LINK/Map=dummy.map/noExe dummy.obj,'WORK_LIB'/Libr,- 57*00bf4279Sespie gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr 58*00bf4279Sespie$ set message 'oldmsg' 59*00bf4279Sespie$ if f$search("dummy.map").eqs."" then goto pass2_failure2 60*00bf4279Sespie$ DELETE dummy.obj;* 61*00bf4279Sespie$ SEARCH dummy.map "%LINK-I-UDFSYM" /Output=dummy.list 62*00bf4279Sespie$ DELETE dummy.map;* 63*00bf4279Sespie$ ECHO " check completed" 64*00bf4279Sespie$! we now have a file with one entry per line of unresolvable symbols 65*00bf4279Sespie$ ofiles = "" 66*00bf4279Sespie$ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ 67*00bf4279Sespie$ open/Read ifile$ dummy.list 68*00bf4279Sespie$iloop: read/End=idone ifile$ iline 69*00bf4279Sespie$ iline = f$edit(iline,"COMPRESS,TRIM,LOWERCASE") 70*00bf4279Sespie$ ofiles = ofiles + " " + f$element(1," ",iline) + ".o" 71*00bf4279Sespie$ goto iloop 72*00bf4279Sespie$idone: close ifile$ 73*00bf4279Sespie$ DELETE dummy.list;* 74*00bf4279Sespie$ on error then ABORT 75*00bf4279Sespie$ 76*00bf4279Sespie$! third pass: compile "missing" modules collected in pass 2 77*00bf4279Sespie$ pass = 3 78*00bf4279Sespie$ gosub do_ofiles 79*00bf4279Sespie$ 80*00bf4279Sespie$! finish up 81*00bf4279Sespie$ LIBR 'WORK_LIB' /Compress /Output='LIB_NAME' !new-lib.olb -> liberty.olb 82*00bf4279Sespie$ DELETE 'WORK_LIB';* 83*00bf4279Sespie$ 84*00bf4279Sespie$! all done 85*00bf4279Sespie$ ECHO "Completed libiberty build." 86*00bf4279Sespie$ type sys$input: 87*00bf4279Sespie 88*00bf4279Sespie You many wish to do 89*00bf4279Sespie $ COPY LIBERTY.OLB GNU_CC:[000000] 90*00bf4279Sespie so that this run-time library resides in the same location as gcc's 91*00bf4279Sespie support library. When building gas, be sure to leave the original 92*00bf4279Sespie copy of liberty.olb here so that gas's build procedure can find it. 93*00bf4279Sespie 94*00bf4279Sespie$ set default 'old_dir' 95*00bf4279Sespie$ exit 96*00bf4279Sespie$ 97*00bf4279Sespie$! 98*00bf4279Sespie$! compile each element of the space-delimited list 'ofiles' 99*00bf4279Sespie$! 100*00bf4279Sespie$do_ofiles: 101*00bf4279Sespie$ ofiles = f$edit(ofiles,"COMPRESS,TRIM") 102*00bf4279Sespie$ i = 0 103*00bf4279Sespie$oloop: 104*00bf4279Sespie$ f = f$element(i," ",ofiles) 105*00bf4279Sespie$ if f.eqs." " then goto odone 106*00bf4279Sespie$ f = f - ".o" !strip dummy suffix 107*00bf4279Sespie$ ECHO " ''f'" 108*00bf4279Sespie$ skip_f = 0 109*00bf4279Sespie$ if pass.eq.3 .and. f$search("''f'.c").eqs."" then gosub chk_deffunc 110*00bf4279Sespie$ if .not.skip_f 111*00bf4279Sespie$ then 112*00bf4279Sespie$ 'CC' 'f'.c 113*00bf4279Sespie$ LIBR 'WORK_LIB' 'f'.obj /Insert 114*00bf4279Sespie$ DELETE 'f'.obj;* 115*00bf4279Sespie$ endif 116*00bf4279Sespie$ i = i + 1 117*00bf4279Sespie$ goto oloop 118*00bf4279Sespie$odone: 119*00bf4279Sespie$ return 120*00bf4279Sespie$ 121*00bf4279Sespie$! 122*00bf4279Sespie$! check functions.def for a DEFFUNC() entry corresponding to missing file 'f'.c 123*00bf4279Sespie$! 124*00bf4279Sespie$chk_deffunc: 125*00bf4279Sespie$ define/User sys$output _NL: 126*00bf4279Sespie$ define/User sys$error _NL: 127*00bf4279Sespie$ SEARCH functions.def "DEFFUNC","''f'" /Match=AND 128*00bf4279Sespie$ if (($status.and.%x7FFFFFFF) .eq. 1) 129*00bf4279Sespie$ then 130*00bf4279Sespie$ skip_f = 1 131*00bf4279Sespie$ open/Append config_h config.h 132*00bf4279Sespie$ write config_h "#define NEED_''f'" 133*00bf4279Sespie$ close config_h 134*00bf4279Sespie$ endif 135*00bf4279Sespie$ return 136*00bf4279Sespie$ 137*00bf4279Sespie$! 138*00bf4279Sespie$pass2_failure1: 139*00bf4279Sespie$! if we reach here, dummy.c failed to compile and we're really stuck 140*00bf4279Sespie$ type sys$input: 141*00bf4279Sespie 142*00bf4279Sespie Cannot compile the library contents checker (dummy.c + functions.def), 143*00bf4279Sespie so cannot continue! 144*00bf4279Sespie 145*00bf4279Sespie$! attempt the compile again, without suppressing diagnostic messages this time 146*00bf4279Sespie$ on error then ABORT +0*f$verify(v) 147*00bf4279Sespie$ v = f$verify(1) 148*00bf4279Sespie$ 'CC' dummy.c 149*00bf4279Sespie$ ABORT +0*f$verify(v) !'f$verify(0)' 150*00bf4279Sespie$! 151*00bf4279Sespie$pass2_failure2: 152*00bf4279Sespie$! should never reach here.. 153*00bf4279Sespie$ type sys$input: 154*00bf4279Sespie 155*00bf4279Sespie Cannot link the library contents checker (dummy.obj), so cannot continue! 156*00bf4279Sespie 157*00bf4279Sespie$! attempt the link again, without suppressing diagnostic messages this time 158*00bf4279Sespie$ on error then ABORT +0*f$verify(v) 159*00bf4279Sespie$ v = f$verify(1) 160*00bf4279Sespie$ LINK/Map=dummy.map/noExe dummy.obj,'WORK_LIB'/Libr,- 161*00bf4279Sespie gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr 162*00bf4279Sespie$ ABORT +0*f$verify(v) !'f$verify(0)' 163*00bf4279Sespie$ 164*00bf4279Sespie$! not reached 165*00bf4279Sespie$ exit 166