]> gcc.gnu.org Git - gcc.git/blame - gcc/make-cc1.com
45th Cygnus<->FSF merge
[gcc.git] / gcc / make-cc1.com
CommitLineData
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 5$ v=f$verify(0)
0ab45e0a
RS
6$!
7$! CAUTION: If you want to link gcc-cc1 to the sharable image library
8$! VAXCRTL, see the notes in gcc.texinfo (or INSTALL) first.
9$!
7f211789
RS
10$! Build the GNU "C" compiler on VMS
11$!
af708691
RS
12$! Note: to build with DEC's VAX C compiler, uncomment the 2nd CC, CFLAGS,
13$! and LIBS alternatives, and also execute the following command:
14$! DEFINE SYS SYS$LIBRARY:
15$! After a successful build, restore those items and rebuild with gcc.
16$
7f211789
RS
17$! C compiler
18$!
63468c37
RK
19$ CC = "gcc"
20$! CC = "cc" !uncomment for VAXC
21$ BISON = "bison"
22$ BISON_FLAGS= "/Define/Verbose"
23$ RENAME= "rename/New_Version"
24$ LINK = "link"
25$ EDIT = "edit"
26$ SEARCH= "search"
27$ echo = "write sys$output"
7f211789
RS
28$!
29$! Compiler options
30$!
63468c37 31$ CFLAGS = "/Debug/noVerbos/CC1=""-mpcc-alignment"""
6baa89b5
RK
32$! CFLAGS = "/noOpt" !uncomment for VAXC
33$ CINCL1 = "/Incl=[]" !stage 1 -I flags
34$ CINCL2 = "/Incl=([],[.ginclude])" !stage 2,3,... flags
1ca0c604 35$ CINCL_SUB = "/Incl=([],[-],[-.ginclude])" ![.cp] flags
7f211789
RS
36$!
37$! Link options
38$!
63468c37 39$ LDFLAGS = "/noMap"
7f211789
RS
40$!
41$! Link libraries
42$!
63468c37
RK
43$ LIBS = "gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr"
44$! LIBS = "alloca.obj,sys$library:vaxcrtl.olb/Libr" !uncomment for VAXC
45$
46$!!!!!!!
47$! Nothing beyond this point should need any local configuration changes.
48$!!!!!!!
49$
0ab45e0a
RS
50$!
51$! First we figure out what needs to be done. This is sort of like a limited
52$! make facility - the command line options specify exactly what components
53$! we want to build. The following options are understood:
54$!
55$! LINK: Assume that the object modules for the selected compiler(s)
56$! have already been compiled, perform link phase only.
57$!
58$! CC1: Compile and link "C" compiler.
59$!
60$! CC1PLUS:Compile and link "C++" compiler.
61$!
62$! CC1OBJ: Compile and link objective C compiler.
63$!
64$! ALL: Compile and link all of the CC1 passes.
65$!
66$! INDEPENDENT:
67$! Compile language independent source modules. (On by default).
68$!
1a78c101
RS
69$! BC:
70$! Compile byte compiler source modules. (On by default).
71$!
0ab45e0a
RS
72$! DEBUG: Link images with /debug.
73$!
74$! If you want to list more than one option, you should use a spaces to
75$! separate them.
76$!
77$! Any one of the above options can be prefaced with a "NO". For example,
78$! if you had already built GCC, and you wanted to build G++, you could use the
79$! "CC1PLUS NOINDEPENDENT" options, which would only compile the C++ language
80$! specific source files, and then link the C++ compiler.
81$!
82$! If you do not specify which compiler you want to build, it is assumed that
83$! you want to build GNU-C ("CC1").
84$!
7f211789 85$! Now figure out what we have been requested to do.
0ab45e0a
RS
86$p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7
87$p1 = f$edit(p1,"COMPRESS")
88$i=0
89$DO_ALL = 0
90$DO_LINK = 0
91$DO_DEBUG = 0
6baa89b5 92$DO_CC1PLUS = 0
1ca0c604 93$if f$trnlnm("cfile$").nes."" then close/noLog cfile$
7f211789
RS
94$open cfile$ compilers.list
95$cinit:read cfile$ compilername/end=cinit_done
96$DO_'compilername'=0
97$goto cinit
98$cinit_done: close cfile$
0ab45e0a
RS
99$DO_INDEPENDENT = 1
100$DO_DEFAULT = 1
1a78c101 101$DO_BC = 1
0ab45e0a
RS
102$loop:
103$string = f$element(i," ",p1)
104$if string.eqs." " then goto done
105$flag = 1
106$if string.eqs."CC1PLUS" then DO_DEFAULT = 0
107$if string.eqs."CC1OBJ" then DO_DEFAULT = 0
108$if f$extract(0,2,string).nes."NO" then goto parse_option
109$ string=f$extract(2,f$length(string)-2,string)
110$ flag = 0
111$parse_option:
112$DO_'string' = flag
113$i=i+1
114$goto loop
115$!
116$done:
117$if DO_DEFAULT.eq.1 then DO_CC1 = 1
7f211789 118$echo "This command file will now perform the following actions:
0ab45e0a 119$if DO_LINK.eq.1 then goto link_only
7f211789
RS
120$if DO_ALL.eq.1 then echo " Compile all language specific object modules."
121$if DO_CC1.eq.1 then echo " Compile C specific object modules."
122$if DO_CC1PLUS.eq.1 then echo " Compile C++ specific object modules."
123$if DO_CC1OBJ.eq.1 then echo " Compile obj-C specific object modules."
124$if DO_INDEPENDENT.eq.1 then echo " Compile language independent object modules."
1a78c101 125$if DO_BC.eq.1 then echo " Compile byte compiler object modules."
0ab45e0a 126$link_only:
7f211789
RS
127$if DO_CC1.eq.1 then echo " Link C compiler (gcc-cc1.exe)."
128$if DO_CC1PLUS.eq.1 then echo " Link C++ compiler (gcc-cc1plus.exe)."
129$if DO_CC1OBJ.eq.1 then echo " Link objective-C compiler (gcc-cc1obj.exe)."
130$if DO_DEBUG.eq.1 then echo " Link images to run under debugger."
131$!
6baa89b5
RK
132$! Update CFLAGS with appropriate CINCLx value.
133$!
134$if f$edit(f$extract(0,3,CC),"LOWERCASE").nes."gcc" then goto stage1
135$if f$search("gcc-cc1.exe").eqs."" then goto stage1
136$if f$file_attr("gnu_cc:[000000]gcc-cc1.exe","FID").nes.-
137 f$file_attr("gcc-cc1.exe","FID") then goto stage1
138$ CFLAGS = CFLAGS + CINCL2
139$ goto cinclX
140$stage1:
141$ CFLAGS = CFLAGS + CINCL1
142$cinclX:
143$!
7f211789
RS
144$! Test and see if we need these messages or not. The -1 switch gives it away.
145$!
146$gas := $gnu_cc:[000000]gcc-as.exe
147$if f$search(gas-"$").eqs."" then goto gas_message !must be VAXC
148$define/user sys$error sys$scratch:gas_test.tmp
149$gas -1 nla0: -o nla0:
150$size=f$file_attributes("sys$scratch:gas_test.tmp","ALQ")
151$delete/nolog sys$scratch:gas_test.tmp;*
152$if size.eq.0 then goto no_message
153$gas_message:
0ab45e0a
RS
154$type sys$input
155
1ca0c604
RK
156 Note: GCC 2.x treats external variables differently than GCC 1.x does.
157Before you use GCC 2.x, you should obtain a version of the assembler which
158contains the patches to work with GCC 2.x (GCC-AS 1.38 does not contain
7f211789 159these patches - whatever comes after this probably will). The assembler
1ca0c604 160in gcc-vms-1.42.tar.gz from prep does contain the proper patches.
0ab45e0a
RS
161
162 If you do not update the assembler, the compiler will still work,
163but `extern const' variables will be treated as `extern'. This will result
164in linker warning messages about mismatched psect attributes, and these
165variables will be placed in read/write storage.
166
167$!
7f211789 168$no_message:
0ab45e0a
RS
169$!
170$!
1ca0c604 171$ if DO_DEBUG.eq.1 then LDFLAGS = LDFLAGS + "/Debug"
0ab45e0a 172$!
7f211789 173$if DO_LINK.eq.1 then goto compile_cc1
1a78c101 174$!
02490c73
RS
175$! Build alloca if necessary (in 'LIBS for use with VAXC)
176$!
177$ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).ge.f$length(LIBS) then -
178 goto skip_alloca
179$ if f$search("alloca.obj").nes."" then - !does .obj exist? is it up to date?
180 if f$cvtime(f$file_attributes("alloca.obj","RDT")).gts.-
181 f$cvtime(f$file_attributes("alloca.c","RDT")) then goto skip_alloca
182$set verify
63468c37 183$ 'CC''CFLAGS'/Define="STACK_DIRECTION=(-1)" alloca.c
02490c73
RS
184$!'f$verify(0)
185$skip_alloca:
186$!
1a78c101
RS
187$if DO_BC.eq.1
188$ THEN
189$ call compile bi_all.opt ""
190$ open ifile$ bc_all.opt
191$ read ifile$ bc_line
192$ close ifile$
193$ bc_index = 0
194$bc_loop:
195$ tfile = f$element(bc_index, " ", bc_line)
196$ if tfile.eqs." " then goto bc_done
197$ call bc_generate 'tfile' "bi_all.opt/opt,"
198$ bc_index = bc_index + 1
199$ goto bc_loop
200$bc_done:
201$ endif
202$!
203$!
7f211789
RS
204$if DO_INDEPENDENT.eq.1
205$ THEN
0ab45e0a 206$!
7f211789
RS
207$! First build a couple of header files from the machine description
208$! These are used by many of the source modules, so we build them now.
0ab45e0a 209$!
7f211789 210$set verify
1ca0c604
RK
211$ 'CC''CFLAGS' rtl.c
212$ 'CC''CFLAGS' obstack.c
7f211789
RS
213$!'f$verify(0)
214$! Generate insn-attr.h
215$ call generate insn-attr.h
216$ call generate insn-flags.h
217$ call generate insn-codes.h
218$ call generate insn-config.h
0ab45e0a 219$!
7f211789 220$call compile independent.opt "rtl,obstack,insn-attrtab"
0ab45e0a 221$!
63468c37 222$ call generate insn-attrtab.c "rtlanal.obj,"
7f211789 223$set verify
63468c37 224$ 'CC''CFLAGS' insn-attrtab.c
1ca0c604
RK
225$ 'CC''CFLAGS' bc-emit.c
226$ 'CC''CFLAGS' bc-optab.c
7f211789
RS
227$!'f$verify(0)
228$ endif
0ab45e0a 229$!
7f211789 230$compile_cc1:
3d77b9c2 231$if (DO_CC1 + DO_CC1OBJ) .ne.0
2988e8a3 232$ then
2988e8a3
RS
233$if (f$search("C-PARSE.Y") .eqs. "") then goto yes_yfiles
234$if (f$cvtime(f$file_attributes("C-PARSE.IN","RDT")).gts. -
235 f$cvtime(f$file_attributes("C-PARSE.Y","RDT"))) -
236 then goto yes_yfiles
237$if (f$search("OBJC-PARSE.Y") .eqs. "") then goto yes_yfiles
238$if (f$cvtime(f$file_attributes("C-PARSE.IN","RDT")).gts. -
239 f$cvtime(f$file_attributes("OBJC-PARSE.Y","RDT"))) -
240 then goto yes_yfiles
241$GOTO no_yfiles
2988e8a3 242$yes_yfiles:
3d77b9c2 243$echo "Now processing c-parse.in to generate c-parse.y and objc-parse.y."
2988e8a3
RS
244$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input
245!
246! Read c-parse.in, write c-parse.y and objc-parse.y, depending on
247! paired lines of "ifc" & "end ifc" and "ifobjc" & "end ifobjc" to
248! control what goes into each file. Most lines will be common to
249! both (hence not bracketed by either control pair). Mismatched
250! pairs aren't detected--garbage in, garbage out...
251!
252
253 PROCEDURE do_output()
254 IF NOT objc_only THEN POSITION(END_OF(c)); COPY_TEXT(input_line); ENDIF;
255 IF NOT c_only THEN POSITION(END_OF(objc)); COPY_TEXT(input_line); ENDIF;
256 POSITION(input_file); !reset
257 ENDPROCEDURE;
258
259 input_file := CREATE_BUFFER("input", "c-parse.in"); !load data
260 SET(NO_WRITE, input_file);
261 c := CREATE_BUFFER("c_output"); !1st output file
262 objc := CREATE_BUFFER("objc_output"); !2nd output file
263
264 POSITION(BEGINNING_OF(input_file));
265 c_only := 0;
266 objc_only := 0;
267
268 LOOP
269 EXITIF MARK(NONE) = END_OF(input_file); !are we done yet?
270
271 input_line := CURRENT_LINE; !access current_line just once
272 CASE EDIT(input_line, TRIM_TRAILING, OFF, NOT_IN_PLACE)
273 ["ifc"] : c_only := 1;
274 ["end ifc"] : c_only := 0;
275 ["ifobjc"] : objc_only := 1;
276 ["end ifobjc"] : objc_only := 0;
277! default -- add non-control line to either or both output files
278 [INRANGE] : do_output(); !between "end" and "if"
279 [OUTRANGE] : do_output(); !before "end" or after "if"
280 ENDCASE;
281
282 MOVE_VERTICAL(1); !go to next line
283 ENDLOOP;
284
285 WRITE_FILE(c, "c-parse.y");
286 WRITE_FILE(objc, "objc-parse.y");
287 QUIT
288$ endif
289$no_yfiles:
290$!
7f211789
RS
291$open cfile$ compilers.list
292$cloop:read cfile$ compilername/end=cdone
293$! language specific modules
0ab45e0a 294$!
7f211789 295$if (DO_ALL + DO_'compilername').eq.0 then goto cloop
1ca0c604
RK
296$if DO_LINK.eq.0 then -
297 call compile 'compilername'-objs.opt "obstack,bc-emit,bc-optab"
0ab45e0a 298$!
7f211789
RS
299$! CAUTION: If you want to link gcc-cc1* to the sharable image library
300$! VAXCRTL, see the notes in gcc.texinfo (or INSTALL) first.
0ab45e0a 301$!
7f211789 302$set verify
63468c37
RK
303$ 'LINK''LDFLAGS'/Exe=gcc-'compilername'.exe version.opt/Opt,-
304 'compilername'-objs.opt/Opt,independent.opt/Opt,-
7f211789
RS
305 'LIBS'
306$!'f$verify(0)
307$goto cloop
0ab45e0a 308$!
0ab45e0a 309$!
7f211789 310$cdone: close cfile$
0ab45e0a 311$!
7f211789 312$! Done
0ab45e0a 313$!
7f211789
RS
314$! 'f$verify(v)
315$exit
0ab45e0a 316$!
7f211789 317$! Various DCL subroutines follow...
0ab45e0a 318$!
7f211789
RS
319$! This routine takes parameter p1 to be a linker options file with a list
320$! of object files that are needed. It extracts the names, and compiles
321$! each source module, one by one. File names that begin with an
322$! "INSN-" are assumed to be generated by a GEN*.C program.
0ab45e0a 323$!
7f211789
RS
324$! Parameter P2 is a list of files which will appear in the options file
325$! that should not be compiled. This allows us to handle special cases.
0ab45e0a 326$!
7f211789
RS
327$compile:
328$subroutine
5944b57e
CH
329$on error then goto c_err
330$on control_y then goto c_err
7f211789
RS
331$open ifile$ 'p1'
332$loop: read ifile$ line/end=c_done
0ab45e0a 333$!
7f211789
RS
334$i=0
335$loop1:
336$flnm=f$element(i,",",line)
337$i=i+1
338$if flnm.eqs."" then goto loop
339$if flnm.eqs."," then goto loop
1ca0c604
RK
340$if f$locate(flnm,p2).lt.f$length(p2) then goto loop1
341$! check for front-end subdirectory: "[.prfx]flnm"
342$prfx = ""
343$k = f$locate("]",flnm)
344$if k.eq.1 then goto loop1 ![]c-common for [.cp]
345$if k.lt.f$length(flnm) then prfx = f$extract(2,k-2,flnm)
346$if k.lt.f$length(flnm) then flnm = f$extract(k+1,99,flnm)
347$ if prfx.nes.""
348$ then set default [.'prfx'] !push
349$ save_cflags = CFLAGS
350$ CFLAGS = CFLAGS - CINCL1 - CINCL2 + CINCL_SUB
351$ endif
352$!
353$if f$locate("parse",flnm).nes.f$length(flnm)
7f211789
RS
354$ then
355$ if (f$search("''flnm'.C") .eqs. "") then goto yes_bison
356$ if (f$cvtime(f$file_attributes("''flnm'.Y","RDT")).les. -
357 f$cvtime(f$file_attributes("''flnm'.C","RDT"))) -
358 then goto no_bison
359$yes_bison:
360$set verify
63468c37 361$ 'BISON''BISON_FLAGS' 'flnm'.y
7f211789
RS
362$ 'RENAME' 'flnm'_tab.c 'flnm'.c
363$ 'RENAME' 'flnm'_tab.h 'flnm'.h
364$!'f$verify(0)
1ca0c604 365$ if flnm.eqs."cp-parse" .or. (prfx.eqs."cp" .and. flnm.eqs."parse")
63468c37 366$ then ! fgrep '#define YYEMPTY' cp-parse.c >>cp-parse.h
1ca0c604
RK
367$ open/Append jfile$ 'flnm'.h
368$ 'SEARCH'/Exact/Output=jfile$ 'flnm'.c "#define YYEMPTY"
63468c37
RK
369$ close jfile$
370$ endif
7f211789 371$no_bison:
6baa89b5 372$ echo " (Ignore any warning about not finding file ""bison.simple"".)"
7f211789
RS
373$ endif
374$!
375$if f$extract(0,5,flnm).eqs."insn-" then call generate 'flnm'.c
376$!
377$set verify
63468c37 378$ 'CC''CFLAGS' 'flnm'.c
7f211789 379$!'f$verify(0)
1ca0c604
RK
380$ if prfx.nes.""
381$ then set default [-] !pop
382$ CFLAGS = save_CFLAGS
383$ endif
384$
7f211789 385$goto loop1
0ab45e0a 386$!
5944b57e
CH
387$!
388$! In case of error or abort, go here (In order to close file).
389$!
390$c_err: !'f$verify(0)
391$close ifile$
392$exit %x2c
393$!
7f211789
RS
394$c_done:
395$close ifile$
396$endsubroutine
397$!
398$! This subroutine generates the insn-* files. The first argument is the
399$! name of the insn-* file to generate. The second argument contains a
400$! list of any other object modules which must be linked to the gen*.c
401$! program.
402$!
7f211789
RS
403$generate:
404$subroutine
405$if f$extract(0,5,p1).nes."INSN-"
406$ then
407$ write sys$error "Unknown file passed to generate."
408$ exit 1
409$ endif
410$root1=f$parse(f$extract(5,255,p1),,,"NAME")
411$ set verify
63468c37
RK
412$ 'CC''CFLAGS' GEN'root1'.C
413$ 'LINK''LDFLAGS' GEN'root1'.OBJ,rtl.obj,obstack.obj,'p2' -
7f211789
RS
414 'LIBS'
415$! 'f$verify(0)
416$!
417$set verify
418$ assign/user 'p1' sys$output:
419$ mcr sys$disk:[]GEN'root1' md
420$!'f$verify(0)
421$endsubroutine
1a78c101
RS
422$!
423$! This subroutine generates the bc-* files. The first argument is the
424$! name of the bc-* file to generate. The second argument contains a
02490c73 425$! list of any other object modules which must be linked to the bi*.c
1a78c101
RS
426$! program.
427$!
1a78c101
RS
428$bc_generate:
429$subroutine
430$if f$extract(0,3,p1).nes."BC-"
431$ then
432$ write sys$error "Unknown file passed to generate."
433$ exit 1
434$ endif
435$root1=f$parse(f$extract(3,255,p1),,,"NAME")
436$ set verify
63468c37
RK
437$ 'CC''CFLAGS' BI-'root1'.C
438$ 'LINK''LDFLAGS' BI-'root1'.OBJ,'p2' -
1a78c101
RS
439 'LIBS'
440$! 'f$verify(0)
441$!
442$set verify
443$ assign/user bytecode.def sys$input:
444$ assign/user 'p1' sys$output:
445$ mcr sys$disk:[]BI-'root1'
446$!'f$verify(0)
447$endsubroutine
This page took 0.324449 seconds and 5 git commands to generate.