Import final gcc2 snapshot (990109)
[official-gcc.git] / gcc / make-l2.com
blob9f45e64d95d2f8282a3492e24470644c4e9e9ffd
1 $! make-l2.com -- VMS build procedure for libgcc2.
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
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.
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
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
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
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
47 $set symbol/scope=(nolocal,noglobal)
49 $goto compile
51 $nocompile:
52 $write sys$error "You must have gcc version 2 in order to build libgcc2."
53 $exit 0
55 $compile:
56 $lib/create libgcc2.olb
57 $on error then goto c_err
58 $on control_y then goto c_err
60 $if f$trnlnm("IFILE$").nes."" then  close/noLog ifile$
61 $open ifile$ libgcc2.list
62 $loop:
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
72 $flnm = "L"+flnm
73 $if flnm.eqs."L_exit" then goto loop1
74 $write sys$output "$ gcc/debug/define=""''flnm'"" LIBGCC2.C"
76 $objname = flnm
77 $if flnm.eqs."L_builtin_New" then objname = "L_builtin_nnew"
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.
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';
91 $ library libgcc2.olb 'objname'.obj,'objname'-c.obj
92 $ delete/nolog 'objname'.obj;,'objname'-c.obj;
94 $goto loop1
96 $! In case of error or abort, go here (In order to close file).
98 $c_err: !'f$verify(0)
99 $close ifile$
100 $ exit %x2c
102 $c_done:
103 $close ifile$
106 $ EXIT
107 $       !gcc-2.8.0: C++ libgcc2 code disabled since it's not adequately tested
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
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
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';
136 $ library libgcc2.olb 'objname'.obj,'objname'-c.obj
137 $ delete/nolog 'objname'.obj;,'objname'-c.obj;
139 $ goto cxx_file_loop
141 $cxx_done:
142 $ close ifile$
143 $ exit