]>
Commit | Line | Data |
---|---|---|
0ab45e0a RS |
1 | $! Set the def dir to proper place for use in batch. Works for interactive too. |
2 | $flnm = f$enviroment("PROCEDURE") ! get current procedure name | |
3 | $set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")' | |
4 | $! | |
7f211789 RS |
5 | $ v=f$verify(0) |
6 | $set symbol/scope=(nolocal,noglobal) | |
0ab45e0a RS |
7 | $! |
8 | $! CAUTION: If you want to link gcc-cc1 to the sharable image library | |
9 | $! VAXCRTL, see the notes in gcc.texinfo (or INSTALL) first. | |
10 | $! | |
7f211789 RS |
11 | $! Build the GNU "C" compiler on VMS |
12 | $! | |
13 | $! C compiler | |
14 | $! | |
15 | $ CC := gcc | |
16 | $! CC := cc !uncomment for VAXC | |
17 | $ BISON := bison | |
18 | $ RENAME := rename/new_vers | |
19 | $ LINK := link | |
20 | $! | |
21 | $! Compiler options | |
22 | $! | |
23 | $ CFLAGS = "/debug/cc1_options=""-mpcc-alignment""/incl=([],[.config])" | |
24 | $! CFLAGS = "/noopt/incl=([],[.config])" | |
25 | $! | |
26 | $! Link options | |
27 | $! | |
28 | $ LDFLAGS := /nomap | |
29 | $! | |
30 | $! Link libraries | |
31 | $! | |
32 | $ LIBS := gnu_cc:[000000]gcclib.olb/libr,sys$library:vaxcrtl.olb/libr | |
33 | $! LIBS := alloca.obj,sys$library:vaxcrtl.olb/libr | |
34 | $! | |
0ab45e0a RS |
35 | $! |
36 | $! First we figure out what needs to be done. This is sort of like a limited | |
37 | $! make facility - the command line options specify exactly what components | |
38 | $! we want to build. The following options are understood: | |
39 | $! | |
40 | $! LINK: Assume that the object modules for the selected compiler(s) | |
41 | $! have already been compiled, perform link phase only. | |
42 | $! | |
43 | $! CC1: Compile and link "C" compiler. | |
44 | $! | |
45 | $! CC1PLUS:Compile and link "C++" compiler. | |
46 | $! | |
47 | $! CC1OBJ: Compile and link objective C compiler. | |
48 | $! | |
49 | $! ALL: Compile and link all of the CC1 passes. | |
50 | $! | |
51 | $! INDEPENDENT: | |
52 | $! Compile language independent source modules. (On by default). | |
53 | $! | |
54 | $! DEBUG: Link images with /debug. | |
55 | $! | |
56 | $! If you want to list more than one option, you should use a spaces to | |
57 | $! separate them. | |
58 | $! | |
59 | $! Any one of the above options can be prefaced with a "NO". For example, | |
60 | $! if you had already built GCC, and you wanted to build G++, you could use the | |
61 | $! "CC1PLUS NOINDEPENDENT" options, which would only compile the C++ language | |
62 | $! specific source files, and then link the C++ compiler. | |
63 | $! | |
64 | $! If you do not specify which compiler you want to build, it is assumed that | |
65 | $! you want to build GNU-C ("CC1"). | |
66 | $! | |
7f211789 | 67 | $! Now figure out what we have been requested to do. |
0ab45e0a RS |
68 | $p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7 |
69 | $p1 = f$edit(p1,"COMPRESS") | |
70 | $i=0 | |
71 | $DO_ALL = 0 | |
72 | $DO_LINK = 0 | |
73 | $DO_DEBUG = 0 | |
7f211789 RS |
74 | $open cfile$ compilers.list |
75 | $cinit:read cfile$ compilername/end=cinit_done | |
76 | $DO_'compilername'=0 | |
77 | $goto cinit | |
78 | $cinit_done: close cfile$ | |
0ab45e0a RS |
79 | $DO_INDEPENDENT = 1 |
80 | $DO_DEFAULT = 1 | |
81 | $loop: | |
82 | $string = f$element(i," ",p1) | |
83 | $if string.eqs." " then goto done | |
84 | $flag = 1 | |
85 | $if string.eqs."CC1PLUS" then DO_DEFAULT = 0 | |
86 | $if string.eqs."CC1OBJ" then DO_DEFAULT = 0 | |
87 | $if f$extract(0,2,string).nes."NO" then goto parse_option | |
88 | $ string=f$extract(2,f$length(string)-2,string) | |
89 | $ flag = 0 | |
90 | $parse_option: | |
91 | $DO_'string' = flag | |
92 | $i=i+1 | |
93 | $goto loop | |
94 | $! | |
95 | $done: | |
96 | $if DO_DEFAULT.eq.1 then DO_CC1 = 1 | |
7f211789 RS |
97 | $echo := write sys$Output |
98 | $echo "This command file will now perform the following actions: | |
0ab45e0a | 99 | $if DO_LINK.eq.1 then goto link_only |
7f211789 RS |
100 | $if DO_ALL.eq.1 then echo " Compile all language specific object modules." |
101 | $if DO_CC1.eq.1 then echo " Compile C specific object modules." | |
102 | $if DO_CC1PLUS.eq.1 then echo " Compile C++ specific object modules." | |
103 | $if DO_CC1OBJ.eq.1 then echo " Compile obj-C specific object modules." | |
104 | $if DO_INDEPENDENT.eq.1 then echo " Compile language independent object modules." | |
0ab45e0a | 105 | $link_only: |
7f211789 RS |
106 | $if DO_CC1.eq.1 then echo " Link C compiler (gcc-cc1.exe)." |
107 | $if DO_CC1PLUS.eq.1 then echo " Link C++ compiler (gcc-cc1plus.exe)." | |
108 | $if DO_CC1OBJ.eq.1 then echo " Link objective-C compiler (gcc-cc1obj.exe)." | |
109 | $if DO_DEBUG.eq.1 then echo " Link images to run under debugger." | |
110 | $! | |
111 | $! Test and see if we need these messages or not. The -1 switch gives it away. | |
112 | $! | |
113 | $gas := $gnu_cc:[000000]gcc-as.exe | |
114 | $if f$search(gas-"$").eqs."" then goto gas_message !must be VAXC | |
115 | $define/user sys$error sys$scratch:gas_test.tmp | |
116 | $gas -1 nla0: -o nla0: | |
117 | $size=f$file_attributes("sys$scratch:gas_test.tmp","ALQ") | |
118 | $delete/nolog sys$scratch:gas_test.tmp;* | |
119 | $if size.eq.0 then goto no_message | |
120 | $gas_message: | |
0ab45e0a RS |
121 | $type sys$input |
122 | ||
123 | Note: GCC 2.0 treats external variables differently than GCC 1.40 does. | |
124 | Before you use GCC 2.0, you should obtain a version of the assembler which | |
125 | contains the patches to work with GCC 2.0 (GCC-AS 1.38 does not contain | |
7f211789 RS |
126 | these patches - whatever comes after this probably will). The assembler |
127 | in gcc-vms-1.40.tar.Z from prep does contain the proper patches. | |
0ab45e0a RS |
128 | |
129 | If you do not update the assembler, the compiler will still work, | |
130 | but `extern const' variables will be treated as `extern'. This will result | |
131 | in linker warning messages about mismatched psect attributes, and these | |
132 | variables will be placed in read/write storage. | |
133 | ||
134 | $! | |
7f211789 | 135 | $no_message: |
0ab45e0a RS |
136 | $! |
137 | $! | |
7f211789 | 138 | $ if DO_DEBUG.eq.1 then LDFLAGS :='LDFLAGS'/debug |
0ab45e0a | 139 | $! |
7f211789 RS |
140 | $if DO_LINK.eq.1 then goto compile_cc1 |
141 | $if DO_INDEPENDENT.eq.1 | |
142 | $ THEN | |
0ab45e0a | 143 | $! |
7f211789 | 144 | $! Build alloca if necessary (in 'LIBS for use with VAXC) |
0ab45e0a | 145 | $! |
7f211789 RS |
146 | $ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).ge.f$length(LIBS) then - |
147 | goto skip_alloca | |
148 | $ if f$search("alloca.obj").nes."" then - !does .obj exist? is it up to date? | |
149 | if f$cvtime(f$file_attributes("alloca.obj","RDT")).gts.- | |
150 | f$cvtime(f$file_attributes("alloca.c","RDT")) then goto skip_alloca | |
151 | $set verify | |
152 | $ 'CC 'CFLAGS /define="STACK_DIRECTION=(-1)" alloca.c | |
153 | $!'f$verify(0) | |
154 | $skip_alloca: | |
0ab45e0a | 155 | $! |
7f211789 RS |
156 | $! First build a couple of header files from the machine description |
157 | $! These are used by many of the source modules, so we build them now. | |
0ab45e0a | 158 | $! |
7f211789 RS |
159 | $set verify |
160 | $ 'CC 'CFLAGS rtl.C | |
161 | $ 'CC 'CFLAGS obstack.C | |
162 | $!'f$verify(0) | |
163 | $! Generate insn-attr.h | |
164 | $ call generate insn-attr.h | |
165 | $ call generate insn-flags.h | |
166 | $ call generate insn-codes.h | |
167 | $ call generate insn-config.h | |
0ab45e0a | 168 | $! |
7f211789 | 169 | $call compile independent.opt "rtl,obstack,insn-attrtab" |
0ab45e0a | 170 | $! |
7f211789 RS |
171 | $ call generate insn-attrtab.c "rtlanal," |
172 | $set verify | |
173 | $ 'CC 'CFLAGS insn-attrtab.c | |
174 | $!'f$verify(0) | |
175 | $ endif | |
0ab45e0a | 176 | $! |
7f211789 RS |
177 | $compile_cc1: |
178 | $open cfile$ compilers.list | |
179 | $cloop:read cfile$ compilername/end=cdone | |
180 | $! language specific modules | |
0ab45e0a | 181 | $! |
7f211789 RS |
182 | $if (DO_ALL + DO_'compilername').eq.0 then goto cloop |
183 | $if DO_LINK.eq.0 then call compile 'compilername'-objs.opt "obstack" | |
0ab45e0a | 184 | $! |
7f211789 RS |
185 | $! CAUTION: If you want to link gcc-cc1* to the sharable image library |
186 | $! VAXCRTL, see the notes in gcc.texinfo (or INSTALL) first. | |
0ab45e0a | 187 | $! |
7f211789 RS |
188 | $set verify |
189 | $ link 'LDFLAGS' /exe=gcc-'compilername' version.opt/opt, - | |
190 | 'compilername'-objs.opt/opt, independent.opt/opt, - | |
191 | 'LIBS' | |
192 | $!'f$verify(0) | |
193 | $goto cloop | |
0ab45e0a | 194 | $! |
0ab45e0a | 195 | $! |
7f211789 | 196 | $cdone: close cfile$ |
0ab45e0a | 197 | $! |
7f211789 | 198 | $! Done |
0ab45e0a | 199 | $! |
7f211789 RS |
200 | $! 'f$verify(v) |
201 | $exit | |
0ab45e0a | 202 | $! |
7f211789 | 203 | $! Various DCL subroutines follow... |
0ab45e0a | 204 | $! |
7f211789 RS |
205 | $! This routine takes parameter p1 to be a linker options file with a list |
206 | $! of object files that are needed. It extracts the names, and compiles | |
207 | $! each source module, one by one. File names that begin with an | |
208 | $! "INSN-" are assumed to be generated by a GEN*.C program. | |
0ab45e0a | 209 | $! |
7f211789 RS |
210 | $! Parameter P2 is a list of files which will appear in the options file |
211 | $! that should not be compiled. This allows us to handle special cases. | |
0ab45e0a | 212 | $! |
7f211789 RS |
213 | $compile: |
214 | $subroutine | |
215 | $open ifile$ 'p1' | |
216 | $loop: read ifile$ line/end=c_done | |
0ab45e0a | 217 | $! |
7f211789 RS |
218 | $i=0 |
219 | $loop1: | |
220 | $flnm=f$element(i,",",line) | |
221 | $i=i+1 | |
222 | $if flnm.eqs."" then goto loop | |
223 | $if flnm.eqs."," then goto loop | |
224 | $if f$locate(flnm,"''p2'").nes.f$length("''p2'") then goto loop1 | |
225 | $! | |
226 | $if f$locate("-parse",flnm).nes.f$length(flnm) | |
227 | $ then | |
228 | $ if (f$search("''flnm'.C") .eqs. "") then goto yes_bison | |
229 | $ if (f$cvtime(f$file_attributes("''flnm'.Y","RDT")).les. - | |
230 | f$cvtime(f$file_attributes("''flnm'.C","RDT"))) - | |
231 | then goto no_bison | |
232 | $yes_bison: | |
233 | $set verify | |
234 | $ 'BISON' /define /verbose 'flnm'.y | |
235 | $ 'RENAME' 'flnm'_tab.c 'flnm'.c | |
236 | $ 'RENAME' 'flnm'_tab.h 'flnm'.h | |
237 | $!'f$verify(0) | |
238 | $no_bison: | |
239 | $ endif | |
240 | $! | |
241 | $if f$extract(0,5,flnm).eqs."insn-" then call generate 'flnm'.c | |
242 | $! | |
243 | $set verify | |
244 | $ 'CC 'CFLAGS 'flnm'.c | |
245 | $!'f$verify(0) | |
246 | $goto loop1 | |
0ab45e0a | 247 | $! |
7f211789 RS |
248 | $goto loop |
249 | $c_done: | |
250 | $close ifile$ | |
251 | $endsubroutine | |
252 | $! | |
253 | $! This subroutine generates the insn-* files. The first argument is the | |
254 | $! name of the insn-* file to generate. The second argument contains a | |
255 | $! list of any other object modules which must be linked to the gen*.c | |
256 | $! program. | |
257 | $! | |
258 | $! If a previous version of insn-* exists, it is compared to the new one, | |
259 | $! and if it has not changed, then the new one is discarded. This is | |
260 | $! done so that make like programs do not get thrown off. | |
261 | $! | |
262 | $generate: | |
263 | $subroutine | |
264 | $if f$extract(0,5,p1).nes."INSN-" | |
265 | $ then | |
266 | $ write sys$error "Unknown file passed to generate." | |
267 | $ exit 1 | |
268 | $ endif | |
269 | $root1=f$parse(f$extract(5,255,p1),,,"NAME") | |
270 | $ set verify | |
271 | $ 'CC 'CFLAGS GEN'root1'.C | |
272 | $ link 'LDFLAGS' GEN'root1',rtl,obstack,'p2' - | |
273 | 'LIBS' | |
274 | $! 'f$verify(0) | |
275 | $! | |
276 | $set verify | |
277 | $ assign/user 'p1' sys$output: | |
278 | $ mcr sys$disk:[]GEN'root1' md | |
279 | $!'f$verify(0) | |
280 | $endsubroutine |