|
|
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: $!
! 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: $!
1.1 root 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: $!
1.1.1.3 ! root 67: $! Now figure out what we have been requested to do.
1.1 root 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
1.1.1.3 ! root 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$
1.1 root 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
1.1.1.3 ! root 97: $echo := write sys$Output
! 98: $echo "This command file will now perform the following actions:
1.1 root 99: $if DO_LINK.eq.1 then goto link_only
1.1.1.3 ! root 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."
1.1 root 105: $link_only:
1.1.1.3 ! root 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:
1.1 root 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
1.1.1.3 ! root 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.
1.1 root 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: $!
1.1.1.3 ! root 135: $no_message:
1.1 root 136: $!
137: $!
138: $ if DO_DEBUG.eq.1 then LDFLAGS :='LDFLAGS'/debug
139: $!
1.1.1.3 ! root 140: $if DO_LINK.eq.1 then goto compile_cc1
! 141: $if DO_INDEPENDENT.eq.1
! 142: $ THEN
! 143: $!
! 144: $! Build alloca if necessary (in 'LIBS for use with VAXC)
! 145: $!
! 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:
1.1 root 155: $!
1.1.1.3 ! root 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.
1.1 root 158: $!
1.1.1.3 ! root 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
! 168: $!
! 169: $call compile independent.opt "rtl,obstack,insn-attrtab"
! 170: $!
! 171: $ call generate insn-attrtab.c "rtlanal,"
! 172: $set verify
! 173: $ 'CC 'CFLAGS insn-attrtab.c
! 174: $!'f$verify(0)
! 175: $ endif
1.1 root 176: $!
1.1.1.3 ! root 177: $compile_cc1:
! 178: $open cfile$ compilers.list
! 179: $cloop:read cfile$ compilername/end=cdone
! 180: $! language specific modules
1.1 root 181: $!
1.1.1.3 ! root 182: $if (DO_ALL + DO_'compilername').eq.0 then goto cloop
! 183: $if DO_LINK.eq.0 then call compile 'compilername'-objs.opt "obstack"
1.1 root 184: $!
1.1.1.3 ! root 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.
1.1 root 187: $!
1.1.1.3 ! root 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
1.1 root 194: $!
195: $!
1.1.1.3 ! root 196: $cdone: close cfile$
1.1 root 197: $!
1.1.1.3 ! root 198: $! Done
1.1 root 199: $!
1.1.1.3 ! root 200: $! 'f$verify(v)
! 201: $exit
1.1 root 202: $!
1.1.1.3 ! root 203: $! Various DCL subroutines follow...
1.1 root 204: $!
1.1.1.3 ! root 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.
! 209: $!
! 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.
! 212: $!
! 213: $compile:
! 214: $subroutine
! 215: $on error then goto c_err
! 216: $on control_y then goto c_err
! 217: $open ifile$ 'p1'
! 218: $loop: read ifile$ line/end=c_done
1.1 root 219: $!
1.1.1.3 ! root 220: $i=0
! 221: $loop1:
! 222: $flnm=f$element(i,",",line)
! 223: $i=i+1
! 224: $if flnm.eqs."" then goto loop
! 225: $if flnm.eqs."," then goto loop
! 226: $if f$locate(flnm,"''p2'").nes.f$length("''p2'") then goto loop1
! 227: $!
! 228: $if f$locate("-parse",flnm).nes.f$length(flnm)
! 229: $ then
! 230: $ if (f$search("''flnm'.C") .eqs. "") then goto yes_bison
! 231: $ if (f$cvtime(f$file_attributes("''flnm'.Y","RDT")).les. -
! 232: f$cvtime(f$file_attributes("''flnm'.C","RDT"))) -
! 233: then goto no_bison
! 234: $yes_bison:
! 235: $set verify
! 236: $ 'BISON' /define /verbose 'flnm'.y
! 237: $ 'RENAME' 'flnm'_tab.c 'flnm'.c
! 238: $ 'RENAME' 'flnm'_tab.h 'flnm'.h
! 239: $!'f$verify(0)
! 240: $no_bison:
! 241: $ endif
! 242: $!
! 243: $if f$extract(0,5,flnm).eqs."insn-" then call generate 'flnm'.c
! 244: $!
! 245: $set verify
! 246: $ 'CC 'CFLAGS 'flnm'.c
! 247: $!'f$verify(0)
! 248: $goto loop1
1.1 root 249: $!
1.1.1.3 ! root 250: $goto loop
1.1 root 251: $!
1.1.1.3 ! root 252: $! In case of error or abort, go here (In order to close file).
1.1 root 253: $!
1.1.1.3 ! root 254: $c_err: !'f$verify(0)
! 255: $close ifile$
! 256: $exit %x2c
! 257: $!
! 258: $c_done:
! 259: $close ifile$
! 260: $endsubroutine
! 261: $!
! 262: $! This subroutine generates the insn-* files. The first argument is the
! 263: $! name of the insn-* file to generate. The second argument contains a
! 264: $! list of any other object modules which must be linked to the gen*.c
! 265: $! program.
! 266: $!
! 267: $! If a previous version of insn-* exists, it is compared to the new one,
! 268: $! and if it has not changed, then the new one is discarded. This is
! 269: $! done so that make like programs do not get thrown off.
! 270: $!
! 271: $generate:
! 272: $subroutine
! 273: $if f$extract(0,5,p1).nes."INSN-"
! 274: $ then
! 275: $ write sys$error "Unknown file passed to generate."
! 276: $ exit 1
! 277: $ endif
! 278: $root1=f$parse(f$extract(5,255,p1),,,"NAME")
! 279: $ set verify
! 280: $ 'CC 'CFLAGS GEN'root1'.C
! 281: $ link 'LDFLAGS' GEN'root1',rtl,obstack,'p2' -
! 282: 'LIBS'
! 283: $! 'f$verify(0)
! 284: $!
! 285: $set verify
! 286: $ assign/user 'p1' sys$output:
! 287: $ mcr sys$disk:[]GEN'root1' md
! 288: $!'f$verify(0)
! 289: $endsubroutine
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.