| @@ -1,635 +1,640 @@ | | | @@ -1,635 +1,640 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # $NetBSD: mknative-gcc,v 1.42 2009/12/01 03:13:26 uebayasi Exp $ | | 2 | # $NetBSD: mknative-gcc,v 1.43 2009/12/01 04:59:24 uebayasi Exp $ |
3 | # | | 3 | # |
4 | # Shell script for generating all the constants needed for a native | | 4 | # Shell script for generating all the constants needed for a native |
5 | # platform build of src/gnu/dist/gcc. | | 5 | # platform build of src/gnu/dist/gcc. |
6 | # | | 6 | # |
7 | | | 7 | |
8 | # initialise | | 8 | # initialise |
9 | | | 9 | |
10 | _TMPDIR=$2 | | 10 | _TMPDIR=$2 |
11 | _TOP=$3 | | 11 | _TOP=$3 |
12 | _PLATFORM=$4 | | 12 | _PLATFORM=$4 |
13 | _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` | | 13 | _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` |
14 | _GNU_DIST=`cd ${_VPATH}; pwd` | | 14 | _GNU_DIST=`cd ${_VPATH}; pwd` |
15 | | | 15 | |
16 | . $_TOP/tools/gcc/mknative.common | | 16 | . $_TOP/tools/gcc/mknative.common |
17 | | | 17 | |
18 | ##### gnu/lib/crtstuff ##### | | 18 | ##### gnu/lib/crtstuff ##### |
19 | | | 19 | |
20 | get_crtstuff () { | | 20 | get_crtstuff () { |
21 | _subdir="$1" | | 21 | _subdir="$1" |
22 | mkdir -p $_TOP/gnu/lib/$_subdir/arch | | 22 | mkdir -p $_TOP/gnu/lib/$_subdir/arch |
23 | | | 23 | |
24 | getvars gcc/Makefile \ | | 24 | getvars gcc/Makefile \ |
25 | INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS \ | | 25 | INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS \ |
26 | tm_defines xm_file xm_defines \ | | 26 | tm_defines xm_file xm_defines \ |
27 | | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH.mk | | 27 | | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH.mk |
28 | } | | 28 | } |
29 | | | 29 | |
30 | ##### gnu/lib/libg2c ##### | | 30 | ##### gnu/lib/libg2c ##### |
31 | | | 31 | |
32 | get_libg2c () { | | 32 | get_libg2c () { |
33 | mkdir -p $_TOP/gnu/lib/libg2c3/arch/$MACHINE_ARCH | | 33 | mkdir -p $_TOP/gnu/lib/libg2c3/arch/$MACHINE_ARCH |
34 | | | 34 | |
35 | write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h | | 35 | write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h |
36 | write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h | | 36 | write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h |
37 | | | 37 | |
38 | { | | 38 | { |
39 | getvars $_PLATFORM/libf2c/Makefile \ | | 39 | getvars $_PLATFORM/libf2c/Makefile \ |
40 | F2CEXT | | 40 | F2CEXT |
41 | getvars $_PLATFORM/libf2c/libF77/Makefile \ | | 41 | getvars $_PLATFORM/libf2c/libF77/Makefile \ |
42 | ALL_CFLAGS OBJS | | 42 | ALL_CFLAGS OBJS |
43 | getvars $_PLATFORM/libf2c/libI77/Makefile \ | | 43 | getvars $_PLATFORM/libf2c/libI77/Makefile \ |
44 | ALL_CFLAGS OBJS | sed 's,=,+=,' | | 44 | ALL_CFLAGS OBJS | sed 's,=,+=,' |
45 | getvars $_PLATFORM/libf2c/libU77/Makefile \ | | 45 | getvars $_PLATFORM/libf2c/libU77/Makefile \ |
46 | ALL_CFLAGS OBJS | sed 's,=,+=,' | | 46 | ALL_CFLAGS OBJS | sed 's,=,+=,' |
47 | } | write_mk gnu/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk | | 47 | } | write_mk gnu/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk |
48 | } | | 48 | } |
49 | | | 49 | |
50 | ##### gnu/lib/libgcc ##### | | 50 | ##### gnu/lib/libgcc ##### |
51 | | | 51 | |
52 | get_libgcc_list_funcs_asm () { | | 52 | get_libgcc_list_funcs_asm () { |
53 | { | | 53 | { |
54 | getvars gcc/Makefile LIB1ASMFUNCS | { | | 54 | getvars gcc/Makefile LIB1ASMFUNCS | { |
55 | # print newline separated list | | 55 | # print newline separated list |
56 | sed -e ' | | 56 | sed -e ' |
57 | s,^.*=,, | | 57 | s,^.*=,, |
58 | s, *$,, | | 58 | s, *$,, |
59 | s, *, ,g | | 59 | s, *, ,g |
60 | s, ,\ | | 60 | s, ,\ |
61 | ,g' | | 61 | ,g' |
62 | } | | 62 | } |
63 | getvars gcc/Makefile LIB2FUNCS_EXTRA | { | | 63 | getvars gcc/Makefile LIB2FUNCS_EXTRA | { |
64 | # print newline separated list | | 64 | # print newline separated list |
65 | sed -e ' | | 65 | sed -e ' |
66 | s,^.*=,, | | 66 | s,^.*=,, |
67 | s, *$,, | | 67 | s, *$,, |
68 | s, *, ,g | | 68 | s, *, ,g |
69 | s, ,\ | | 69 | s, ,\ |
70 | ,g' | \ | | 70 | ,g' | \ |
71 | sed -ne ' | | 71 | sed -ne ' |
72 | /\.S$/ { s,^.*/,,; s,\.S$,,; p; } | | 72 | /\.S$/ { s,^.*/,,; s,\.S$,,; p; } |
73 | /\.asm$/ { s,^.*/,,; s,\.asm$,,; p; } | | 73 | /\.asm$/ { s,^.*/,,; s,\.asm$,,; p; } |
74 | ' | | 74 | ' |
75 | } | | 75 | } |
76 | } | { | | 76 | } | { |
77 | # print foo and foo_s | | 77 | # print foo and foo_s |
78 | sed -ne ' | | 78 | sed -ne ' |
79 | /./ { | | 79 | /./ { |
80 | p | | 80 | p |
81 | s,$,_s, | | 81 | s,$,_s, |
82 | p | | 82 | p |
83 | } | | 83 | } |
84 | ' | | 84 | ' |
85 | } | sort | | 85 | } | sort |
86 | } | | 86 | } |
87 | | | 87 | |
88 | get_libgcc_list_funcs_lib () { | | 88 | get_libgcc_list_funcs_lib () { |
89 | local _lib=$1 | | 89 | local _lib=$1 |
90 | local _lib_prefix=${_lib%.*} | | 90 | local _lib_prefix=${_lib%.*} |
91 | local _lib_suffix=${_lib#*.} | | 91 | local _lib_suffix=${_lib#*.} |
92 | | | 92 | |
| | | 93 | cat build/gcc/libgcc.mk | \ |
| | | 94 | grep -v '/32/' | \ |
93 | sed -ne ' | | 95 | sed -ne ' |
94 | /^\.\/'${_lib_prefix}'\.'${_lib_suffix}': .*\.o$/ { | | 96 | /^\.\/'${_lib_prefix}'\.'${_lib_suffix}': .*\.o$/ { |
95 | s,^.*/,, | | 97 | s,^.*/,, |
96 | s,\.o$,, | | 98 | s,\.o$,, |
97 | p | | 99 | p |
98 | } | | 100 | } |
99 | ' build/gcc/libgcc.mk | sort | | 101 | ' | sort |
100 | } | | 102 | } |
101 | | | 103 | |
102 | get_libgcc_list_objs_libs () { | | 104 | get_libgcc_list_objs_libs () { |
103 | cat build/gcc/libgcc.mk | \ | | 105 | cat build/gcc/libgcc.mk | \ |
| | | 106 | grep -v '/32/' | \ |
104 | egrep '^\.\/(libgcc_s\.so|libgcc\.a|libgcc_eh\.a|libgcov\.a): (libgcc_s|libgcc|libgcc_eh|libgcov)\/.*\.o$' | \ | | 107 | egrep '^\.\/(libgcc_s\.so|libgcc\.a|libgcc_eh\.a|libgcov\.a): (libgcc_s|libgcc|libgcc_eh|libgcov)\/.*\.o$' | \ |
105 | sed -e ' | | 108 | sed -e ' |
106 | s,^\.\/,, | | 109 | s,^\.\/,, |
107 | s,: .*/, , | | 110 | s,: .*/, , |
108 | s,^\(.*\) \(.*\)$,\2 \1, | | 111 | s,^\(.*\) \(.*\)$,\2 \1, |
109 | ' | sort | | 112 | ' | sort |
110 | } | | 113 | } |
111 | | | 114 | |
112 | get_libgcc_list_objs_srcs () { | | 115 | get_libgcc_list_objs_srcs () { |
113 | if [ -e $_TOP/${libgcc_db_funcs}.S ]; then | | 116 | if [ -e $_TOP/${libgcc_db_funcs}.S ]; then |
114 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ | | 117 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ |
115 | comm -23 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \ | | 118 | comm -23 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \ |
116 | sed -e 's,\(.*\),\1.o \1.c,' | | 119 | sed -e 's,\(.*\),\1.o \1.c,' |
117 | | | 120 | |
118 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ | | 121 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ |
119 | comm -12 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \ | | 122 | comm -12 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \ |
120 | sed -e 's,\(.*\),\1.o \1.S,' | | 123 | sed -e 's,\(.*\),\1.o \1.S,' |
121 | else | | 124 | else |
122 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ | | 125 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ |
123 | sed -e 's,\(.*\),\1.o \1.c,' | | 126 | sed -e 's,\(.*\),\1.o \1.c,' |
124 | fi | sort | | 127 | fi | sort |
125 | } | | 128 | } |
126 | | | 129 | |
127 | get_libgcc_list_objs_tmplsrcs () { | | 130 | get_libgcc_list_objs_tmplsrcs () { |
128 | grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \ | | 131 | grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \ |
| | | 132 | grep -v '/32/' | \ |
129 | sed -ne ' | | 133 | sed -ne ' |
130 | s,^.* -c \([^ ]*\).* -o .*/\([^ ]*\.o\)$,\2 \1, | | 134 | s,^.* -c \([^ ]*\).* -o .*/\([^ ]*\.o\)$,\2 \1, |
131 | # basename | | 135 | # basename |
132 | /\$/ { s,\$.*/,,; } | | 136 | /\$/ { s,\$.*/,,; } |
133 | /\// { s,\/.*/,,; } | | 137 | /\// { s,\/.*/,,; } |
134 | p | | 138 | p |
135 | ' | sort | | 139 | ' | sort -u |
136 | } | | 140 | } |
137 | | | 141 | |
138 | get_libgcc_list_objs_xflags () { | | 142 | get_libgcc_list_objs_xflags () { |
139 | local _flags=$1 | | 143 | local _flags=$1 |
140 | | | 144 | |
141 | grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \ | | 145 | grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \ |
| | | 146 | grep -v '/32/' | \ |
142 | sed -n ' | | 147 | sed -n ' |
143 | x | | 148 | x |
144 | :loop | | 149 | :loop |
145 | g | | 150 | g |
146 | s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\5 \2/p | | 151 | s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\5 \2/p |
147 | g | | 152 | g |
148 | s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\1 \3 \4\/\5/ | | 153 | s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\1 \3 \4\/\5/ |
149 | h | | 154 | h |
150 | t loop | | 155 | t loop |
151 | ' | sort | | 156 | ' | sort |
152 | } | | 157 | } |
153 | | | 158 | |
154 | get_libgcc_list_objs_cppflags () { | | 159 | get_libgcc_list_objs_cppflags () { |
155 | get_libgcc_list_objs_xflags D | | 160 | get_libgcc_list_objs_xflags D |
156 | } | | 161 | } |
157 | | | 162 | |
158 | get_libgcc_list_objs_copts () { | | 163 | get_libgcc_list_objs_copts () { |
159 | get_libgcc_list_objs_xflags fmx | | 164 | get_libgcc_list_objs_xflags fmx |
160 | } | | 165 | } |
161 | | | 166 | |
162 | get_libgcc_list_tmplsrcs () { | | 167 | get_libgcc_list_tmplsrcs () { |
163 | local _lib=$1 | | 168 | local _lib=$1 |
164 | local _tmplallsrcs=$( mktemp /tmp/mknative-gcc._tmplallsrcs.XXXXXX ) | | 169 | local _tmplallsrcs=$( mktemp /tmp/mknative-gcc._tmplallsrcs.XXXXXX ) |
165 | | | 170 | |
166 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} | | 171 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} |
167 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | | 172 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} |
168 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | | 173 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} |
169 | | | 174 | |
170 | # all files | | 175 | # all files |
171 | local _lib_prefix=${_lib%.*} | | 176 | local _lib_prefix=${_lib%.*} |
172 | local _lib_suffix=${_lib#*.} | | 177 | local _lib_suffix=${_lib#*.} |
173 | join $_TOP/$libgcc_db_objs_libs $_TOP/$libgcc_db_objs_tmplsrcs | \ | | 178 | join $_TOP/$libgcc_db_objs_libs $_TOP/$libgcc_db_objs_tmplsrcs | \ |
174 | grep ${_lib_prefix}'\.'${_lib_suffix} | cut -d' ' -f 3 | sort -u > \ | | 179 | grep ${_lib_prefix}'\.'${_lib_suffix} | cut -d' ' -f 3 | sort -u > \ |
175 | $_tmplallsrcs | | 180 | $_tmplallsrcs |
176 | | | 181 | |
177 | # TMPLFPSRCS = [fdp]p-bit.c | | 182 | # TMPLFPSRCS = [fdp]p-bit.c |
178 | grep '[fdt]p-bit\.c' <$_tmplallsrcs | sort -u | \ | | 183 | grep '[fdt]p-bit\.c' <$_tmplallsrcs | sort -u | \ |
179 | writefile ${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | | 184 | writefile ${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} |
180 | | | 185 | |
181 | # TMPLASMSRCS = $(LIB1ASMSRC) | | 186 | # TMPLASMSRCS = $(LIB1ASMSRC) |
182 | grep '\$(LIB1ASMSRC)' <$_tmplallsrcs | sort -u | \ | | 187 | grep '\$(LIB1ASMSRC)' <$_tmplallsrcs | sort -u | \ |
183 | writefile ${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | | 188 | writefile ${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} |
184 | | | 189 | |
185 | # TMPLSRCS is anything else; exclude TMPLFPSRCS and TMPLASMSRCS | | 190 | # TMPLSRCS is anything else; exclude TMPLFPSRCS and TMPLASMSRCS |
186 | cat $_tmplallsrcs | \ | | 191 | cat $_tmplallsrcs | \ |
187 | comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | \ | | 192 | comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | \ |
188 | comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \ | | 193 | comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \ |
189 | writefile ${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} | | 194 | writefile ${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} |
190 | | | 195 | |
191 | rm -f $_tmplallsrcs | | 196 | rm -f $_tmplallsrcs |
192 | } | | 197 | } |
193 | | | 198 | |
194 | get_libgcc_new_analyze () { | | 199 | get_libgcc_new_analyze () { |
195 | mkdir -p $_TOP/${_machine_arch_subdir} | | 200 | mkdir -p $_TOP/${_machine_arch_subdir} |
196 | | | 201 | |
197 | touch $_TOP/${libgcc_db_funcs}.S | | 202 | touch $_TOP/${libgcc_db_funcs}.S |
198 | get_libgcc_list_funcs_asm | \ | | 203 | get_libgcc_list_funcs_asm | \ |
199 | writefile ${libgcc_db_funcs}.S | | 204 | writefile ${libgcc_db_funcs}.S |
200 | | | 205 | |
201 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do | | 206 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do |
202 | touch $_TOP/${libgcc_db_funcs}.${_lib%.*} | | 207 | touch $_TOP/${libgcc_db_funcs}.${_lib%.*} |
203 | get_libgcc_list_funcs_lib $_lib | \ | | 208 | get_libgcc_list_funcs_lib $_lib | \ |
204 | writefile ${libgcc_db_funcs}.${_lib%.*} | | 209 | writefile ${libgcc_db_funcs}.${_lib%.*} |
205 | done | | 210 | done |
206 | | | 211 | |
207 | get_libgcc_list_objs_libs | writefile ${libgcc_db_objs_libs} | | 212 | get_libgcc_list_objs_libs | writefile ${libgcc_db_objs_libs} |
208 | get_libgcc_list_objs_srcs | writefile ${libgcc_db_objs_srcs} | | 213 | get_libgcc_list_objs_srcs | writefile ${libgcc_db_objs_srcs} |
209 | get_libgcc_list_objs_tmplsrcs | writefile ${libgcc_db_objs_tmplsrcs} | | 214 | get_libgcc_list_objs_tmplsrcs | writefile ${libgcc_db_objs_tmplsrcs} |
210 | get_libgcc_list_objs_cppflags | writefile ${libgcc_db_objs_cppflags} | | 215 | get_libgcc_list_objs_cppflags | writefile ${libgcc_db_objs_cppflags} |
211 | get_libgcc_list_objs_copts | writefile ${libgcc_db_objs_copts} | | 216 | get_libgcc_list_objs_copts | writefile ${libgcc_db_objs_copts} |
212 | | | 217 | |
213 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do | | 218 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do |
214 | get_libgcc_list_tmplsrcs $_lib | | 219 | get_libgcc_list_tmplsrcs $_lib |
215 | done | | 220 | done |
216 | } | | 221 | } |
217 | | | 222 | |
218 | ##### | | 223 | ##### |
219 | | | 224 | |
220 | get_libgcc_gen_tmplsrcs_tmplsrcs () { | | 225 | get_libgcc_gen_tmplsrcs_tmplsrcs () { |
221 | local _lib=$1 | | 226 | local _lib=$1 |
222 | | | 227 | |
223 | printf '\n' | | 228 | printf '\n' |
224 | printf 'TMPLSRCS.%s = \\\n' $_lib | | 229 | printf 'TMPLSRCS.%s = \\\n' $_lib |
225 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} | | 230 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} |
226 | } | | 231 | } |
227 | | | 232 | |
228 | get_libgcc_gen_tmplsrcs_tmplfpsrcs () { | | 233 | get_libgcc_gen_tmplsrcs_tmplfpsrcs () { |
229 | local _lib=$1 | | 234 | local _lib=$1 |
230 | | | 235 | |
231 | printf '\n' | | 236 | printf '\n' |
232 | printf 'TMPLFPSRCS.%s = \\\n' $_lib | | 237 | printf 'TMPLFPSRCS.%s = \\\n' $_lib |
233 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | | 238 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} |
234 | } | | 239 | } |
235 | | | 240 | |
236 | get_libgcc_gen_tmplsrcs_tmplasmsrcs () { | | 241 | get_libgcc_gen_tmplsrcs_tmplasmsrcs () { |
237 | local _lib=$1 | | 242 | local _lib=$1 |
238 | | | 243 | |
239 | printf '\n' | | 244 | printf '\n' |
240 | printf 'TMPLASMSRCS.%s = \\\n' $_lib | | 245 | printf 'TMPLASMSRCS.%s = \\\n' $_lib |
241 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \ | | 246 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \ |
242 | sed -e 's,LIB1ASMSRC,G_&,' | | 247 | sed -e 's,LIB1ASMSRC,G_&,' |
243 | } | | 248 | } |
244 | | | 249 | |
245 | get_libgcc_gen_srcs () { | | 250 | get_libgcc_gen_srcs () { |
246 | local _lib=$1 | | 251 | local _lib=$1 |
247 | | | 252 | |
248 | printf '\n' | | 253 | printf '\n' |
249 | printf 'SRCS.%s = \\\n' $_lib | | 254 | printf 'SRCS.%s = \\\n' $_lib |
250 | if [ -e $_TOP/${libgcc_db_funcs}.S ]; then | | 255 | if [ -e $_TOP/${libgcc_db_funcs}.S ]; then |
251 | comm -23 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \ | | 256 | comm -23 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \ |
252 | sed -e 's,$,.c,; s,^,tmp_,' | | 257 | sed -e 's,$,.c,; s,^,tmp_,' |
253 | comm -12 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \ | | 258 | comm -12 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \ |
254 | sed -e 's,$,.S,; s,^,tmp_,' | | 259 | sed -e 's,$,.S,; s,^,tmp_,' |
255 | else | | 260 | else |
256 | cat $_TOP/${libgcc_db_funcs}.${_lib%.*} | \ | | 261 | cat $_TOP/${libgcc_db_funcs}.${_lib%.*} | \ |
257 | sed -e 's,$,.c,; s,^,tmp_,' | | 262 | sed -e 's,$,.c,; s,^,tmp_,' |
258 | fi | sort | \ | | 263 | fi | sort | \ |
259 | sed -e 's,^, ,; s,$, \\,' | | 264 | sed -e 's,^, ,; s,$, \\,' |
260 | } | | 265 | } |
261 | | | 266 | |
262 | _lookup_objs () { | | 267 | _lookup_objs () { |
263 | local _obj=$1; local _key=$2 | | 268 | local _obj=$1; local _key=$2 |
264 | | | 269 | |
265 | eval grep \^$_obj\\\ \$_TOP/\${libgcc_db_objs_${_key}} | cut -f2 | | 270 | eval grep \^$_obj\\\ \$_TOP/\${libgcc_db_objs_${_key}} | cut -f2 |
266 | } | | 271 | } |
267 | | | 272 | |
268 | get_libgcc_gen_srcs_tmplsrcs () { | | 273 | get_libgcc_gen_srcs_tmplsrcs () { |
269 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ | | 274 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ |
270 | while read _obj; do | | 275 | while read _obj; do |
271 | printf 'SRCS.tmp_%s=%s\n' \ | | 276 | printf 'SRCS.tmp_%s=%s\n' \ |
272 | "$( _lookup_objs $_obj srcs )" \ | | 277 | "$( _lookup_objs $_obj srcs )" \ |
273 | "$( _lookup_objs $_obj tmplsrcs )" | | 278 | "$( _lookup_objs $_obj tmplsrcs )" |
274 | done | \ | | 279 | done | \ |
275 | sed -e 's,\$(\(.*\)),${G_\1},' | | 280 | sed -e 's,\$(\(.*\)),${G_\1},' |
276 | } | | 281 | } |
277 | | | 282 | |
278 | get_libgcc_gen_srcs_cppflags () { | | 283 | get_libgcc_gen_srcs_cppflags () { |
279 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ | | 284 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ |
280 | while read _obj; do | | 285 | while read _obj; do |
281 | printf '_CPPFLAGS.tmp_%s=%s\n' \ | | 286 | printf '_CPPFLAGS.tmp_%s=%s\n' \ |
282 | "$( _lookup_objs $_obj srcs )" \ | | 287 | "$( _lookup_objs $_obj srcs )" \ |
283 | "$( _lookup_objs $_obj cppflags | xargs )" | | 288 | "$( _lookup_objs $_obj cppflags | xargs )" |
284 | done | | 289 | done |
285 | } | | 290 | } |
286 | | | 291 | |
287 | get_libgcc_gen_srcs_copts () { | | 292 | get_libgcc_gen_srcs_copts () { |
288 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ | | 293 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ |
289 | while read _obj; do | | 294 | while read _obj; do |
290 | printf 'COPTS.tmp_%s=%s\n' \ | | 295 | printf 'COPTS.tmp_%s=%s\n' \ |
291 | "$( _lookup_objs $_obj srcs )" \ | | 296 | "$( _lookup_objs $_obj srcs )" \ |
292 | "$( _lookup_objs $_obj copts | xargs )" | | 297 | "$( _lookup_objs $_obj copts | xargs )" |
293 | done | | 298 | done |
294 | } | | 299 | } |
295 | | | 300 | |
296 | get_libgcc_new_generate () { | | 301 | get_libgcc_new_generate () { |
297 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do | | 302 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do |
298 | for _tmpl in tmplsrcs tmplfpsrcs tmplasmsrcs; do | | 303 | for _tmpl in tmplsrcs tmplfpsrcs tmplasmsrcs; do |
299 | eval get_libgcc_gen_tmplsrcs_${_tmpl} $_lib | \ | | 304 | eval get_libgcc_gen_tmplsrcs_${_tmpl} $_lib | \ |
300 | write_mk ${libgcc_libs_mk}.${_lib%.*}.tmplsrcs.${_tmpl}.mk | | 305 | write_mk ${libgcc_libs_mk}.${_lib%.*}.tmplsrcs.${_tmpl}.mk |
301 | done | | 306 | done |
302 | | | 307 | |
303 | get_libgcc_gen_srcs $_lib | \ | | 308 | get_libgcc_gen_srcs $_lib | \ |
304 | write_mk ${libgcc_libs_mk}.${_lib%.*}.srcs.mk | | 309 | write_mk ${libgcc_libs_mk}.${_lib%.*}.srcs.mk |
305 | done | | 310 | done |
306 | | | 311 | |
307 | for _arg in tmplsrcs cppflags copts; do | | 312 | for _arg in tmplsrcs cppflags copts; do |
308 | eval get_libgcc_gen_srcs_${_arg} | \ | | 313 | eval get_libgcc_gen_srcs_${_arg} | \ |
309 | eval writefile \$libgcc_srcs_mk_${_arg} | | 314 | eval writefile \$libgcc_srcs_mk_${_arg} |
310 | done | | 315 | done |
311 | } | | 316 | } |
312 | | | 317 | |
313 | ##### | | 318 | ##### |
314 | | | 319 | |
315 | get_libgcc_new () { | | 320 | get_libgcc_new () { |
316 | _subdir="$1" | | 321 | _subdir="$1" |
317 | | | 322 | |
318 | # List of generated files. | | 323 | # List of generated files. |
319 | | | 324 | |
320 | _machine_arch_subdir=gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH | | 325 | _machine_arch_subdir=gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH |
321 | | | 326 | |
322 | libgcc_db_funcs=${_machine_arch_subdir}/funcs | | 327 | libgcc_db_funcs=${_machine_arch_subdir}/funcs |
323 | libgcc_db_tmplsrcs=${_machine_arch_subdir}/tmplsrcs | | 328 | libgcc_db_tmplsrcs=${_machine_arch_subdir}/tmplsrcs |
324 | libgcc_db_objs_libs=${_machine_arch_subdir}/objs.libs | | 329 | libgcc_db_objs_libs=${_machine_arch_subdir}/objs.libs |
325 | libgcc_db_objs_srcs=${_machine_arch_subdir}/objs.srcs | | 330 | libgcc_db_objs_srcs=${_machine_arch_subdir}/objs.srcs |
326 | libgcc_db_objs_tmplsrcs=${_machine_arch_subdir}/objs.tmplsrcs | | 331 | libgcc_db_objs_tmplsrcs=${_machine_arch_subdir}/objs.tmplsrcs |
327 | libgcc_db_objs_cppflags=${_machine_arch_subdir}/objs.cppflags | | 332 | libgcc_db_objs_cppflags=${_machine_arch_subdir}/objs.cppflags |
328 | libgcc_db_objs_copts=${_machine_arch_subdir}/objs.copts | | 333 | libgcc_db_objs_copts=${_machine_arch_subdir}/objs.copts |
329 | | | 334 | |
330 | get_libgcc_new_analyze | | 335 | get_libgcc_new_analyze |
331 | | | 336 | |
332 | libgcc_libs_mk=${_machine_arch_subdir}/libs | | 337 | libgcc_libs_mk=${_machine_arch_subdir}/libs |
333 | libgcc_srcs_mk=${_machine_arch_subdir}/srcs.mk | | 338 | libgcc_srcs_mk=${_machine_arch_subdir}/srcs.mk |
334 | libgcc_srcs_mk_tmplsrcs=${_machine_arch_subdir}/srcs.tmplsrcs.mk | | 339 | libgcc_srcs_mk_tmplsrcs=${_machine_arch_subdir}/srcs.tmplsrcs.mk |
335 | libgcc_srcs_mk_cppflags=${_machine_arch_subdir}/srcs.cppflags.mk | | 340 | libgcc_srcs_mk_cppflags=${_machine_arch_subdir}/srcs.cppflags.mk |
336 | libgcc_srcs_mk_copts=${_machine_arch_subdir}/srcs.copts.mk | | 341 | libgcc_srcs_mk_copts=${_machine_arch_subdir}/srcs.copts.mk |
337 | | | 342 | |
338 | get_libgcc_new_generate | | 343 | get_libgcc_new_generate |
339 | } | | 344 | } |
340 | | | 345 | |
341 | get_libgcc () { | | 346 | get_libgcc () { |
342 | _subdir="$1" | | 347 | _subdir="$1" |
343 | mkdir -p $_TOP/gnu/lib/lib$_subdir/arch | | 348 | mkdir -p $_TOP/gnu/lib/lib$_subdir/arch |
344 | | | 349 | |
345 | case "$_subdir" in | | 350 | case "$_subdir" in |
346 | gcc3) | | 351 | gcc3) |
347 | _extravars="USE_COLLECT2 LIB2FUNCS_1 LIB2FUNCS_2 xm_file" | | 352 | _extravars="USE_COLLECT2 LIB2FUNCS_1 LIB2FUNCS_2 xm_file" |
348 | _archsubdir="" | | 353 | _archsubdir="" |
349 | ;; | | 354 | ;; |
350 | gcc4) | | 355 | gcc4) |
351 | _extravars="COLLECT2 UNWIND_H xm_include_list" | | 356 | _extravars="COLLECT2 UNWIND_H xm_include_list" |
352 | _archsubdir="" | | 357 | _archsubdir="" |
353 | ;; | | 358 | ;; |
354 | esac | | 359 | esac |
355 | | | 360 | |
356 | # DPBIT, FPBIT only used on mn10[23]00, we don't need them. | | 361 | # DPBIT, FPBIT only used on mn10[23]00, we don't need them. |
357 | # XXX we should probably grab everything Just In Case for | | 362 | # XXX we should probably grab everything Just In Case for |
358 | # the future. | | 363 | # the future. |
359 | { | | 364 | { |
360 | getvars gcc/Makefile \ | | 365 | getvars gcc/Makefile \ |
361 | INCLUDES LIB2ADD LIB2ADDEH \ | | 366 | INCLUDES LIB2ADD LIB2ADDEH \ |
362 | LIB1ASMFUNCS LIB1ASMSRC \ | | 367 | LIB1ASMFUNCS LIB1ASMSRC \ |
363 | LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \ | | 368 | LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \ |
364 | LIB2FUNCS_EXTRA \ | | 369 | LIB2FUNCS_EXTRA \ |
365 | LIBGCC2_CFLAGS \ | | 370 | LIBGCC2_CFLAGS \ |
366 | SHLIB_MKMAP SHLIB_MKMAP_OPTS \ | | 371 | SHLIB_MKMAP SHLIB_MKMAP_OPTS \ |
367 | SHLIB_MAPFILES SHLIB_NM_FLAGS \ | | 372 | SHLIB_MAPFILES SHLIB_NM_FLAGS \ |
368 | EXTRA_HEADERS xm_defines \ | | 373 | EXTRA_HEADERS xm_defines \ |
369 | tm_defines ${_extravars} | | 374 | tm_defines ${_extravars} |
370 | } | write_mk gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk | | 375 | } | write_mk gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk |
371 | | | 376 | |
372 | # Generate new style files. | | 377 | # Generate new style files. |
373 | if [ -n "${MKNATIVE_LIBGCC_NEW}" ]; then | | 378 | if [ -n "${MKNATIVE_LIBGCC_NEW}" ]; then |
374 | get_libgcc_new $_subdir | | 379 | get_libgcc_new $_subdir |
375 | fi | | 380 | fi |
376 | } | | 381 | } |
377 | | | 382 | |
378 | ##### gnu/lib/libgcov ##### | | 383 | ##### gnu/lib/libgcov ##### |
379 | | | 384 | |
380 | get_libgcov () { | | 385 | get_libgcov () { |
381 | _subdir="$1" | | 386 | _subdir="$1" |
382 | | | 387 | |
383 | mkdir -p $_TOP/gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH | | 388 | mkdir -p $_TOP/gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH |
384 | | | 389 | |
385 | { | | 390 | { |
386 | getvars gcc/Makefile \ | | 391 | getvars gcc/Makefile \ |
387 | LIBGCOV | | 392 | LIBGCOV |
388 | } | write_mk gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk | | 393 | } | write_mk gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk |
389 | | | 394 | |
390 | write_c gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ | | 395 | write_c gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ |
391 | <$_TMPDIR/gcc/gcov-iov.h | | 396 | <$_TMPDIR/gcc/gcov-iov.h |
392 | | | 397 | |
393 | } | | 398 | } |
394 | | | 399 | |
395 | ##### gnu/usr.bin/gcc[34]/libiberty ##### | | 400 | ##### gnu/usr.bin/gcc[34]/libiberty ##### |
396 | | | 401 | |
397 | get_gcc_libiberty () { | | 402 | get_gcc_libiberty () { |
398 | _subdir="$1" | | 403 | _subdir="$1" |
399 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH | | 404 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH |
400 | | | 405 | |
401 | getvars libiberty/Makefile \ | | 406 | getvars libiberty/Makefile \ |
402 | ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ | | 407 | ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ |
403 | | write_mk gnu/usr.bin/$_subdir/libiberty/defs.mk | | 408 | | write_mk gnu/usr.bin/$_subdir/libiberty/defs.mk |
404 | | | 409 | |
405 | write_c gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH/config.h \ | | 410 | write_c gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH/config.h \ |
406 | <$_TMPDIR/libiberty/config.h | | 411 | <$_TMPDIR/libiberty/config.h |
407 | } | | 412 | } |
408 | | | 413 | |
409 | ##### gnu/lib/libobjc ##### | | 414 | ##### gnu/lib/libobjc ##### |
410 | | | 415 | |
411 | get_libobjc () { | | 416 | get_libobjc () { |
412 | case "$1" in | | 417 | case "$1" in |
413 | *4) | | 418 | *4) |
414 | _subdir="$1/arch/$MACHINE_ARCH" | | 419 | _subdir="$1/arch/$MACHINE_ARCH" |
415 | _options="ALL_OPT_FILES" | | 420 | _options="ALL_OPT_FILES" |
416 | _unwind="UNWIND_H" | | 421 | _unwind="UNWIND_H" |
417 | ;; | | 422 | ;; |
418 | *) | | 423 | *) |
419 | _subdir="$1" | | 424 | _subdir="$1" |
420 | _options="" | | 425 | _options="" |
421 | _unwind="" | | 426 | _unwind="" |
422 | ;; | | 427 | ;; |
423 | esac | | 428 | esac |
424 | | | 429 | |
425 | mkdir -p $_TOP/gnu/lib/$_subdir | | 430 | mkdir -p $_TOP/gnu/lib/$_subdir |
426 | | | 431 | |
427 | { | | 432 | { |
428 | if [ -n "$_options" ]; then | | 433 | if [ -n "$_options" ]; then |
429 | getvars gcc/Makefile $_options | | 434 | getvars gcc/Makefile $_options |
430 | fi | | 435 | fi |
431 | getvars $_PLATFORM/libobjc/Makefile \ | | 436 | getvars $_PLATFORM/libobjc/Makefile \ |
432 | ALL_CFLAGS INCLUDES OBJS OBJC_H \ | | 437 | ALL_CFLAGS INCLUDES OBJS OBJC_H \ |
433 | | sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" | | 438 | | sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" |
434 | if [ -n "$_unwind" ]; then | | 439 | if [ -n "$_unwind" ]; then |
435 | getvars gcc/Makefile $_unwind | | 440 | getvars gcc/Makefile $_unwind |
436 | fi | | 441 | fi |
437 | } | write_mk gnu/lib/$_subdir/defs.mk | | 442 | } | write_mk gnu/lib/$_subdir/defs.mk |
438 | | | 443 | |
439 | write_c gnu/lib/$_subdir/config.h \ | | 444 | write_c gnu/lib/$_subdir/config.h \ |
440 | <$_TMPDIR/$_PLATFORM/libobjc/config.h | | 445 | <$_TMPDIR/$_PLATFORM/libobjc/config.h |
441 | } | | 446 | } |
442 | | | 447 | |
443 | ##### gnu/lib/libstdc++-v3 ##### | | 448 | ##### gnu/lib/libstdc++-v3 ##### |
444 | | | 449 | |
445 | get_libstdcxx_v3 () { | | 450 | get_libstdcxx_v3 () { |
446 | _subdir="$1" | | 451 | _subdir="$1" |
447 | mkdir -p $_TOP/gnu/lib/$_subdir/arch/$MACHINE_ARCH | | 452 | mkdir -p $_TOP/gnu/lib/$_subdir/arch/$MACHINE_ARCH |
448 | | | 453 | |
449 | case ${_subdir} in | | 454 | case ${_subdir} in |
450 | *4) | | 455 | *4) |
451 | _src_CC_files="atomicity_file CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC CLOCALE_CC BASIC_FILE_CC" | | 456 | _src_CC_files="atomicity_file CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC CLOCALE_CC BASIC_FILE_CC" |
452 | _headers1="host_headers debug_headers tr1_headers c_compatibility_headers_extra" | | 457 | _headers1="host_headers debug_headers tr1_headers c_compatibility_headers_extra" |
453 | _headers2="thread_host_headers host_headers_extra" | | 458 | _headers2="thread_host_headers host_headers_extra" |
454 | _build_headers="c++allocator.h c++config.h cxxabi_tweaks.h gthr-default.h gthr-posix.h gthr-single.h gthr-tpf.h gthr.h" | | 459 | _build_headers="c++allocator.h c++config.h cxxabi_tweaks.h gthr-default.h gthr-posix.h gthr-single.h gthr-tpf.h gthr.h" |
455 | _unwind="UNWIND_H" | | 460 | _unwind="UNWIND_H" |
456 | ;; | | 461 | ;; |
457 | *) | | 462 | *) |
458 | _src_CC_files="" | | 463 | _src_CC_files="" |
459 | _headers1="target_headers" | | 464 | _headers1="target_headers" |
460 | _headers2="thread_target_headers target_headers_extra" | | 465 | _headers2="thread_target_headers target_headers_extra" |
461 | _build_headers="c++config.h gthr-default.h gthr-posix.h gthr-single.h gthr.h" | | 466 | _build_headers="c++config.h gthr-default.h gthr-posix.h gthr-single.h gthr.h" |
462 | _unwind="" | | 467 | _unwind="" |
463 | ;; | | 468 | ;; |
464 | esac | | 469 | esac |
465 | | | 470 | |
466 | # build files | | 471 | # build files |
467 | for h in $_build_headers; do | | 472 | for h in $_build_headers; do |
468 | write_c gnu/lib/$_subdir/arch/$MACHINE_ARCH/$h \ | | 473 | write_c gnu/lib/$_subdir/arch/$MACHINE_ARCH/$h \ |
469 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h | | 474 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h |
470 | done | | 475 | done |
471 | | | 476 | |
472 | write_c gnu/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ | | 477 | write_c gnu/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ |
473 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h | | 478 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h |
474 | | | 479 | |
475 | { | | 480 | { |
476 | # libmath | | 481 | # libmath |
477 | getvars $_PLATFORM/libstdc++-v3/libmath/Makefile \ | | 482 | getvars $_PLATFORM/libstdc++-v3/libmath/Makefile \ |
478 | libmath_la_SOURCES libmath_la_LIBADD | | 483 | libmath_la_SOURCES libmath_la_LIBADD |
479 | | | 484 | |
480 | # libsupc++ | | 485 | # libsupc++ |
481 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ | | 486 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ |
482 | sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/' | | 487 | sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/' |
483 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ | | 488 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ |
484 | c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/' | | 489 | c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/' |
485 | | | 490 | |
486 | # src | | 491 | # src |
487 | getvars $_PLATFORM/libstdc++-v3/src/Makefile \ | | 492 | getvars $_PLATFORM/libstdc++-v3/src/Makefile \ |
488 | sources $_src_CC_files SECTION_FLAGS | sed 's/^G_sources=/G_SRC_SOURCES=/' | | 493 | sources $_src_CC_files SECTION_FLAGS | sed 's/^G_sources=/G_SRC_SOURCES=/' |
489 | | | 494 | |
490 | # include | | 495 | # include |
491 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 496 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
492 | c_base_headers_rename std_headers_rename | | 497 | c_base_headers_rename std_headers_rename |
493 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 498 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
494 | bits_headers backward_headers ext_headers c_base_headers_extra \ | | 499 | bits_headers backward_headers ext_headers c_base_headers_extra \ |
495 | $_headers1 | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' | | 500 | $_headers1 | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' |
496 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 501 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
497 | $_headers2 | sed -e 's#\./[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' | | 502 | $_headers2 | sed -e 's#\./[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' |
498 | | | 503 | |
499 | if [ -n "$_unwind" ]; then | | 504 | if [ -n "$_unwind" ]; then |
500 | getvars gcc/Makefile $_unwind | | 505 | getvars gcc/Makefile $_unwind |
501 | fi | | 506 | fi |
502 | } | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk | | 507 | } | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk |
503 | } | | 508 | } |
504 | | | 509 | |
505 | ##### gnu/usr.bin/gcc3 ##### | | 510 | ##### gnu/usr.bin/gcc3 ##### |
506 | | | 511 | |
507 | get_gcc () { | | 512 | get_gcc () { |
508 | _subdir="$1" | | 513 | _subdir="$1" |
509 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH | | 514 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH |
510 | case ${_subdir} in | | 515 | case ${_subdir} in |
511 | gcc4) | | 516 | gcc4) |
512 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH | | 517 | mkdir -p $_TOP/gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH |
513 | _buildname="BUILD_" | | 518 | _buildname="BUILD_" |
514 | _libcppsubdir="" | | 519 | _libcppsubdir="" |
515 | _extravars="TM_H ALL_OPT_FILES" | | 520 | _extravars="TM_H ALL_OPT_FILES" |
516 | _hconfig_h="" | | 521 | _hconfig_h="" |
517 | _extravars2="tm_file_list build_xm_include_list" | | 522 | _extravars2="tm_file_list build_xm_include_list" |
518 | _extravars3="tm_p_include_list" | | 523 | _extravars3="tm_p_include_list" |
519 | | | 524 | |
520 | ;; | | 525 | ;; |
521 | *) | | 526 | *) |
522 | _buildname="HOST_" | | 527 | _buildname="HOST_" |
523 | _libcppsubdir="gcc/" | | 528 | _libcppsubdir="gcc/" |
524 | _extravars="" | | 529 | _extravars="" |
525 | _hconfig_h="HCONFIG_H" | | 530 | _hconfig_h="HCONFIG_H" |
526 | _extravars2="" | | 531 | _extravars2="" |
527 | _extravars3="" | | 532 | _extravars3="" |
528 | ;; | | 533 | ;; |
529 | esac | | 534 | esac |
530 | | | 535 | |
531 | { | | 536 | { |
532 | getvars gcc/Makefile \ | | 537 | getvars gcc/Makefile \ |
533 | ${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \ | | 538 | ${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \ |
534 | ${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY | \ | | 539 | ${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY | \ |
535 | sed -e 's#build/errors.o#build-errors.o#g' \ | | 540 | sed -e 's#build/errors.o#build-errors.o#g' \ |
536 | -e 's#build/print-rtl.o#build-print-rtl.o#g' \ | | 541 | -e 's#build/print-rtl.o#build-print-rtl.o#g' \ |
537 | -e 's#build/rtl.o#build-rtl.o#g' \ | | 542 | -e 's#build/rtl.o#build-rtl.o#g' \ |
538 | -e 's#build/varray.o#build-varray.o#g' \ | | 543 | -e 's#build/varray.o#build-varray.o#g' \ |
539 | -e 's#build/ggc-none.o#build-ggc-none.o#g' \ | | 544 | -e 's#build/ggc-none.o#build-ggc-none.o#g' \ |
540 | -e 's#build/##g' | | 545 | -e 's#build/##g' |
541 | getvars gcc/Makefile \ | | 546 | getvars gcc/Makefile \ |
542 | ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \ | | 547 | ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \ |
543 | GCOV_OBJS PROTO_OBJS ${_extravars1} \ | | 548 | GCOV_OBJS PROTO_OBJS ${_extravars1} \ |
544 | INCLUDES md_file OBJC_OBJS OBJS out_file version \ | | 549 | INCLUDES md_file OBJC_OBJS OBJS out_file version \ |
545 | BUILD_PREFIX RTL_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \ | | 550 | BUILD_PREFIX RTL_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \ |
546 | GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \ | | 551 | GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \ |
547 | GTFILES GTFILES_LANG_DIR_NAMES \ | | 552 | GTFILES GTFILES_LANG_DIR_NAMES \ |
548 | tm_defines host_xm_file host_xm_defines tm_p_file \ | | 553 | tm_defines host_xm_file host_xm_defines tm_p_file \ |
549 | target_cpu_default ${_extravars} ${_extravars2} \ | | 554 | target_cpu_default ${_extravars} ${_extravars2} \ |
550 | lang_specs_files ${_extravars3} | | 555 | lang_specs_files ${_extravars3} |
551 | getvars gcc/Makefile \ | | 556 | getvars gcc/Makefile \ |
552 | LIB2ADDEHDEP | sed 's/unwind.inc//' | | 557 | LIB2ADDEHDEP | sed 's/unwind.inc//' |
553 | getvars gcc/Makefile \ | | 558 | getvars gcc/Makefile \ |
554 | CXX_OBJS CXX_C_OBJS | sed 's/cp\///g' | | 559 | CXX_OBJS CXX_C_OBJS | sed 's/cp\///g' |
555 | getvars gcc/Makefile \ | | 560 | getvars gcc/Makefile \ |
556 | F77_OBJS | sed 's/f\///g' | | 561 | F77_OBJS | sed 's/f\///g' |
557 | case ${_subdir} in | | 562 | case ${_subdir} in |
558 | gcc4) | | 563 | gcc4) |
559 | getvars libcpp/Makefile \ | | 564 | getvars libcpp/Makefile \ |
560 | libcpp_a_OBJS | | 565 | libcpp_a_OBJS |
561 | ;; | | 566 | ;; |
562 | gcc3) | | 567 | gcc3) |
563 | getvars gcc/Makefile \ | | 568 | getvars gcc/Makefile \ |
564 | LIBCPP_OBJS LIBCPP_H | | 569 | LIBCPP_OBJS LIBCPP_H |
565 | ;; | | 570 | ;; |
566 | esac | | 571 | esac |
567 | getvars gcc/Makefile \ | | 572 | getvars gcc/Makefile \ |
568 | ENABLE_SHARED | | 573 | ENABLE_SHARED |
569 | case ${_subdir} in | | 574 | case ${_subdir} in |
570 | gcc4) | | 575 | gcc4) |
571 | echo G_SHLIB_LINK="$CC -shared" | | 576 | echo G_SHLIB_LINK="$CC -shared" |
572 | echo G_SHLIB_MULTILIB=. | | 577 | echo G_SHLIB_MULTILIB=. |
573 | ;; | | 578 | ;; |
574 | gcc3) | | 579 | gcc3) |
575 | getvars gcc/Makefile \ | | 580 | getvars gcc/Makefile \ |
576 | SHLIB_LINK SHLIB_MULTILIB | | 581 | SHLIB_LINK SHLIB_MULTILIB |
577 | ;; | | 582 | ;; |
578 | esac | | 583 | esac |
579 | } | write_mk gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk | | 584 | } | write_mk gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk |
580 | | | 585 | |
581 | case "$_subdir" in | | 586 | case "$_subdir" in |
582 | gcc3) | | 587 | gcc3) |
583 | hfiles='auto-host configargs cs-hconfig gencheck hconfig gthr-default' | | 588 | hfiles='auto-host configargs cs-hconfig gencheck hconfig gthr-default' |
584 | ;; | | 589 | ;; |
585 | gcc4) | | 590 | gcc4) |
586 | write_c gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h | | 591 | write_c gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h |
587 | hfiles='auto-host configargs gencheck gthr-default tm bconfig config multilib' | | 592 | hfiles='auto-host configargs gencheck gthr-default tm bconfig config multilib' |
588 | ;; | | 593 | ;; |
589 | esac | | 594 | esac |
590 | for f in $hfiles; do | | 595 | for f in $hfiles; do |
591 | write_c gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h | | 596 | write_c gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h |
592 | done | | 597 | done |
593 | } | | 598 | } |
594 | | | 599 | |
595 | ##### main ##### | | 600 | ##### main ##### |
596 | | | 601 | |
597 | case "$1" in | | 602 | case "$1" in |
598 | # .mk and .h files for libgcc bootstrap (from host build) | | 603 | # .mk and .h files for libgcc bootstrap (from host build) |
599 | libgcc) | | 604 | libgcc) |
600 | get_libgcc gcc3 | | 605 | get_libgcc gcc3 |
601 | get_crtstuff crtstuff3 | | 606 | get_crtstuff crtstuff3 |
602 | exit 0 | | 607 | exit 0 |
603 | ;; | | 608 | ;; |
604 | | | 609 | |
605 | libgcc4) | | 610 | libgcc4) |
606 | get_libgcc gcc4 | | 611 | get_libgcc gcc4 |
607 | get_crtstuff crtstuff4 | | 612 | get_crtstuff crtstuff4 |
608 | exit 0 | | 613 | exit 0 |
609 | ;; | | 614 | ;; |
610 | | | 615 | |
611 | # gcc files | | 616 | # gcc files |
612 | gcc4) | | 617 | gcc4) |
613 | get_gcc gcc4 | | 618 | get_gcc gcc4 |
614 | get_libgcc gcc4 | | 619 | get_libgcc gcc4 |
615 | get_libgcov gcc4 | | 620 | get_libgcov gcc4 |
616 | get_crtstuff crtstuff4 | | 621 | get_crtstuff crtstuff4 |
617 | get_gcc_libiberty gcc4 | | 622 | get_gcc_libiberty gcc4 |
618 | get_libobjc libobjc4 | | 623 | get_libobjc libobjc4 |
619 | get_libstdcxx_v3 libstdc++-v3_4 | | 624 | get_libstdcxx_v3 libstdc++-v3_4 |
620 | exit 0 | | 625 | exit 0 |
621 | ;; | | 626 | ;; |
622 | | | 627 | |
623 | gcc3) | | 628 | gcc3) |
624 | get_gcc gcc3 | | 629 | get_gcc gcc3 |
625 | get_libg2c | | 630 | get_libg2c |
626 | get_libgcc gcc3 | | 631 | get_libgcc gcc3 |
627 | get_crtstuff crtstuff3 | | 632 | get_crtstuff crtstuff3 |
628 | get_gcc_libiberty gcc3 | | 633 | get_gcc_libiberty gcc3 |
629 | get_libobjc libobjc3 | | 634 | get_libobjc libobjc3 |
630 | get_libstdcxx_v3 libstdc++-v3 | | 635 | get_libstdcxx_v3 libstdc++-v3 |
631 | exit 0 | | 636 | exit 0 |
632 | ;; | | 637 | ;; |
633 | | | 638 | |
634 | *) echo invalid arguments; exit 1;; | | 639 | *) echo invalid arguments; exit 1;; |
635 | esac | | 640 | esac |