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