Annotation of gcc/make-cc1.com, revision 1.1.1.7

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)
1.1       root        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: $!
1.1.1.3   root       10: $!     Build the GNU "C" compiler on VMS
                     11: $!
1.1.1.4   root       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: $
1.1.1.3   root       17: $!     C compiler
                     18: $!
1.1.1.7 ! root       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"
1.1.1.3   root       28: $!
                     29: $!     Compiler options
                     30: $!
1.1.1.7 ! root       31: $ CFLAGS =     "/Debug/noVerbos/CC1=""-mpcc-alignment"""
        !            32: $! CFLAGS =    "/noOpt"                !uncomment for VAXC
        !            33: $ CINCL1 =     "/Incl=[]"                      !stage 1 -I flags
        !            34: $ CINCL2 =     "/Incl=([],[.ginclude])"        !stage 2,3,... flags
        !            35: $ CINCL_SUB =  "/Incl=([],[-],[-.ginclude])"   ![.cp] flags
1.1.1.3   root       36: $!
                     37: $!     Link options
                     38: $!
1.1.1.7 ! root       39: $ LDFLAGS =    "/noMap"
1.1.1.3   root       40: $!
                     41: $!     Link libraries
                     42: $!
1.1.1.7 ! root       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: $
1.1       root       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: $!
1.1.1.6   root       69: $!     BC:
                     70: $!             Compile byte compiler source modules. (On by default).
                     71: $!
1.1       root       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: $!
1.1.1.3   root       85: $! Now figure out what we have been requested to do.
1.1       root       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
1.1.1.7 ! root       92: $DO_CC1PLUS = 0
        !            93: $if f$trnlnm("cfile$").nes."" then  close/noLog cfile$
1.1.1.3   root       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$
1.1       root       99: $DO_INDEPENDENT = 1
                    100: $DO_DEFAULT = 1
1.1.1.6   root      101: $DO_BC = 1
1.1       root      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
1.1.1.3   root      118: $echo "This command file will now perform the following actions:
1.1       root      119: $if DO_LINK.eq.1 then goto link_only
1.1.1.3   root      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."
1.1.1.6   root      125: $if DO_BC.eq.1 then echo "   Compile byte compiler object modules."
1.1       root      126: $link_only:
1.1.1.3   root      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: $!
1.1.1.7 ! root      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: $!
1.1.1.3   root      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:
1.1       root      154: $type sys$input
                    155: 
1.1.1.7 ! root      156:        Note: GCC 2.x treats external variables differently than GCC 1.x does.
        !           157: Before you use GCC 2.x, you should obtain a version of the assembler which
        !           158: contains the patches to work with GCC 2.x (GCC-AS 1.38 does not contain
1.1.1.3   root      159: these patches - whatever comes after this probably will).  The assembler
1.1.1.7 ! root      160: in gcc-vms-1.42.tar.gz from prep does contain the proper patches.
1.1       root      161: 
                    162:        If you do not update the assembler, the compiler will still work,
                    163: but `extern const' variables will be treated as `extern'.  This will result
                    164: in linker warning messages about mismatched psect attributes, and these
                    165: variables will be placed in read/write storage.
                    166: 
                    167: $!
1.1.1.3   root      168: $no_message:
1.1       root      169: $!
                    170: $!
1.1.1.7 ! root      171: $ if DO_DEBUG.eq.1 then LDFLAGS = LDFLAGS + "/Debug"
1.1       root      172: $!
1.1.1.3   root      173: $if DO_LINK.eq.1 then goto compile_cc1
                    174: $!
                    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
1.1.1.7 ! root      183: $ 'CC''CFLAGS'/Define="STACK_DIRECTION=(-1)" alloca.c
1.1.1.3   root      184: $!'f$verify(0)
                    185: $skip_alloca:
1.1       root      186: $!
1.1.1.6   root      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: $!
                    204: $if DO_INDEPENDENT.eq.1 
                    205: $      THEN 
                    206: $!
1.1.1.3   root      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.
1.1       root      209: $!
1.1.1.3   root      210: $set verify
1.1.1.7 ! root      211: $ 'CC''CFLAGS' rtl.c
        !           212: $ 'CC''CFLAGS' obstack.c
1.1.1.3   root      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
                    219: $!
                    220: $call compile independent.opt "rtl,obstack,insn-attrtab"
                    221: $!
1.1.1.7 ! root      222: $      call generate insn-attrtab.c "rtlanal.obj,"
1.1.1.3   root      223: $set verify
1.1.1.7 ! root      224: $ 'CC''CFLAGS' insn-attrtab.c
        !           225: $ 'CC''CFLAGS' bc-emit.c
        !           226: $ 'CC''CFLAGS' bc-optab.c
1.1.1.3   root      227: $!'f$verify(0)
                    228: $      endif
1.1       root      229: $!
1.1.1.3   root      230: $compile_cc1:
1.1.1.4   root      231: $if (DO_CC1 + DO_CC1OBJ) .ne.0
                    232: $      then
                    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
                    242: $yes_yfiles:
                    243: $echo "Now processing c-parse.in to generate c-parse.y and objc-parse.y."
                    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: $!
1.1.1.3   root      291: $open cfile$ compilers.list
                    292: $cloop:read cfile$ compilername/end=cdone
                    293: $! language specific modules
1.1       root      294: $!
1.1.1.3   root      295: $if (DO_ALL + DO_'compilername').eq.0 then goto cloop
1.1.1.7 ! root      296: $if DO_LINK.eq.0 then -
        !           297:  call compile 'compilername'-objs.opt "obstack,bc-emit,bc-optab"
1.1       root      298: $!
1.1.1.3   root      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.
1.1       root      301: $!
1.1.1.3   root      302: $set verify
1.1.1.7 ! root      303: $ 'LINK''LDFLAGS'/Exe=gcc-'compilername'.exe  version.opt/Opt,-
        !           304:          'compilername'-objs.opt/Opt,independent.opt/Opt,-
1.1.1.3   root      305:          'LIBS'
                    306: $!'f$verify(0)
                    307: $goto cloop
1.1       root      308: $!
                    309: $!
1.1.1.3   root      310: $cdone: close cfile$
1.1       root      311: $!
1.1.1.3   root      312: $!     Done
1.1       root      313: $!
1.1.1.3   root      314: $! 'f$verify(v)
                    315: $exit
1.1       root      316: $!
1.1.1.3   root      317: $!  Various DCL subroutines follow...
1.1       root      318: $!
1.1.1.3   root      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.
                    323: $!
                    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.
                    326: $!
                    327: $compile:
                    328: $subroutine
                    329: $on error then goto c_err
                    330: $on control_y then goto c_err
                    331: $open ifile$ 'p1'
                    332: $loop: read ifile$ line/end=c_done
1.1       root      333: $!
1.1.1.3   root      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
1.1.1.7 ! root      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
1.1.1.3   root      352: $!
1.1.1.7 ! root      353: $if f$locate("parse",flnm).nes.f$length(flnm)
1.1.1.3   root      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
1.1.1.7 ! root      361: $       'BISON''BISON_FLAGS' 'flnm'.y
1.1.1.3   root      362: $       'RENAME' 'flnm'_tab.c 'flnm'.c
                    363: $       'RENAME' 'flnm'_tab.h 'flnm'.h
                    364: $!'f$verify(0)
1.1.1.7 ! root      365: $      if flnm.eqs."cp-parse" .or. (prfx.eqs."cp" .and. flnm.eqs."parse")
        !           366: $      then            ! fgrep '#define YYEMPTY' cp-parse.c >>cp-parse.h
        !           367: $              open/Append jfile$ 'flnm'.h
        !           368: $              'SEARCH'/Exact/Output=jfile$ 'flnm'.c "#define YYEMPTY"
        !           369: $              close jfile$
        !           370: $      endif
1.1.1.3   root      371: $no_bison:
1.1.1.7 ! root      372: $       echo " (Ignore any warning about not finding file ""bison.simple"".)"
1.1.1.3   root      373: $      endif
                    374: $!
                    375: $if f$extract(0,5,flnm).eqs."insn-" then call generate 'flnm'.c
                    376: $!
                    377: $set verify
1.1.1.7 ! root      378: $ 'CC''CFLAGS' 'flnm'.c
1.1.1.3   root      379: $!'f$verify(0)
1.1.1.7 ! root      380: $ if prfx.nes.""
        !           381: $ then set default [-]         !pop
        !           382: $      CFLAGS = save_CFLAGS
        !           383: $ endif
        !           384: $
1.1.1.3   root      385: $goto loop1
1.1       root      386: $!
                    387: $!
1.1.1.3   root      388: $! In case of error or abort, go here (In order to close file).
1.1       root      389: $!
1.1.1.3   root      390: $c_err: !'f$verify(0)
                    391: $close ifile$
                    392: $exit %x2c
                    393: $!
                    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: $!
                    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
1.1.1.7 ! root      412: $ 'CC''CFLAGS' GEN'root1'.C
        !           413: $ 'LINK''LDFLAGS' GEN'root1'.OBJ,rtl.obj,obstack.obj,'p2' -
1.1.1.3   root      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
1.1.1.6   root      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 
                    425: $! list of any other object modules which must be linked to the bi*.c
                    426: $! program.
                    427: $!
                    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
1.1.1.7 ! root      437: $ 'CC''CFLAGS' BI-'root1'.C
        !           438: $ 'LINK''LDFLAGS' BI-'root1'.OBJ,'p2' -
1.1.1.6   root      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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.