Separate entries for common file changes so the automerge can find them.
[binutils.git] / gas / vmsconf.sh
blob014538a154e6ddb82e64e8a9fa0cf9b00a2c262e
1 #!/bin/sh
3 cat << 'EOF'
4 $!make-gas.com
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")'
8 $v = 'f$verify(0)'
9 $!
10 $! Command file to build a GNU assembler on VMS
12 $! If you are using a version of GCC that supports global constants
13 $! you should remove the define="const=" from the gcc lines.
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.
23 $! Note: The version of gas shipped on the GCC VMS tapes has been patched
24 $! to fix the above mentioned bug.
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."
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"
50 $ COPY = "copy/noLog"
52 $ C_DEFS :="""VMS"""
53 $! C_DEFS :="""VMS""","""const="""
54 $ C_INCLUDES = "/Include=([],[.config],[-.include],[-.include.aout])"
55 $ C_FLAGS = "/noVerbose/Debug" + c_includes
58 $ on error then goto bail
59 $ if f$search("[-.libiberty]liberty.olb").eqs.""
60 $ then @[-.libiberty]vmsbuild.com
61 $ write sys$output "Now building gas."
62 $ endif
63 $ if "''p1'" .eqs. "LINK" then goto Link
65 $! This helps gcc 1.nn find the aout/* files.
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
77 $ set verify
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
82 EOF
84 cfiles="`echo $* | sed -e 's/\.o/.c/g' -e 's!../\([^ /]*\)/\([^ /]*\.c\)![-.\1]\2!g'`"
86 for cfile in $cfiles ; do
87 case $cfile in
88 "[-."*)
89 base=`echo $cfile | sed -e 's/\[.*\]//' -e 's/\.c$//'`
90 echo "\$ gcc 'c_flags'/Define=('C_DEFS')/Object=[]$base.obj $cfile"
93 echo "\$ gcc 'c_flags'/Define=('C_DEFS') $cfile"
95 esac
96 done
98 cat << 'EOF'
99 $link:
100 $!'f$verify(0)'
101 $ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$
102 $ create gcc-as.opt
104 ! Linker options file for GNU assembler
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$:
113 for obj in $* ; do
114 # Change "foo.o" into "foo.obj".
115 echo ${obj}bj,- | sed 's!.*/!!g'
116 done
118 cat << 'EOF'
119 [-.libiberty]liberty.olb/Lib
120 gnu_cc:[000000]gcclib.olb/Lib,sys$library:vaxcrtl.olb/Lib
121 ! Tell linker exactly what psect attributes we want -- match VAXCRTL.
122 psect_attr=ENVIRON,long,pic,ovr,rel,gbl,noshr,noexe,rd,wrt
123 $ close ifile$
124 $ set verify=(Proc,noImag)
125 $ link/noMap/Exec=gcc-as.exe gcc-as.opt/Opt,version.opt/Opt
127 $bail: exit $status + 0*f$verify(v) !'f$verify(0)'