Commit | Line | Data |
---|---|---|
eee7810f KR |
1 | #!/bin/sh |
2 | ||
3 | cat << 'EOF' | |
c412299f | 4 | $!make-gas.com |
eee7810f KR |
5 | $! Set the def dir to proper place for use in batch. Works for interactive to. |
6 | $flnm = f$enviroment("PROCEDURE") ! get current procedure name | |
7 | $set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")' | |
c0b8690d | 8 | $v = 'f$verify(0)' |
eee7810f KR |
9 | $! |
10 | $! Command file to build a GNU assembler on VMS | |
11 | $! | |
12 | $! If you are using a version of GCC that supports global constants | |
13 | $! you should remove the define="const=" from the gcc lines. | |
14 | $! | |
15 | $! Caution: Versions 1.38.1 and earlier had a bug in the handling of | |
16 | $! some static constants. If you are using such a version of the | |
17 | $! assembler, and you wish to compile without the "const=" hack, | |
18 | $! you should first build this version *with* the "const=" | |
19 | $! definition, and then use that assembler to rebuild it without the | |
20 | $! "const=" definition. Failure to do this will result in an assembler | |
21 | $! that will mung floating point constants. | |
22 | $! | |
23 | $! Note: The version of gas shipped on the GCC VMS tapes has been patched | |
24 | $! to fix the above mentioned bug. | |
25 | $! | |
26f4447a KR |
26 | $ !The gcc-vms driver was modified to use `-1' quite some time ago, |
27 | $ !so don't echo this text any more... | |
28 | $ !write sys$output "If this assembler is going to be used with GCC 1.n, you" | |
29 | $ !write sys$output "need to modify the driver to supply the -1 switch to gas." | |
30 | $ !write sys$output "This is required because of a small change in how global" | |
31 | $ !write sys$output "constant variables are handled. Failure to include this" | |
32 | $ !write sys$output "will result in linker warning messages about mismatched | |
33 | $ !write sys$output "psect attributes." | |
eee7810f | 34 | $! |
c412299f ILT |
35 | $ gas_host="vms" |
36 | $ arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 | |
37 | $ arch = f$element(arch_indx,"|","|VAX|Alpha|") | |
38 | $ if arch.eqs."VAX" | |
39 | $ then | |
40 | $ cpu_type="vax" | |
41 | $ obj_format="vms" | |
42 | $ atof="vax" | |
43 | $ else | |
44 | $ cpu_type="alpha" | |
45 | $ obj_format="evax" | |
46 | $ atof="ieee" | |
47 | $ endif | |
48 | $ emulation="generic" | |
49 | $! | |
50 | $ COPY = "copy/noLog" | |
51 | $! | |
eee7810f KR |
52 | $ C_DEFS :="""VMS""" |
53 | $! C_DEFS :="""VMS""","""const=""" | |
c0b8690d KR |
54 | $ C_INCLUDES = "/Include=([],[.config],[-.include],[-.include.aout])" |
55 | $ C_FLAGS = "/noVerbose/Debug" + c_includes | |
eee7810f KR |
56 | $! |
57 | $! | |
c0b8690d | 58 | $ on error then goto bail |
a088fb62 KR |
59 | $ if f$search("[-.libiberty]liberty.olb").eqs."" |
60 | $ then @[-.libiberty]vmsbuild.com | |
61 | $ write sys$output "Now building gas." | |
62 | $ endif | |
eee7810f KR |
63 | $ if "''p1'" .eqs. "LINK" then goto Link |
64 | $! | |
65 | $! This helps gcc 1.nn find the aout/* files. | |
66 | $! | |
67 | $ aout_dev = f$parse(flnm,,,"DEVICE") | |
68 | $ tmp = aout_dev - ":" | |
69 | $if f$trnlnm(tmp).nes."" then aout_dev = f$trnlnm(tmp) | |
70 | $ aout_dir = aout_dev+f$parse(flnm,,,"DIRECTORY")' - | |
71 | - "GAS]" + "INCLUDE.AOUT.]" - "][" | |
72 | $assign 'aout_dir' aout/tran=conc | |
73 | $ opcode_dir = aout_dev+f$parse(flnm,,,"DIRECTORY")' - | |
74 | - "GAS]" + "INCLUDE.OPCODE.]" - "][" | |
75 | $assign 'opcode_dir' opcode/tran=conc | |
76 | $! | |
c0b8690d KR |
77 | $ set verify |
78 | $! | |
c412299f ILT |
79 | $ gcc 'c_flags'/Define=('C_DEFS')/Object=[]tc-'cpu_type'.obj [.config]tc-'cpu_type'.c |
80 | $ gcc 'c_flags'/Define=('C_DEFS')/Object=[]obj-'obj_format'.obj [.config]obj-'obj_format'.c | |
81 | $ gcc 'c_flags'/Define=('C_DEFS')/Object=[]atof-'atof'.obj [.config]atof-'atof'.c | |
eee7810f KR |
82 | EOF |
83 | ||
84 | cfiles="`echo $* | sed -e 's/\.o/.c/g' -e 's!../\([^ /]*\)/\([^ /]*\.c\)![-.\1]\2!g'`" | |
85 | ||
86 | for cfile in $cfiles ; do | |
eee7810f | 87 | case $cfile in |
c92d9ee9 KR |
88 | "[-."*) |
89 | base=`echo $cfile | sed -e 's/\[.*\]//' -e 's/\.c$//'` | |
c0b8690d | 90 | echo "\$ gcc 'c_flags'/Define=('C_DEFS')/Object=[]$base.obj $cfile" |
c92d9ee9 KR |
91 | ;; |
92 | *) | |
c0b8690d | 93 | echo "\$ gcc 'c_flags'/Define=('C_DEFS') $cfile" |
c92d9ee9 | 94 | ;; |
eee7810f KR |
95 | esac |
96 | done | |
97 | ||
eee7810f | 98 | cat << 'EOF' |
c92d9ee9 | 99 | $link: |
c0b8690d | 100 | $!'f$verify(0)' |
c412299f ILT |
101 | $ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ |
102 | $ create gcc-as.opt | |
eee7810f KR |
103 | ! |
104 | ! Linker options file for GNU assembler | |
105 | ! | |
c412299f ILT |
106 | $ open/Append ifile$ gcc-as.opt |
107 | $ write ifile$ "tc-''cpu_type'.obj" | |
108 | $ write ifile$ "obj-''obj_format'.obj" | |
109 | $ write ifile$ "atof-''atof'.obj" | |
110 | $ COPY sys$input: ifile$: | |
eee7810f KR |
111 | EOF |
112 | ||
113 | for obj in $* ; do | |
c92d9ee9 KR |
114 | # Change "foo.o" into "foo.obj". |
115 | echo ${obj}bj,- | sed 's!.*/!!g' | |
eee7810f KR |
116 | done |
117 | ||
118 | cat << 'EOF' | |
a088fb62 | 119 | [-.libiberty]liberty.olb/Lib |
c0b8690d | 120 | gnu_cc:[000000]gcclib.olb/Lib,sys$library:vaxcrtl.olb/Lib |
c92d9ee9 | 121 | ! Tell linker exactly what psect attributes we want -- match VAXCRTL. |
c06e55d9 | 122 | psect_attr=ENVIRON,long,pic,ovr,rel,gbl,noshr,noexe,rd,wrt |
c412299f ILT |
123 | $ close ifile$ |
124 | $ set verify=(Proc,noImag) | |
125 | $ link/noMap/Exec=gcc-as.exe gcc-as.opt/Opt,version.opt/Opt | |
c0b8690d KR |
126 | $! |
127 | $bail: exit $status + 0*f$verify(v) !'f$verify(0)' | |
eee7810f | 128 | EOF |