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. |
---|
12 | $! |
---|
13 | $ if f$type(gcc_debug).eqs."INTEGER" then if gcc_debug.and.1 then set verify |
---|
14 | $ |
---|
15 | $ p1 = f$edit(p1,"UPCASE,TRIM") |
---|
16 | $ if p1.eqs."" then p1 = "GNUC" |
---|
17 | $! |
---|
18 | $! Compiler-specific setup (assume GNU C, then override as necessary): |
---|
19 | $! |
---|
20 | $ CC = "gcc" |
---|
21 | $ CFLAGS = "/Opt=2/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 | $ CC = CC + "/Prefix=All" |
---|
37 | $ LIBS = "alloca.obj" !DECC$SHR will be found implicitly by linker |
---|
38 | $ define/noLog SYS DECC$LIBRARY_INCLUDE: |
---|
39 | $ else |
---|
40 | $ if p1.nes."LINK" |
---|
41 | $ then |
---|
42 | $ type sys$input: /Output=sys$error: |
---|
43 | $DECK |
---|
44 | [compiler] argument should be one of "GNUC", "VAXC", or "DECC". |
---|
45 | |
---|
46 | Usage: |
---|
47 | $ @make-cccp.com [compiler] [link-only] |
---|
48 | |
---|
49 | $EOD |
---|
50 | $ exit %x1000002C + 0*f$verify(v) !%SYSTEM-F-ABORT |
---|
51 | $ endif !!LINK |
---|
52 | $ endif !DECC |
---|
53 | $ endif !VAXC |
---|
54 | $ endif !!GNUC |
---|
55 | $ |
---|
56 | $! |
---|
57 | $! Other setup: |
---|
58 | $! |
---|
59 | $ LDFLAGS = "/noMap" |
---|
60 | $ PARSER = "bison" |
---|
61 | $ RENAME = "rename/New_Version" |
---|
62 | $ LINK = "link" |
---|
63 | $ echo = "write sys$output" |
---|
64 | $ |
---|
65 | $!!!!!!! |
---|
66 | $! Nothing beyond this point should need any local configuration changes. |
---|
67 | $!!!!!!! |
---|
68 | $ |
---|
69 | $! Set the default directory to the same place as this command procedure. |
---|
70 | $ flnm = f$enviroment("PROCEDURE") !get current procedure name |
---|
71 | $ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")' |
---|
72 | $ |
---|
73 | $ if p1.eqs."LINK" .or. p2.eqs."LINK" then goto Link |
---|
74 | $ echo " Building the preprocessor." |
---|
75 | $ |
---|
76 | $! Compile the simplest file first, to catch problem with compiler setup early. |
---|
77 | $ set verify |
---|
78 | $ 'CC''CFLAGS' version.c |
---|
79 | $!'f$verify(0) |
---|
80 | $ |
---|
81 | $ set verify |
---|
82 | $ 'CC''CFLAGS' cccp.c |
---|
83 | $!'f$verify(0) |
---|
84 | $ |
---|
85 | $! Compile preprocessor's parser, possibly making it with yacc first. |
---|
86 | $ if f$search("CEXP.C").nes."" then - |
---|
87 | if f$cvtime(f$file_attributes("CEXP.C","RDT")).ges.- |
---|
88 | f$cvtime(f$file_attributes("CEXP.Y","RDT")) then goto skip_yacc |
---|
89 | $ set verify |
---|
90 | $ 'PARSER' cexp.y |
---|
91 | $ 'RENAME' cexp_tab.c cexp.c |
---|
92 | $!'f$verify(0) |
---|
93 | $skip_yacc: |
---|
94 | $ echo " (Ignore any warning about not finding file ""bison.simple"".)" |
---|
95 | $ set verify |
---|
96 | $ 'CC''CFLAGS' cexp.c |
---|
97 | $ 'CC''CFLAGS'/Define="PREFIX=""_dummy_""" prefix.c |
---|
98 | $!'f$verify(0) |
---|
99 | $ |
---|
100 | $! In case there's no builtin alloca support, use the C simulation. |
---|
101 | $ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).lt.f$length(LIBS) |
---|
102 | $ then |
---|
103 | $ set verify |
---|
104 | $ 'CC''CFLAGS'/Incl=[]/Defi=("HAVE_CONFIG_H","STACK_DIRECTION=(-1)") alloca.c |
---|
105 | $!'f$verify(0) |
---|
106 | $ endif |
---|
107 | $! |
---|
108 | $ |
---|
109 | $Link: |
---|
110 | $ echo " Linking the preprocessor." |
---|
111 | $ set verify |
---|
112 | $ 'LINK''LDFLAGS'/Exe=gcc-cpp.exe - |
---|
113 | cccp.obj,cexp.obj,prefix.obj,version.obj,version.opt/Opt,- |
---|
114 | 'LIBS' |
---|
115 | $!'f$verify(0) |
---|
116 | $! |
---|
117 | $! Done |
---|
118 | $! |
---|
119 | $ exit 1+0*f$verify(v) |
---|