home *** CD-ROM | disk | FTP | other *** search
- $ Verifying:= 'f$verify(0)'
- $ if "''gcc_debugging'".eqs."" then gcc_debugging = 0
- $! 'f$verify(GCC_DEBUGGING)' Even though this line is commented, the verify
- $! Is still set correctly !!!
- $!
- $! GNU "CC" Compiler command file - updated to work with gcc 2.0.
- $!
- $! Invoked from the GCC compile driver via LIB$DO_COMMAND:
- $! P1 = File to compile
- $! P2 = Options:
- $! P - Use C++ compiler
- $! V - Be verbose during compilation
- $! L - Save preprocessor output as listing
- $! M - Generate/Save machine code.
- $! * - Generate OBJ file
- $! P3 = Name of object file
- $! P4 = Name of listing file
- $! P5 = Name of assembly file
- $!
- $! cpp_Options: Options for preprocessor, including all defines,undef,inc
- $! gas_Options: All options for gas.
- $! cc1_Options: Options for compiler. This should *not* include the
- $! following switches, as they are taken care of in the driver
- $! program:
- $! driver program);
- $! -mdont-save-r2-r5 (PCC style register saving)
- $! -mpcc-alignment (PCC style struct align)
- $!
- $!
- $! Constants:
- $!
- $ Command_Line_Options:= 'P2' ! just so we can see them
- $Compile_Phase = 0
- $ Version:='f$trnlnm("GNU_CC_VERSION")'
- $ gcc_cpp="$GNU_CC:[''GCC_BinDir']GCC-CPP"
- $ gcc_cc1="$GNU_CC:[''GCC_BinDir']GCC-CC1"
- $ gcc_cplus="$GNU_CC:[''GCC_BinDir']GCC-CC1PLUS"
- $ gcc_collect="$GNU_CC:[''GCC_BinDir']VMS-COLLECT"
- $ gcc_as= "$GNU_CC:[''GCC_BinDir']GCC-AS ""-vGNU CC V''Version'"""
- $ Now = f$time() ! We save this so we know if a file should be deleted
- $ Now[11,1] :=+
- $!
- $!
- $! Parse the options
- $! -----------------
- $ P2_Length = f$length(P2) ! So we only have to calculate it once
- $ Plus = "" ! Default = Regular C compiler
- $ Quiet = " -quiet" ! Default = Silent
- $ Machine_Code = 0 ! Default = No Machine Code
- $ List = 0 ! Default = Do full compilation
- $ Generate_Object = 0 ! Default = No object file
- $ if f$locate("M",p2) .ne. P2_Length then Machine_Code = 1
- $ if f$locate("P",p2) .ne. P2_Length then Plus = 1
- $ if f$locate("L",p2) .ne. P2_Length then List = 1
- $ if f$locate("*",p2) .ne. P2_Length then Generate_Object = 1
- $ if f$locate("V",p2) .ne. P2_Length then Quiet = ""
- $!
- $ Temp_File = "" ! For Control_Y abort check
- $ On Control_Y then Goto Ctly_Abort
- $!
- $! Do the CC1 compilation phase options
- $!
- $!
- $! Do the filename (default to ".C" or ".CC" if G++)
- $!
- $ Filename:='p1'
- $ Extension:='f$parse(p1,,,"TYPE","SYNTAX_ONLY")'
- $ Basename:='f$parse(p1,,,"NAME","SYNTAX_ONLY")'
- $ if (Plus.eq.0).and.(Extension .eqs. ".") then Filename:='p1'.C
- $ if (Plus.eq.1).and.(Extension .eqs. ".") then Filename:='p1'.CC
- $ Object_File = P3
- $ List_File = P4
- $ Assembly_File = p5
- $ if Extension.eqs.".CPP" then List = 1 !Do not delete the input
- $ if Extension.eqs.".CPP" then List_File = Filename
- $ if Extension.eqs.".CPP" then goto do_compile
- $ if Extension.eqs.".S" then Machine_Code = 1 !Do not delete the input
- $ if Extension.eqs.".S" then Assembly_File = Filename
- $ if Extension.eqs.".S" then goto do_assembly
- $!
- $!
- $! Do the "C" pre-processor
- $!
- $on error then goto CPP_Error
- $Compile_Phase = 1
- $ if Quiet .eqs. "" then set verify
- $ gcc_cpp 'cpp_Options' 'Filename' 'List_File'
- $ Status=$status ! 'f$verify(GCC_DEBUGGING)'
- $ if Status .nes. "%X00000001" then goto CPP_Error
- $
- $ if Machine_Code + Generate_Object .eq. 0 then goto Exit
- $!
- $! Do the "C" compilation
- $!
- $do_compile:
- $Compile_Phase = 2
- $if plus.eq.1 then goto gxx
- $on error then goto CC1_Error
- $ if Quiet .eqs. "" then set verify
- $ gcc_cc1 'List_File' -dumpbase 'Basename' -
- -mgnu 'CC1_Options' -o 'Assembly_File'
- $ Status=$status ! 'f$verify(GCC_DEBUGGING)'
- $goto assemb
- $gxx:
- $on error then goto CC1_Error
- $ if Quiet .eqs. "" then set verify
- $ gcc_cplus 'List_File' -dumpbase 'Basename' -
- -mgnu 'CC1_Options' -o 'Assembly_File'
- $ Status=$status ! 'f$verify(GCC_DEBUGGING)'
- $assemb:
- $ if List.eq.0 then delete/nolog/noconfirm 'List_File';
- $ if Status .nes. "%X00000001" then goto CC1_Error
- $!
- $! Append constructor/destructor information to the .s file
- $!
- $Compile_Phase = 3
- $!if plus.eq.1 then gcc_collect 'Assembly_File'
- $!
- $!
- $! Do the assembly
- $!
- $do_assembly:
- $ if Generate_Object.eq.0 then goto Exit
- $Compile_Phase = 4
- $on error then goto Gas_Error
- $ if Quiet .eqs. "" then set verify
- $ gcc_as 'Assembly_File' 'gas_Options' -o 'Object_File'
- $ Status=$status ! 'f$verify(GCC_DEBUGGING)'
- $ if Machine_Code.eq.0 then delete/nolog/noconfirm 'Assembly_File';
- $ if Status .nes. "%X00000001" then goto Gas_Error
- $ goto Exit
- $!
- $! ERRORS:
- $! ------
- $ Ctly_Abort: ! 'f$verify(GCC_DEBUGGING)'
- $if Compile_Phase .eq. 0 then goto ctly_exit
- $if ((Compile_Phase.gt.1).and.(List.eq.1)) then goto ctly_ckasm
- $ if f$search(List_File).nes."" then -
- delete/nolog/noconf/since="''Now'" 'List_File';
- $ if Compile_Phase.eq.1 then goto ctly_exit
- $!
- $ctly_ckasm:
- $if ((Compile_Phase.gt.3).and.(Machine_Code.eq.1)) then goto ctly_ckobj
- $ if Assembly_File .eqs. "" then goto ctly_exit
- $ if f$search(Assembly_File).nes."" then -
- delete/nolog/noconf/since="''Now'" 'Assembly_File';
- $ if Compile_Phase.lt.4 then goto ctly_exit
- $!
- $ctly_ckobj:
- $ if f$search(Object_File).nes."" then -
- delete/nolog/noconf/since="''Now'" 'Object_File';
- $ctly_exit:
- $ Status = 44
- $ exit Status + 0 * f$verify(verifying)
- $!
- $! This is a little tricky - DCL substitutes all symbols (even ones in comments)
- $! before it echos commands, so the f$verify(0) is executed before the line is
- $! echoed
- $!
- $
- $ Gas_Error: Status=$status ! 'f$verify(GCC_DEBUGGING)'
- $ delete/nolog/noconfirm 'Object_File';
- $write sys$output "%GCC-I-NOOBJECT Object file deleted."
- $! if verifying then set verify
- $ exit Status + 0 * f$verify(verifying)! Error in Assembly phase
- $!
- $ CC1_Error: Status=$status ! 'f$verify(GCC_DEBUGGING)'
- $ if List.eq.0 then delete/nolog/noconfirm 'List_File';
- $ if Machine_Code.eq.0 then delete/nolog/noconfirm 'Assembly_File';
- $write sys$output "%GCC-I-NOOBJECT No object file was produced."
- $! if verifying then set verify
- $ exit Status + 0 * f$verify(verifying) ! Error in "C" Compilation phase
- $!
- $ CPP_Error: Status=$status ! 'f$verify(GCC_DEBUGGING)'
- $ if (List.eq.0) .and. (f$search(List_File).nes."") then -
- $ delete/nolog/noconfirm 'List_File';
- $write sys$output "%GCC-I-NOOBJECT No object file was produced."
- $! if verifying then set verify
- $ exit Status + 0 * f$verify(verifying) ! Error in "C" Pre-Processor phase
- $!
- $! Done
- $!
- $ Exit:
- $ if verifying then set verify
-