1 | $! make-l2.com -- VMS build procedure for libgcc2. |
---|
2 | $ |
---|
3 | $! Change working directory to the location of this command procedure. |
---|
4 | $ flnm = f$enviroment("PROCEDURE") !get current procedure name |
---|
5 | $ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")' |
---|
6 | $! |
---|
7 | $! Command file to build libgcc2.olb. You should only run this once you |
---|
8 | $! have the current compiler installed, otherwise some of the builtins will |
---|
9 | $! not be recognized. Once you have built libgcc2.olb, you can merge this |
---|
10 | $! with gnu_cc:[000000]gcclib.olb |
---|
11 | $! |
---|
12 | $! All of the C source code is assumed to be in libgcc2.c, and a list of the |
---|
13 | $! modules that we need from there is in libgcc2.list (which is generated |
---|
14 | $! when vmsconfig.com is run). The C++ source is found in the [.cp.inc] |
---|
15 | $! directory and managed via libgcc2-cxx.list. |
---|
16 | $! |
---|
17 | $ if f$search("gcc-cc1.exe").eqs."" |
---|
18 | $ then |
---|
19 | $ gcc_cc1:=$gnu_cc:[000000]gcc-cc1 |
---|
20 | $ if f$extract(0,1,f$trnlnm("GNU_CC_VERSION")).eqs."1" then goto nocompile |
---|
21 | $ else |
---|
22 | $ gcc_cc1:=$sys$disk:[]gcc-cc1 |
---|
23 | $ endif |
---|
24 | $! |
---|
25 | $ if f$search("gcc-cpp.exe").eqs."" |
---|
26 | $ then |
---|
27 | $ gcc_cpp:=$gnu_cc:[000000]gcc-cpp |
---|
28 | $ if f$extract(0,1,f$trnlnm("GNU_CC_VERSION")).eqs."1" then goto nocompile |
---|
29 | $ Version:='f$trnlnm("GNU_CC_VERSION")' |
---|
30 | $ else |
---|
31 | $ gcc_cpp:=$sys$disk:[]gcc-cpp |
---|
32 | $ open ifile$ version.opt |
---|
33 | $ read ifile$ line |
---|
34 | $ close ifile$ |
---|
35 | $ Version=line - "ident=""" - """ |
---|
36 | $ endif |
---|
37 | $! |
---|
38 | $ if f$search("gcc-cc1plus.exe").eqs."" |
---|
39 | $ then gcc_cxx = "$gnu_cc:[000000]gcc-cc1plus" |
---|
40 | $ else gcc_cxx = "$sys$disk:[]gcc-cc1plus" |
---|
41 | $ endif |
---|
42 | $! |
---|
43 | $gcc_as:=$gnu_cc:[000000]gcc-as |
---|
44 | $cpp_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.cpp |
---|
45 | $s_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.s |
---|
46 | $! |
---|
47 | $set symbol/scope=(nolocal,noglobal) |
---|
48 | $! |
---|
49 | $goto compile |
---|
50 | $! |
---|
51 | $nocompile: |
---|
52 | $write sys$error "You must have gcc version 2 in order to build libgcc2." |
---|
53 | $exit 0 |
---|
54 | $! |
---|
55 | $compile: |
---|
56 | $lib/create libgcc2.olb |
---|
57 | $on error then goto c_err |
---|
58 | $on control_y then goto c_err |
---|
59 | $ |
---|
60 | $if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ |
---|
61 | $open ifile$ libgcc2.list |
---|
62 | $loop: |
---|
63 | $! |
---|
64 | $read ifile$ line/end=c_done |
---|
65 | $i=0 |
---|
66 | $loop1: |
---|
67 | $flnm=f$element(i," ",line) |
---|
68 | $i=i+1 |
---|
69 | $if flnm.eqs."" then goto loop |
---|
70 | $if flnm.eqs." " then goto loop |
---|
71 | $! |
---|
72 | $flnm = "L"+flnm |
---|
73 | $if flnm.eqs."L_exit" then goto loop1 |
---|
74 | $write sys$output "$ gcc/debug/define=""''flnm'"" LIBGCC2.C" |
---|
75 | $! |
---|
76 | $objname = flnm |
---|
77 | $if flnm.eqs."L_builtin_New" then objname = "L_builtin_nnew" |
---|
78 | $! |
---|
79 | $! We do this by hand, since the VMS compiler driver does not have a way |
---|
80 | $! of specifying an alternate location for the compiler executables. |
---|
81 | $! |
---|
82 | $ gcc_cpp "-I[]" "-I[.ginclude]" "-D''flnm'" libgcc2.c 'cpp_file' |
---|
83 | $ gcc_cc1 'cpp_file' -dumpbase 'objname' -fexceptions - |
---|
84 | -quiet -mgnu -g "-O1" -mvaxc-alignment -o 's_file' |
---|
85 | $ delete/nolog 'cpp_file'; |
---|
86 | $ gcc_as "-vGNU CC V''Version'" 's_file' -o 'objname'.OBJ |
---|
87 | $! Assemble again, preserving lowercase symbol names this time. |
---|
88 | $ gcc_as "-vGNU CC V''Version'" -h3 's_file' -o 'objname'-c.OBJ |
---|
89 | $ delete/nolog 's_file'; |
---|
90 | $! |
---|
91 | $ library libgcc2.olb 'objname'.obj,'objname'-c.obj |
---|
92 | $ delete/nolog 'objname'.obj;,'objname'-c.obj; |
---|
93 | $! |
---|
94 | $goto loop1 |
---|
95 | $! |
---|
96 | $! In case of error or abort, go here (In order to close file). |
---|
97 | $! |
---|
98 | $c_err: !'f$verify(0) |
---|
99 | $close ifile$ |
---|
100 | $ exit %x2c |
---|
101 | $! |
---|
102 | $c_done: |
---|
103 | $close ifile$ |
---|
104 | $ |
---|
105 | $ |
---|
106 | $ EXIT |
---|
107 | $ !gcc-2.8.0: C++ libgcc2 code disabled since it's not adequately tested |
---|
108 | $ |
---|
109 | $! |
---|
110 | $ p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7+" "+p8 |
---|
111 | $ p1 = " " + f$edit(p1,"COMPRESS,TRIM,UPCASE") + " " |
---|
112 | $! (note: substring locations can only be equal when neither string is present) |
---|
113 | $ if f$locate(" CC1PLUS ",p1).eq.f$locate(" CXX ",p1) then goto cxx_done |
---|
114 | $ if f$search("libgcc2-cxx.list").eqs."" then goto cxx_done |
---|
115 | $! |
---|
116 | $ open/read ifile$ libgcc2-cxx.list |
---|
117 | $cxx_line_loop: |
---|
118 | $ read ifile$ line/end=cxx_done |
---|
119 | $ i = 0 |
---|
120 | $cxx_file_loop: |
---|
121 | $ flnm = f$element(i,",",line) |
---|
122 | $ i = i + 1 |
---|
123 | $ if flnm.eqs."" .or. flnm.eqs."," then goto cxx_line_loop |
---|
124 | $ write sys$output "$ gcc/plus/debug ''flnm'.cc" |
---|
125 | $ objname = flnm |
---|
126 | $! |
---|
127 | $ gcc_cpp -+ "-I[]" "-I[.ginclude]" "-I[.cp.inc]" [.cp]'flnm'.cc 'cpp_file' |
---|
128 | $ gcc_cxx 'cpp_file' -dumpbase 'objname' -fexceptions - |
---|
129 | -quiet -mgnu -g "-O1" -mvaxc-alignment -o 's_file' |
---|
130 | $ delete/nolog 'cpp_file'; |
---|
131 | $ gcc_as "-vGNU CC V''Version'" 's_file' -o 'objname'.OBJ |
---|
132 | $! Assemble again, preserving lowercase symbol names this time. |
---|
133 | $ gcc_as "-vGNU CC V''Version'" -h3 's_file' -o 'objname'-c.OBJ |
---|
134 | $ delete/nolog 's_file'; |
---|
135 | $ |
---|
136 | $ library libgcc2.olb 'objname'.obj,'objname'-c.obj |
---|
137 | $ delete/nolog 'objname'.obj;,'objname'-c.obj; |
---|
138 | $! |
---|
139 | $ goto cxx_file_loop |
---|
140 | $! |
---|
141 | $cxx_done: |
---|
142 | $ close ifile$ |
---|
143 | $ exit |
---|