$!
$! Now figure out what we have been requested to do.
$p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7
-$p1 = f$edit(p1,"COMPRESS")
+$p1 = f$edit(p1,"COMPRESS,TRIM")
$i=0
$DO_ALL = 0
$DO_LINK = 0
$DO_DEBUG = 0
$DO_CC1PLUS = 0
+$DO_CC1OBJ = 0
+$DO_OBJCLIB = 0
$if f$trnlnm("cfile$").nes."" then close/noLog cfile$
$open cfile$ compilers.list
$cinit:read cfile$ compilername/end=cinit_done
$flag = 1
$if string.eqs."CC1PLUS" then DO_DEFAULT = 0
$if string.eqs."CC1OBJ" then DO_DEFAULT = 0
+$if string.eqs."OBJCLIB"
+$then DO_DEFAULT = 0
+$ DO_INDEPENDENT = DO_CC1OBJ
+$ DO_BC = DO_CC1OBJ
+$endif
$if f$extract(0,2,string).nes."NO" then goto parse_option
$ string=f$extract(2,f$length(string)-2,string)
$ flag = 0
$if DO_CC1OBJ.eq.1 then echo " Compile obj-C specific object modules."
$if DO_INDEPENDENT.eq.1 then echo " Compile language independent object modules."
$if DO_BC.eq.1 then echo " Compile byte compiler object modules."
+$if DO_OBJCLIB.eq.1 then echo " Create Objective-C run-time library."
$link_only:
$if DO_CC1.eq.1 then echo " Link C compiler (gcc-cc1.exe)."
$if DO_CC1PLUS.eq.1 then echo " Link C++ compiler (gcc-cc1plus.exe)."
$! Test and see if we need these messages or not. The -1 switch gives it away.
$!
$gas := $gnu_cc:[000000]gcc-as.exe
-$if f$search(gas-"$").eqs."" then goto gas_message !must be VAXC
+$if f$search(gas-"$").eqs."" then goto gas_missing_message !must be VAXC
$define/user sys$error sys$scratch:gas_test.tmp
$gas -1 nla0: -o nla0:
$size=f$file_attributes("sys$scratch:gas_test.tmp","ALQ")
$delete/nolog sys$scratch:gas_test.tmp;*
-$if size.eq.0 then goto no_message
-$gas_message:
-$type sys$input
+$if size.eq.0 then goto skip_gas_message
+$type sys$input: !an old version of gas was found
- Note: GCC 2.x treats external variables differently than GCC 1.x does.
-Before you use GCC 2.x, you should obtain a version of the assembler which
-contains the patches to work with GCC 2.x (GCC-AS 1.38 does not contain
-these patches - whatever comes after this probably will). The assembler
-in gcc-vms-1.42.tar.gz from prep does contain the proper patches.
+-----
+ Note: you appear to have an old version of gas, the GNU assembler.
+GCC 2.x treats external variables differently than GCC 1.x does. Before
+you use GCC 2.x, you should obtain a version of the assembler which works
+with GCC 2.x (gas-1.38 and earlier did not have the necessary support;
+gas-2.0 through gas-2.3 did not work reliably for vax/vms configuration).
+The assembler in gcc-vms-1.42 contained patches to provide the proper
+support, and more recent versions have an up to date version of gas which
+provides the support. gas from binutils-2.5 or later is recommended.
- If you do not update the assembler, the compiler will still work,
+ If you do not update the assembler, the compiler will still work,
but `extern const' variables will be treated as `extern'. This will result
in linker warning messages about mismatched psect attributes, and these
variables will be placed in read/write storage.
+-----
-$!
-$no_message:
+$goto skip_gas_message
+$gas_missing_message:
+$type sys$input: !no version of gas was found
+
+-----
+ Note: you appear to be missing gas, the GNU assembler. Since
+GCC produces assembly code as output from compilation, you need the
+assembler to make full use of the compiler. It should be put in place
+as GNU_CC:[000000]GCC-AS.EXE.
+
+ A prebuilt copy of gas is available from the "gcc-vms" distribution,
+and the gas source code is included in the GNU "binutils" distribution.
+Version 2.5.2 or later is recommended.
+-----
+
+$skip_gas_message:
$!
$!
$ if DO_DEBUG.eq.1 then LDFLAGS = LDFLAGS + "/Debug"
$!
-$if DO_LINK.eq.1 then goto compile_cc1
+$if DO_LINK.eq.1 then goto no_yfiles !compile_cc1
$!
$! Build alloca if necessary (in 'LIBS for use with VAXC)
$!
$if DO_BC.eq.1
$ THEN
$ call compile bi_all.opt ""
-$ open ifile$ bc_all.opt
+$ if f$trnlnm("ifile$").nes."" then close/noLog ifile$
+$ open ifile$ bc_all.list
$ read ifile$ bc_line
$ close ifile$
$ bc_index = 0
$bc_loop:
$ tfile = f$element(bc_index, ",", bc_line)
$ if tfile.eqs."," then goto bc_done
-$ if f$locate(".",tfile).eq.f$length(tfile) then tfile = tfile + ".h"
$ call bc_generate 'tfile' "bi_all.opt/opt,"
$ bc_index = bc_index + 1
$ goto bc_loop
$!
$cdone: close cfile$
$!
+$ if DO_OBJCLIB
+$ then set default [.objc] !push
+$ save_cflags = CFLAGS
+$ CFLAGS = CFLAGS - CINCL1 - CINCL2 + CINCL_SUB
+$ MFLAGS = "/Lang=ObjC" + CFLAGS
+$ library/Obj [-]objclib.olb/Create
+$ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$
+$ open/Read ifile$ [-]objc-objs.opt
+$ocl1: read/End=ocl3 ifile$ line
+$ i = 0
+$ocl2: o = f$element(i,",",line)
+$ if o.eqs."," then goto ocl1
+$ n = o - ".o"
+$ if f$search(n + ".m").nes.""
+$ then f = n + ".m"
+$ flags = MFLAGS
+$ else f = n + ".c"
+$ flags = CFLAGS
+$ endif
+$ set verify
+$ 'CC' 'flags' 'f'
+$!'f$verify(0)'
+$ library/Obj [-]objclib.olb 'n'.obj/Insert
+$ delete/noConfirm/noLog 'n'.obj;*
+$ i = i + 1
+$ goto ocl2
+$ocl3: close ifile$
+$ CFLAGS = save_cflags
+$ set default [-] !pop
+$ endif !DO_OBJCLIB
+$!
$! Done
$!
$! 'f$verify(v)
$!
$set verify
$ assign/user 'p1' sys$output:
-$ mcr sys$disk:[]GEN'root1' md
+$ mcr sys$disk:[]GEN'root1' vax.md
$!'f$verify(0)
$endsubroutine
$!