home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gccdist / gcc / gcc.com < prev    next >
Encoding:
Text File  |  1992-06-11  |  6.3 KB  |  185 lines

  1. $ Verifying:= 'f$verify(0)'
  2. $ if "''gcc_debugging'".eqs."" then gcc_debugging = 0
  3. $! 'f$verify(GCC_DEBUGGING)'    Even though this line is commented, the verify
  4. $!                Is still set correctly !!!
  5. $!
  6. $!    GNU "CC" Compiler command file - updated to work with gcc 2.0.
  7. $!
  8. $!    Invoked from the GCC compile driver via LIB$DO_COMMAND:
  9. $!        P1 = File to compile
  10. $!        P2 = Options:
  11. $!                  P - Use C++ compiler
  12. $!                  V - Be verbose during compilation
  13. $!                  L - Save preprocessor output as listing
  14. $!                  M - Generate/Save machine code.
  15. $!                  * - Generate OBJ file
  16. $!        P3 = Name of object file 
  17. $!        P4 = Name of listing file 
  18. $!        P5 = Name of assembly file 
  19. $!
  20. $!    cpp_Options: Options for preprocessor, including all defines,undef,inc
  21. $!    gas_Options: All options for gas.
  22. $!    cc1_Options: Options for compiler.  This should *not* include the
  23. $!        following switches, as they are taken care of in the driver
  24. $!        program:
  25. $!            driver program);
  26. $!            -mdont-save-r2-r5    (PCC style register saving)
  27. $!            -mpcc-alignment        (PCC style struct align)
  28. $!
  29. $!
  30. $!  Constants:
  31. $!
  32. $ Command_Line_Options:= 'P2' ! just so we can see them
  33. $Compile_Phase = 0
  34. $ Version:='f$trnlnm("GNU_CC_VERSION")'
  35. $ gcc_cpp="$GNU_CC:[''GCC_BinDir']GCC-CPP"
  36. $ gcc_cc1="$GNU_CC:[''GCC_BinDir']GCC-CC1"
  37. $ gcc_cplus="$GNU_CC:[''GCC_BinDir']GCC-CC1PLUS"
  38. $ gcc_collect="$GNU_CC:[''GCC_BinDir']VMS-COLLECT"
  39. $ gcc_as= "$GNU_CC:[''GCC_BinDir']GCC-AS ""-vGNU CC  V''Version'"""
  40. $ Now = f$time()    ! We save this so we know if a file should be deleted
  41. $ Now[11,1] :=+
  42. $!
  43. $!
  44. $!  Parse the options
  45. $!  -----------------
  46. $ P2_Length = f$length(P2)    ! So we only have to calculate it once
  47. $ Plus = ""            !    Default = Regular C compiler
  48. $ Quiet = " -quiet"        !    Default = Silent
  49. $ Machine_Code = 0        !    Default = No Machine Code
  50. $ List = 0            !    Default = Do full compilation
  51. $ Generate_Object = 0        !    Default = No object file
  52. $ if f$locate("M",p2) .ne. P2_Length then Machine_Code = 1
  53. $ if f$locate("P",p2) .ne. P2_Length then Plus = 1
  54. $ if f$locate("L",p2) .ne. P2_Length then List = 1
  55. $ if f$locate("*",p2) .ne. P2_Length then Generate_Object = 1
  56. $ if f$locate("V",p2) .ne. P2_Length then Quiet = ""
  57. $!
  58. $ Temp_File = ""        ! For Control_Y abort check
  59. $ On Control_Y then Goto Ctly_Abort
  60. $!
  61. $!    Do the CC1 compilation phase options
  62. $!
  63. $!
  64. $!  Do the filename (default to ".C" or ".CC" if G++)
  65. $!
  66. $ Filename:='p1'
  67. $ Extension:='f$parse(p1,,,"TYPE","SYNTAX_ONLY")'
  68. $ Basename:='f$parse(p1,,,"NAME","SYNTAX_ONLY")'
  69. $ if (Plus.eq.0).and.(Extension .eqs. ".") then Filename:='p1'.C
  70. $ if (Plus.eq.1).and.(Extension .eqs. ".") then Filename:='p1'.CC
  71. $ Object_File = P3
  72. $ List_File = P4
  73. $ Assembly_File = p5
  74. $ if Extension.eqs.".CPP" then List = 1    !Do not delete the input
  75. $ if Extension.eqs.".CPP" then List_File = Filename
  76. $ if Extension.eqs.".CPP" then goto do_compile
  77. $ if Extension.eqs.".S" then Machine_Code = 1    !Do not delete the input
  78. $ if Extension.eqs.".S" then Assembly_File = Filename
  79. $ if Extension.eqs.".S" then goto do_assembly
  80. $!
  81. $!
  82. $!    Do the "C" pre-processor
  83. $!
  84. $on error then goto CPP_Error
  85. $Compile_Phase = 1
  86. $ if Quiet .eqs. "" then set verify
  87. $ gcc_cpp 'cpp_Options' 'Filename' 'List_File'
  88. $ Status=$status ! 'f$verify(GCC_DEBUGGING)'
  89. $ if Status .nes. "%X00000001" then goto CPP_Error
  90. $
  91. $ if Machine_Code + Generate_Object .eq. 0 then goto Exit
  92. $!
  93. $!    Do the "C" compilation
  94. $!
  95. $do_compile:
  96. $Compile_Phase = 2
  97. $if plus.eq.1 then goto gxx
  98. $on error then goto CC1_Error
  99. $ if Quiet .eqs. "" then set verify
  100. $ gcc_cc1 'List_File' -dumpbase 'Basename' -
  101.    -mgnu 'CC1_Options'  -o 'Assembly_File'
  102. $ Status=$status ! 'f$verify(GCC_DEBUGGING)'
  103. $goto assemb
  104. $gxx:
  105. $on error then goto CC1_Error
  106. $ if Quiet .eqs. "" then set verify
  107. $ gcc_cplus 'List_File' -dumpbase 'Basename' -
  108.    -mgnu 'CC1_Options' -o 'Assembly_File'
  109. $ Status=$status ! 'f$verify(GCC_DEBUGGING)'
  110. $assemb:
  111. $ if List.eq.0 then delete/nolog/noconfirm 'List_File';
  112. $ if Status .nes. "%X00000001" then goto CC1_Error
  113. $!
  114. $!    Append constructor/destructor information to the .s file
  115. $!
  116. $Compile_Phase = 3
  117. $!if plus.eq.1 then  gcc_collect 'Assembly_File'
  118. $!
  119. $!
  120. $!    Do the assembly
  121. $!
  122. $do_assembly:
  123. $ if Generate_Object.eq.0 then goto Exit
  124. $Compile_Phase = 4
  125. $on error then goto Gas_Error
  126. $ if Quiet .eqs. "" then set verify
  127. $ gcc_as 'Assembly_File' 'gas_Options' -o 'Object_File'
  128. $ Status=$status ! 'f$verify(GCC_DEBUGGING)'
  129. $ if Machine_Code.eq.0 then delete/nolog/noconfirm 'Assembly_File';
  130. $ if Status .nes. "%X00000001" then goto Gas_Error
  131. $ goto Exit
  132. $!
  133. $!    ERRORS:
  134. $!    ------
  135. $ Ctly_Abort:    ! 'f$verify(GCC_DEBUGGING)'
  136. $if Compile_Phase .eq. 0 then goto ctly_exit
  137. $if ((Compile_Phase.gt.1).and.(List.eq.1)) then goto ctly_ckasm
  138. $ if f$search(List_File).nes."" then -
  139.          delete/nolog/noconf/since="''Now'" 'List_File';
  140. $ if Compile_Phase.eq.1 then goto ctly_exit
  141. $!
  142. $ctly_ckasm:
  143. $if ((Compile_Phase.gt.3).and.(Machine_Code.eq.1)) then goto ctly_ckobj
  144. $ if Assembly_File .eqs. "" then goto ctly_exit
  145. $ if f$search(Assembly_File).nes."" then -
  146.         delete/nolog/noconf/since="''Now'" 'Assembly_File';
  147. $ if Compile_Phase.lt.4 then goto ctly_exit
  148. $!
  149. $ctly_ckobj:
  150. $ if f$search(Object_File).nes."" then -
  151.         delete/nolog/noconf/since="''Now'" 'Object_File';
  152. $ctly_exit:
  153. $ Status = 44
  154. $ exit Status + 0 * f$verify(verifying)
  155. $!
  156. $! This is a little tricky - DCL substitutes all symbols (even ones in comments)
  157. $! before it echos commands, so the f$verify(0) is executed before the line is
  158. $! echoed
  159. $!
  160. $
  161. $ Gas_Error: Status=$status ! 'f$verify(GCC_DEBUGGING)'
  162. $ delete/nolog/noconfirm 'Object_File';
  163. $write sys$output "%GCC-I-NOOBJECT Object file deleted."
  164. $! if verifying then set verify
  165. $ exit Status    + 0 * f$verify(verifying)! Error in Assembly phase
  166. $!
  167. $ CC1_Error: Status=$status ! 'f$verify(GCC_DEBUGGING)'
  168. $ if List.eq.0 then         delete/nolog/noconfirm 'List_File';
  169. $ if Machine_Code.eq.0 then     delete/nolog/noconfirm 'Assembly_File';
  170. $write sys$output "%GCC-I-NOOBJECT No object file was produced."
  171. $! if verifying then set verify
  172. $ exit Status + 0 * f$verify(verifying)    ! Error in "C" Compilation phase
  173. $!
  174. $ CPP_Error: Status=$status ! 'f$verify(GCC_DEBUGGING)'
  175. $ if (List.eq.0) .and. (f$search(List_File).nes."") then - 
  176. $        delete/nolog/noconfirm 'List_File';
  177. $write sys$output "%GCC-I-NOOBJECT No object file was produced."
  178. $! if verifying then set verify
  179. $ exit Status + 0 * f$verify(verifying)    ! Error in "C" Pre-Processor phase
  180. $!
  181. $!    Done
  182. $!
  183. $ Exit:
  184. $ if verifying then set verify
  185.