home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / libiberty / vmsbuild.com < prev    next >
Text File  |  1996-09-28  |  5KB  |  167 lines

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