1169695Skan$! libiberty/vmsbuild.com -- build liberty.olb for VMS host, VMS target 2169695Skan$! 3169695Skan$ CC = "gcc /noVerbose/Debug/Incl=([],[-.include])" 4169695Skan$ LIBR = "library /Obj" 5169695Skan$ LINK = "link" 6169695Skan$ DELETE= "delete /noConfirm" 7169695Skan$ SEARCH= "search /Exact" 8169695Skan$ ECHO = "write sys$output" 9169695Skan$ ABORT = "exit %x002C" 10169695Skan$! 11169695Skan$ LIB_NAME = "liberty.olb" !this is what we're going to construct 12169695Skan$ WORK_LIB = "new-lib.olb" !used to guard against an incomplete build 13169695Skan$ 14169695Skan$! manually copied from Makefile.in 15169695Skan$ REQUIRED_OFILES = "argv.o basename.o choose-temp.o concat.o cplus-dem.o "- 16169695Skan + "fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o "- 17169695Skan + "floatformat.o objalloc.o obstack.o spaces.o strerror.o strsignal.o "- 18169695Skan + "xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o" 19169695Skan$! anything not caught by link+search of dummy.* should be added here 20169695Skan$ EXTRA_OFILES = "" 21169695Skan$! 22169695Skan$! move to the directory which contains this command procedure 23169695Skan$ old_dir = f$environ("DEFAULT") 24169695Skan$ new_dir = f$parse("_._;",f$environ("PROCEDURE")) - "_._;" 25169695Skan$ set default 'new_dir' 26169695Skan$ 27169695Skan$ ECHO "Starting libiberty build..." 28169695Skan$ create config.h 29169695Skan/* libiberty config.h for VMS */ 30169695Skan#define NEED_sys_siglist 31169695Skan#define NEED_strsignal 32169695Skan#define NEED_psignal 33169695Skan#define NEED_basename 34169695Skan$ LIBR 'WORK_LIB' /Create 35169695Skan$ 36169695Skan$! first pass: compile "required" modules 37169695Skan$ ofiles = REQUIRED_OFILES + " " + EXTRA_OFILES 38169695Skan$ pass = 1 39169695Skan$ gosub do_ofiles 40169695Skan$ 41169695Skan$! second pass: process dummy.c, using the first pass' results 42169695Skan$ ECHO " now checking run-time library for missing functionality" 43169695Skan$ if f$search("dummy.obj").nes."" then DELETE dummy.obj;* 44169695Skan$ define/noLog sys$error _NL: !can't use /User_Mode here due to gcc 45169695Skan$ define/noLog sys$output _NL: ! driver's use of multiple image activation 46169695Skan$ on error then continue 47169695Skan$ 'CC' dummy.c 48169695Skan$ deassign sys$error !restore, more or less 49169695Skan$ deassign sys$output 50169695Skan$ if f$search("dummy.obj").eqs."" then goto pass2_failure1 51169695Skan$! link dummy.obj, capturing full linker feedback in dummy.map 52169695Skan$ oldmsg = f$environ("MESSAGE") 53169695Skan$ set message /Facility/Severity/Identification/Text 54169695Skan$ define/User sys$output _NL: 55169695Skan$ define/User sys$error _NL: 56169695Skan$ LINK/Map=dummy.map/noExe dummy.obj,'WORK_LIB'/Libr,- 57169695Skan gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr 58169695Skan$ set message 'oldmsg' 59169695Skan$ if f$search("dummy.map").eqs."" then goto pass2_failure2 60169695Skan$ DELETE dummy.obj;* 61169695Skan$ SEARCH dummy.map "%LINK-I-UDFSYM" /Output=dummy.list 62169695Skan$ DELETE dummy.map;* 63169695Skan$ ECHO " check completed" 64169695Skan$! we now have a file with one entry per line of unresolvable symbols 65169695Skan$ ofiles = "" 66169695Skan$ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ 67169695Skan$ open/Read ifile$ dummy.list 68169695Skan$iloop: read/End=idone ifile$ iline 69169695Skan$ iline = f$edit(iline,"COMPRESS,TRIM,LOWERCASE") 70169695Skan$ ofiles = ofiles + " " + f$element(1," ",iline) + ".o" 71169695Skan$ goto iloop 72169695Skan$idone: close ifile$ 73169695Skan$ DELETE dummy.list;* 74169695Skan$ on error then ABORT 75169695Skan$ 76169695Skan$! third pass: compile "missing" modules collected in pass 2 77169695Skan$ pass = 3 78169695Skan$ gosub do_ofiles 79169695Skan$ 80169695Skan$! finish up 81169695Skan$ LIBR 'WORK_LIB' /Compress /Output='LIB_NAME' !new-lib.olb -> liberty.olb 82169695Skan$ DELETE 'WORK_LIB';* 83169695Skan$ 84169695Skan$! all done 85169695Skan$ ECHO "Completed libiberty build." 86169695Skan$ type sys$input: 87169695Skan 88169695Skan You many wish to do 89169695Skan $ COPY LIBERTY.OLB GNU_CC:[000000] 90169695Skan so that this run-time library resides in the same location as gcc's 91169695Skan support library. When building gas, be sure to leave the original 92169695Skan copy of liberty.olb here so that gas's build procedure can find it. 93169695Skan 94169695Skan$ set default 'old_dir' 95169695Skan$ exit 96169695Skan$ 97169695Skan$! 98169695Skan$! compile each element of the space-delimited list 'ofiles' 99169695Skan$! 100169695Skan$do_ofiles: 101169695Skan$ ofiles = f$edit(ofiles,"COMPRESS,TRIM") 102169695Skan$ i = 0 103169695Skan$oloop: 104169695Skan$ f = f$element(i," ",ofiles) 105169695Skan$ if f.eqs." " then goto odone 106169695Skan$ f = f - ".o" !strip dummy suffix 107169695Skan$ ECHO " ''f'" 108169695Skan$ skip_f = 0 109169695Skan$ if pass.eq.3 .and. f$search("''f'.c").eqs."" then gosub chk_deffunc 110169695Skan$ if .not.skip_f 111169695Skan$ then 112169695Skan$ 'CC' 'f'.c 113169695Skan$ LIBR 'WORK_LIB' 'f'.obj /Insert 114169695Skan$ DELETE 'f'.obj;* 115169695Skan$ endif 116169695Skan$ i = i + 1 117169695Skan$ goto oloop 118169695Skan$odone: 119169695Skan$ return 120169695Skan$ 121169695Skan$! 122169695Skan$! check functions.def for a DEFFUNC() entry corresponding to missing file 'f'.c 123169695Skan$! 124169695Skan$chk_deffunc: 125169695Skan$ define/User sys$output _NL: 126169695Skan$ define/User sys$error _NL: 127169695Skan$ SEARCH functions.def "DEFFUNC","''f'" /Match=AND 128169695Skan$ if (($status.and.%x7FFFFFFF) .eq. 1) 129169695Skan$ then 130169695Skan$ skip_f = 1 131169695Skan$ open/Append config_h config.h 132169695Skan$ write config_h "#define NEED_''f'" 133169695Skan$ close config_h 134169695Skan$ endif 135169695Skan$ return 136169695Skan$ 137169695Skan$! 138169695Skan$pass2_failure1: 139169695Skan$! if we reach here, dummy.c failed to compile and we're really stuck 140169695Skan$ type sys$input: 141169695Skan 142169695Skan Cannot compile the library contents checker (dummy.c + functions.def), 143169695Skan so cannot continue! 144169695Skan 145169695Skan$! attempt the compile again, without suppressing diagnostic messages this time 146169695Skan$ on error then ABORT +0*f$verify(v) 147169695Skan$ v = f$verify(1) 148169695Skan$ 'CC' dummy.c 149169695Skan$ ABORT +0*f$verify(v) !'f$verify(0)' 150169695Skan$! 151169695Skan$pass2_failure2: 152169695Skan$! should never reach here.. 153169695Skan$ type sys$input: 154169695Skan 155169695Skan Cannot link the library contents checker (dummy.obj), so cannot continue! 156169695Skan 157169695Skan$! attempt the link again, without suppressing diagnostic messages this time 158169695Skan$ on error then ABORT +0*f$verify(v) 159169695Skan$ v = f$verify(1) 160169695Skan$ LINK/Map=dummy.map/noExe dummy.obj,'WORK_LIB'/Libr,- 161169695Skan gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr 162169695Skan$ ABORT +0*f$verify(v) !'f$verify(0)' 163169695Skan$ 164169695Skan$! not reached 165169695Skan$ exit 166