import of gcc-2.8
[official-gcc.git] / gcc / make-cccp.com
blob867a4385dee998c5db0ff6683c14f1265ca73651
1 $v='f$verify(0) !make-cccp.com
2 $!
3 $!      Build the GNU C preprocessor on VMS.
4 $!
5 $!      Usage:
6 $!        $ @make-cccp.com [compiler] [link-only]
7 $!
8 $!      where [compiler] is one of "GNUC", "VAXC", "DECC";
9 $!      default when none specified is "GNUC",
10 $!      and where [link-only] is "LINK" or omitted.
11 $!      If both options are specified, the compiler must come first.
13 $ if f$type(gcc_debug).eqs."INTEGER" then  if gcc_debug.and.1 then  set verify
15 $ p1 = f$edit(p1,"UPCASE,TRIM")
16 $ if p1.eqs."" then  p1 = "GNUC"
18 $!      Compiler-specific setup (assume GNU C, then override as necessary):
20 $ CC     = "gcc"
21 $ CFLAGS = "/Debug/noVerbos"
22 $ LIBS   = "gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr"
23 $ if p1.nes."GNUC"
24 $ then
25 $   CC     = "cc"
26 $   CFLAGS = "/noOpt"   !disable optimizer when bootstrapping with native cc
27 $   if p1.eqs."VAXC"
28 $   then
29 $     if f$trnlnm("DECC$CC_DEFAULT").nes."" then  CC = "cc/VAXC"
30 $     LIBS = "alloca.obj,sys$library:vaxcrtl.olb/Libr"
31 $     define/noLog SYS SYS$LIBRARY:
32 $   else
33 $     if p1.eqs."DECC"
34 $     then
35 $       if f$trnlnm("DECC$CC_DEFAULT").nes."" then  CC = "cc/DECC"
36 $       LIBS = "alloca.obj"     !DECC$SHR will be found implicitly by linker
37 $       define/noLog SYS DECC$LIBRARY_INCLUDE:
38 $     else
39 $       if p1.nes."LINK"
40 $       then
41 $         type sys$input: /Output=sys$error:
42 $DECK
43 [compiler] argument should be one of "GNUC", "VAXC", or "DECC".
45 Usage:
46 $ @make-cccp.com [compiler] [link-only]
48 $EOD
49 $         exit %x1000002C + 0*f$verify(v)       !%SYSTEM-F-ABORT
50 $       endif !!LINK
51 $     endif !DECC
52 $   endif !VAXC
53 $ endif !!GNUC
56 $!      Other setup:
58 $ LDFLAGS =     "/noMap"
59 $ PARSER  =     "bison"
60 $ RENAME  =     "rename/New_Version"
61 $ LINK    =     "link"
62 $ echo    =     "write sys$output"
64 $!!!!!!!
65 $!      Nothing beyond this point should need any local configuration changes.
66 $!!!!!!!
68 $! Set the default directory to the same place as this command procedure.
69 $ flnm = f$enviroment("PROCEDURE")      !get current procedure name
70 $ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
72 $ if p1.eqs."LINK" .or. p2.eqs."LINK" then  goto Link
73 $ echo " Building the preprocessor."
75 $! Compile the simplest file first, to catch problem with compiler setup early.
76 $ set verify
77 $ 'CC''CFLAGS' version.c
78 $!'f$verify(0)
80 $ set verify
81 $ 'CC''CFLAGS' cccp.c
82 $!'f$verify(0)
84 $! Compile preprocessor's parser, possibly making it with yacc first.
85 $ if f$search("CEXP.C").nes."" then -
86     if f$cvtime(f$file_attributes("CEXP.C","RDT")).ges.-
87        f$cvtime(f$file_attributes("CEXP.Y","RDT")) then  goto skip_yacc
88 $ set verify
89 $ 'PARSER' cexp.y
90 $ 'RENAME' cexp_tab.c cexp.c
91 $!'f$verify(0)
92 $skip_yacc:
93 $ echo " (Ignore any warning about not finding file ""bison.simple"".)"
94 $ set verify
95 $ 'CC''CFLAGS' cexp.c
96 $ 'CC''CFLAGS'/Define="PREFIX=""_dummy_""" prefix.c
97 $!'f$verify(0)
99 $! In case there's no builtin alloca support, use the C simulation.
100 $ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).lt.f$length(LIBS)
101 $ then
102 $  set verify
103 $ 'CC''CFLAGS'/Incl=[]/Defi=("HAVE_CONFIG_H","STACK_DIRECTION=(-1)") alloca.c
104 $!'f$verify(0)
105 $ endif
108 $Link:
109 $ echo " Linking the preprocessor."
110 $ set verify
111 $ 'LINK''LDFLAGS'/Exe=gcc-cpp.exe -
112           cccp.obj,cexp.obj,prefix.obj,version.obj,version.opt/Opt,-
113           'LIBS'
114 $!'f$verify(0)
116 $!      Done
118 $ exit 1+0*f$verify(v)