home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / make-cc1.com < prev    next >
Text File  |  1994-02-06  |  12KB  |  362 lines

  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. $!
  5. $ v=f$verify(0)
  6. $set symbol/scope=(nolocal,noglobal)
  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. $!
  11. $!    Build the GNU "C" compiler on VMS
  12. $!
  13. $!  Note:  to build with DEC's VAX C compiler, uncomment the 2nd CC, CFLAGS,
  14. $!       and LIBS alternatives, and also execute the following command:
  15. $!    DEFINE SYS SYS$LIBRARY:
  16. $!       After a successful build, restore those items and rebuild with gcc.
  17. $
  18. $!    C compiler
  19. $!
  20. $ CC    :=    gcc
  21. $! CC    :=    cc    !uncomment for VAXC
  22. $ BISON    :=    bison
  23. $ RENAME    :=    rename/new_vers
  24. $ LINK    :=    link
  25. $ EDIT :=    edit
  26. $!
  27. $!    Compiler options
  28. $!
  29. $ CFLAGS =    "/debug/cc1_options=""-mpcc-alignment""/incl=([],[.config])"
  30. $! CFLAGS =    "/noopt/incl=([],[.config])"
  31. $!
  32. $!    Link options
  33. $!
  34. $ LDFLAGS :=    /nomap
  35. $!
  36. $!    Link libraries
  37. $!
  38. $ LIBS :=    gnu_cc:[000000]gcclib.olb/libr,sys$library:vaxcrtl.olb/libr
  39. $! LIBS :=    alloca.obj,sys$library:vaxcrtl.olb/libr
  40. $!
  41. $!
  42. $!  First we figure out what needs to be done.  This is sort of like a limited
  43. $! make facility - the command line options specify exactly what components
  44. $! we want to build.  The following options are understood:
  45. $!
  46. $!    LINK:    Assume that the object modules for the selected compiler(s)
  47. $!        have already been compiled, perform link phase only.
  48. $!
  49. $!    CC1:    Compile and link "C" compiler.
  50. $!
  51. $!    CC1PLUS:Compile and link "C++" compiler.
  52. $!
  53. $!    CC1OBJ:    Compile and link objective C compiler.
  54. $!
  55. $!    ALL:    Compile and link all of the CC1 passes.
  56. $!
  57. $!    INDEPENDENT:
  58. $!        Compile language independent source modules. (On by default).
  59. $!
  60. $!    DEBUG:    Link images with /debug.
  61. $!
  62. $! If you want to list more than one option, you should use a spaces to
  63. $! separate them.
  64. $!
  65. $!    Any one of the above options can be prefaced with a "NO".  For example,
  66. $! if you had already built GCC, and you wanted to build G++, you could use the
  67. $! "CC1PLUS NOINDEPENDENT" options, which would only compile the C++ language
  68. $! specific source files, and then link the C++ compiler.
  69. $!
  70. $! If you do not specify which compiler you want to build, it is assumed that
  71. $! you want to build GNU-C ("CC1").
  72. $!
  73. $! Now figure out what we have been requested to do.
  74. $p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7 
  75. $p1 = f$edit(p1,"COMPRESS")
  76. $i=0
  77. $DO_ALL = 0
  78. $DO_LINK = 0
  79. $DO_DEBUG = 0
  80. $open cfile$ compilers.list
  81. $cinit:read cfile$ compilername/end=cinit_done
  82. $DO_'compilername'=0
  83. $goto cinit
  84. $cinit_done: close cfile$
  85. $DO_INDEPENDENT = 1
  86. $DO_DEFAULT = 1
  87. $loop:
  88. $string = f$element(i," ",p1)
  89. $if string.eqs." " then goto done
  90. $flag = 1
  91. $if string.eqs."CC1PLUS" then DO_DEFAULT = 0
  92. $if string.eqs."CC1OBJ" then DO_DEFAULT = 0
  93. $if f$extract(0,2,string).nes."NO" then goto parse_option
  94. $  string=f$extract(2,f$length(string)-2,string)
  95. $  flag = 0
  96. $parse_option:
  97. $DO_'string' = flag
  98. $i=i+1
  99. $goto loop
  100. $!
  101. $done:
  102. $if DO_DEFAULT.eq.1 then DO_CC1 = 1
  103. $echo := write sys$Output
  104. $echo "This command file will now perform the following actions:
  105. $if DO_LINK.eq.1 then goto link_only
  106. $if DO_ALL.eq.1 then echo "   Compile all language specific object modules."
  107. $if DO_CC1.eq.1 then echo "   Compile C specific object modules."
  108. $if DO_CC1PLUS.eq.1 then echo "   Compile C++ specific object modules."
  109. $if DO_CC1OBJ.eq.1 then echo "   Compile obj-C specific object modules."
  110. $if DO_INDEPENDENT.eq.1 then echo "   Compile language independent object modules."
  111. $link_only:
  112. $if DO_CC1.eq.1 then    echo "   Link C compiler (gcc-cc1.exe)."
  113. $if DO_CC1PLUS.eq.1 then echo "   Link C++ compiler (gcc-cc1plus.exe)."
  114. $if DO_CC1OBJ.eq.1 then echo "   Link objective-C compiler (gcc-cc1obj.exe)."
  115. $if DO_DEBUG.eq.1 then echo  "   Link images to run under debugger."
  116. $!
  117. $! Test and see if we need these messages or not.  The -1 switch gives it away.
  118. $!
  119. $gas := $gnu_cc:[000000]gcc-as.exe
  120. $if f$search(gas-"$").eqs."" then  goto gas_message    !must be VAXC
  121. $define/user sys$error sys$scratch:gas_test.tmp
  122. $gas -1 nla0: -o nla0:
  123. $size=f$file_attributes("sys$scratch:gas_test.tmp","ALQ")
  124. $delete/nolog sys$scratch:gas_test.tmp;*
  125. $if size.eq.0 then goto no_message
  126. $gas_message:
  127. $type sys$input
  128.  
  129.     Note: GCC 2.0 treats external variables differently than GCC 1.40 does.
  130. Before you use GCC 2.0, you should obtain a version of the assembler which 
  131. contains the patches to work with GCC 2.0 (GCC-AS 1.38 does not contain 
  132. these patches - whatever comes after this probably will).  The assembler
  133. in gcc-vms-1.40.tar.Z from prep does contain the proper patches.
  134.  
  135.     If you do not update the assembler, the compiler will still work,
  136. but `extern const' variables will be treated as `extern'.  This will result
  137. in linker warning messages about mismatched psect attributes, and these
  138. variables will be placed in read/write storage.
  139.  
  140. $!
  141. $no_message:
  142. $!
  143. $!
  144. $ if DO_DEBUG.eq.1 then LDFLAGS :='LDFLAGS'/debug
  145. $!
  146. $if DO_LINK.eq.1 then goto compile_cc1
  147. $if DO_INDEPENDENT.eq.1 
  148. $    THEN 
  149. $!
  150. $! Build alloca if necessary (in 'LIBS for use with VAXC)
  151. $!
  152. $ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).ge.f$length(LIBS) then -
  153.     goto skip_alloca
  154. $ if f$search("alloca.obj").nes."" then -  !does .obj exist? is it up to date?
  155.     if f$cvtime(f$file_attributes("alloca.obj","RDT")).gts.-
  156.        f$cvtime(f$file_attributes("alloca.c","RDT")) then  goto skip_alloca
  157. $set verify
  158. $ 'CC 'CFLAGS /define="STACK_DIRECTION=(-1)" alloca.c
  159. $!'f$verify(0)
  160. $skip_alloca:
  161. $!
  162. $! First build a couple of header files from the machine description
  163. $! These are used by many of the source modules, so we build them now.
  164. $!
  165. $set verify
  166. $ 'CC 'CFLAGS rtl.C
  167. $ 'CC 'CFLAGS obstack.C
  168. $!'f$verify(0)
  169. $! Generate insn-attr.h
  170. $    call generate insn-attr.h
  171. $    call generate insn-flags.h
  172. $    call generate insn-codes.h
  173. $    call generate insn-config.h
  174. $!
  175. $call compile independent.opt "rtl,obstack,insn-attrtab"
  176. $!
  177. $    call generate insn-attrtab.c "rtlanal,"
  178. $set verify
  179. $ 'CC 'CFLAGS insn-attrtab.c
  180. $!'f$verify(0)
  181. $    endif
  182. $!
  183. $compile_cc1:
  184. $if (DO_CC1 + DO_CC1OBJ) .ne.0
  185. $    then
  186. $if (f$search("C-PARSE.Y") .eqs. "") then goto yes_yfiles
  187. $if (f$cvtime(f$file_attributes("C-PARSE.IN","RDT")).gts. -
  188.          f$cvtime(f$file_attributes("C-PARSE.Y","RDT")))  -
  189.         then goto yes_yfiles
  190. $if (f$search("OBJC-PARSE.Y") .eqs. "") then goto yes_yfiles
  191. $if (f$cvtime(f$file_attributes("C-PARSE.IN","RDT")).gts. -
  192.          f$cvtime(f$file_attributes("OBJC-PARSE.Y","RDT")))  -
  193.         then goto yes_yfiles
  194. $GOTO no_yfiles
  195. $yes_yfiles:
  196. $echo "Now processing c-parse.in to generate c-parse.y and objc-parse.y."
  197. $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input
  198. !
  199. !     Read c-parse.in, write c-parse.y and objc-parse.y, depending on
  200. !     paired lines of "ifc" & "end ifc" and "ifobjc" & "end ifobjc" to
  201. !     control what goes into each file.  Most lines will be common to
  202. !     both (hence not bracketed by either control pair).  Mismatched
  203. !     pairs aren't detected--garbage in, garbage out...
  204. !
  205.  
  206.    PROCEDURE do_output()
  207.       IF NOT objc_only THEN POSITION(END_OF(c)); COPY_TEXT(input_line); ENDIF;
  208.       IF NOT c_only THEN POSITION(END_OF(objc)); COPY_TEXT(input_line); ENDIF;
  209.       POSITION(input_file);                     !reset
  210.    ENDPROCEDURE;
  211.  
  212.    input_file := CREATE_BUFFER("input", "c-parse.in");  !load data
  213.          SET(NO_WRITE, input_file);
  214.    c          := CREATE_BUFFER("c_output");     !1st output file
  215.    objc       := CREATE_BUFFER("objc_output");  !2nd output file
  216.  
  217.    POSITION(BEGINNING_OF(input_file));
  218.    c_only     := 0;
  219.    objc_only  := 0;
  220.  
  221.    LOOP
  222.       EXITIF MARK(NONE) = END_OF(input_file);   !are we done yet?
  223.  
  224.       input_line := CURRENT_LINE;               !access current_line just once
  225.       CASE EDIT(input_line, TRIM_TRAILING, OFF, NOT_IN_PLACE)
  226.      ["ifc"]        : c_only := 1;
  227.      ["end ifc"]    : c_only := 0;
  228.      ["ifobjc"]     : objc_only := 1;
  229.      ["end ifobjc"] : objc_only := 0;
  230. !         default -- add non-control line to either or both output files
  231.      [INRANGE]      : do_output();          !between "end" and "if"
  232.      [OUTRANGE]     : do_output();          !before "end" or after "if"
  233.       ENDCASE;
  234.  
  235.       MOVE_VERTICAL(1);