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