| @@ -1,461 +1,150 @@ | | | @@ -1,461 +1,150 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # $NetBSD: mknative-gcc.old,v 1.1 2014/02/26 09:54:34 mrg Exp $ | | 2 | # $NetBSD: mknative-gcc.old,v 1.2 2016/01/24 05:10:26 mrg Exp $ |
3 | # | | | |
4 | # was: NetBSD: mknative-gcc,v 1.75 2014/02/16 11:26:31 skrll Exp | | | |
5 | # | | 3 | # |
6 | # Shell script for generating all the constants needed for a native | | 4 | # Shell script for generating all the constants needed for a native |
7 | # platform build of gcc. | | 5 | # platform build of gcc. |
8 | # | | 6 | # |
9 | | | 7 | # This version is for GCC 4.8. |
10 | # XXX split out GCC 4.1 support | | | |
11 | | | 8 | |
12 | # initialise | | 9 | # initialise |
13 | | | 10 | |
14 | _TMPDIR=$2 | | 11 | _TMPDIR=$2 |
15 | _TOP=$3 | | 12 | _TOP=$3 |
16 | _SRC=$4 | | 13 | _SRC=$4 |
17 | _PLATFORM=$5 | | 14 | _PLATFORM=$5 |
18 | _DESTDIR=$6 | | 15 | _DESTDIR=$6 |
19 | _ABI=$7 | | 16 | _TOOLDIR=$7 |
20 | _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` | | 17 | _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` |
21 | _GNU_DIST=`cd ${_VPATH}; pwd` | | 18 | _GNU_DIST=`cd ${_VPATH}; pwd` |
22 | | | 19 | |
23 | if [ -z "$_DESTDIR" ]; then | | 20 | if [ -z "$_DESTDIR" ]; then |
24 | echo "\$_DESTDIR is empty" 2>&1 | | 21 | echo "\$_DESTDIR is empty" 2>&1 |
25 | exit 1 | | 22 | exit 1 |
26 | fi | | 23 | fi |
27 | | | 24 | |
28 | . $_TOP/tools/gcc/mknative.common | | 25 | . $_TOP/tools/gcc/mknative.common |
29 | | | 26 | |
30 | # default to GCC 4.1 for now | | 27 | # default to GCC 4.1 for now |
31 | _OUTDIR="$_TOP/gnu" | | 28 | _OUTDIR="$_TOP/gnu" |
32 | _OUTDIRBASE="gnu" | | 29 | _OUTDIRBASE="gnu" |
33 | | | 30 | |
34 | sanitise_includes () { | | 31 | sanitise_includes () { |
35 | sed \ | | 32 | sed \ |
36 | -e "s,-I$_DESTDIR/usr/include,,g" \ | | 33 | -e "s,-I$_DESTDIR/usr/include,,g" \ |
37 | -e "s,-I$_SRC/external/lgpl3/mpfr/dist/src,,g" \ | | 34 | -e "s,-I$_SRC/external/lgpl3/mpfr/dist/src,,g" \ |
38 | -e "s,-I$_SRC/external/lgpl3/mpc/dist/src,,g" \ | | 35 | -e "s,-I$_SRC/external/lgpl3/mpc/dist/src,,g" \ |
39 | -e "s,-I$_SRC/external/lgpl3/gmp/lib/libgmp/arch/$MACHINE_ARCH,,g" \ | | 36 | -e "s,-I$_SRC/external/lgpl3/gmp/lib/libgmp/arch/[a-z_0-9-]*,,g" \ |
| | | 37 | -e "s,-I$_TOOLDIR/include,,g" \ |
40 | -e "s,-I/usr/include/[^ ]*,," | | 38 | -e "s,-I/usr/include/[^ ]*,," |
41 | } | | 39 | } |
42 | | | 40 | |
43 | ##### gnu/lib/crtstuff ##### | | 41 | ##### lib/crtstuff ##### |
44 | | | 42 | |
45 | get_crtstuff () { | | 43 | get_crtstuff () { |
46 | _subdir="$1" | | 44 | _subdir="$1" |
47 | mkdir -p $_OUTDIR/lib/$_subdir/arch | | 45 | mkdir -p $_OUTDIR/lib/$_subdir/arch |
48 | | | 46 | |
49 | getvars gcc/Makefile \ | | 47 | getvars gcc/Makefile \ |
50 | INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS CRTSTUFF_T_CFLAGS_S \ | | 48 | INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS CRTSTUFF_T_CFLAGS_S \ |
51 | tm_defines xm_file xm_defines \ | | 49 | tm_defines xm_file xm_defines \ |
52 | | sanitise_includes \ | | 50 | | sanitise_includes \ |
53 | | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH.mk | | 51 | | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH.mk |
54 | } | | 52 | } |
55 | | | 53 | |
56 | ##### gnu/lib/libg2c ##### | | 54 | ##### lib/libg2c ##### |
57 | | | 55 | |
58 | get_libg2c () { | | 56 | get_libg2c () { |
59 | mkdir -p $_OUTDIR/lib/libg2c3/arch/$MACHINE_ARCH | | 57 | mkdir -p $_OUTDIR/lib/libg2c3/arch/$MACHINE_ARCH |
60 | | | 58 | |
61 | write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h | | 59 | write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h |
62 | write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h | | 60 | write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h |
63 | | | 61 | |
64 | { | | 62 | { |
65 | getvars $_PLATFORM/libf2c/Makefile \ | | 63 | getvars $_PLATFORM/libf2c/Makefile \ |
66 | F2CEXT | | 64 | F2CEXT |
67 | getvars $_PLATFORM/libf2c/libF77/Makefile \ | | 65 | getvars $_PLATFORM/libf2c/libF77/Makefile \ |
68 | ALL_CFLAGS OBJS | | 66 | ALL_CFLAGS OBJS |
69 | getvars $_PLATFORM/libf2c/libI77/Makefile \ | | 67 | getvars $_PLATFORM/libf2c/libI77/Makefile \ |
70 | ALL_CFLAGS OBJS | sed 's,=,+=,' | | 68 | ALL_CFLAGS OBJS | sed 's,=,+=,' |
71 | getvars $_PLATFORM/libf2c/libU77/Makefile \ | | 69 | getvars $_PLATFORM/libf2c/libU77/Makefile \ |
72 | ALL_CFLAGS OBJS | sed 's,=,+=,' | | 70 | ALL_CFLAGS OBJS | sed 's,=,+=,' |
73 | } | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk | | 71 | } | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk |
74 | } | | 72 | } |
75 | | | 73 | |
76 | ##### gnu/lib/libgcc ##### | | 74 | ##### lib/libgcc ##### |
77 | | | | |
78 | get_libgcc_list_funcs_asm () { | | | |
79 | { | | | |
80 | getvars gcc/Makefile LIB1ASMFUNCS | { | | | |
81 | # print newline separated list | | | |
82 | sed -e ' | | | |
83 | s,^.*=,, | | | |
84 | s, *$,, | | | |
85 | s, *, ,g | | | |
86 | s, ,\ | | | |
87 | ,g' | | | |
88 | } | | | |
89 | getvars gcc/Makefile LIB2FUNCS_EXTRA | { | | | |
90 | # print newline separated list | | | |
91 | sed -e ' | | | |
92 | s,^.*=,, | | | |
93 | s, *$,, | | | |
94 | s, *, ,g | | | |
95 | s, ,\ | | | |
96 | ,g' | \ | | | |
97 | sed -ne ' | | | |
98 | /\.S$/ { s,^.*/,,; s,\.S$,,; p; } | | | |
99 | /\.asm$/ { s,^.*/,,; s,\.asm$,,; p; } | | | |
100 | ' | | | |
101 | } | | | |
102 | } | { | | | |
103 | # print foo and foo_s | | | |
104 | sed -ne ' | | | |
105 | /./ { | | | |
106 | p | | | |
107 | s,$,_s, | | | |
108 | p | | | |
109 | } | | | |
110 | ' | | | |
111 | } | sort | | | |
112 | } | | | |
113 | | | | |
114 | get_libgcc_list_funcs_lib () { | | | |
115 | local _lib=$1 | | | |
116 | local _lib_prefix=${_lib%.*} | | | |
117 | local _lib_suffix=${_lib#*.} | | | |
118 | local _abi=${2:-'\.'} | | | |
119 | | | | |
120 | cat build/gcc/libgcc.mk | \ | | | |
121 | grep '/'${_abi}'/' | \ | | | |
122 | sed -ne ' | | | |
123 | /^'${_abi}'\/'${_lib_prefix}'\.'${_lib_suffix}': .*\.o$/ { | | | |
124 | s,^.*/,, | | | |
125 | s,\.o$,, | | | |
126 | p | | | |
127 | } | | | |
128 | ' | sort | | | |
129 | } | | | |
130 | | | | |
131 | get_libgcc_list_objs_libs () { | | | |
132 | local _abi=${1:-'\.'} | | | |
133 | | | | |
134 | cat build/gcc/libgcc.mk | \ | | | |
135 | grep '/'${_abi}'/' | \ | | | |
136 | egrep '^'${_abi}'\/(libgcc_s\.so|libgcc\.a|libgcc_eh\.a|libgcov\.a): (libgcc_s|libgcc|libgcc_eh|libgcov)\/.*\.o$' | \ | | | |
137 | sed -e ' | | | |
138 | s,^'${_abi}'\/,, | | | |
139 | s,: .*/, , | | | |
140 | s,^\(.*\) \(.*\)$,\2 \1, | | | |
141 | ' | sort | | | |
142 | } | | | |
143 | | | | |
144 | get_libgcc_list_objs_srcs () { | | | |
145 | local _abi=${1:-'\.'} # XXX not used | | | |
146 | | | | |
147 | if [ -e $_TOP/${libgcc_db_funcs}.S ]; then | | | |
148 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ | | | |
149 | comm -23 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \ | | | |
150 | sed -e 's,\(.*\),\1.o \1.c,' | | | |
151 | | | | |
152 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ | | | |
153 | comm -12 /dev/stdin $_TOP/${libgcc_db_funcs}.S | \ | | | |
154 | sed -e 's,\(.*\),\1.o \1.S,' | | | |
155 | else | | | |
156 | cut -f1 $_TOP/${libgcc_db_objs_libs} | sed -e 's,\.o$,,' | \ | | | |
157 | sed -e 's,\(.*\),\1.o \1.c,' | | | |
158 | fi | sort | | | |
159 | } | | | |
160 | | | | |
161 | get_libgcc_list_objs_tmplsrcs () { | | | |
162 | local _abi=${1:-'\.'} | | | |
163 | | | | |
164 | grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \ | | | |
165 | grep '/'${_abi}'/' | \ | | | |
166 | sed -ne ' | | | |
167 | s,^.* -c \([^ ]*\).* -o .*/\([^ ]*\.o\)$,\2 \1, | | | |
168 | # basename | | | |
169 | /\$/ { s,\$.*/,,; } | | | |
170 | /\// { s,\/.*/,,; } | | | |
171 | p | | | |
172 | ' | sort -u | | | |
173 | } | | | |
174 | | | | |
175 | get_libgcc_list_objs_xflags () { | | | |
176 | local _flags=$1 | | | |
177 | local _abi=${2:-'\.'} | | | |
178 | | | | |
179 | grep 'GCC_FOR_TARGET.*\.o$' build/gcc/libgcc.mk | \ | | | |
180 | grep '/'${_abi}'/' | \ | | | |
181 | sed -n ' | | | |
182 | x | | | |
183 | :loop | | | |
184 | g | | | |
185 | s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\5 \2/p | | | |
186 | g | | | |
187 | s/^\(.*\) \(-['${_flags}'][^ ][^ ]*\) \(.*\) \(-o .*\)\/\(.*\.o\)$/\1 \3 \4\/\5/ | | | |
188 | h | | | |
189 | t loop | | | |
190 | ' | sort | | | |
191 | } | | | |
192 | | | | |
193 | get_libgcc_list_objs_cppflags () { | | | |
194 | get_libgcc_list_objs_xflags D $1 | | | |
195 | } | | | |
196 | | | | |
197 | get_libgcc_list_objs_copts () { | | | |
198 | get_libgcc_list_objs_xflags fmx $1 | | | |
199 | } | | | |
200 | | | | |
201 | get_libgcc_list_tmplsrcs () { | | | |
202 | local _lib=$1 | | | |
203 | local _abi=$2 # XXX not used | | | |
204 | local _tmplallsrcs=$( mktemp /tmp/mknative-gcc._tmplallsrcs.XXXXXX ) | | | |
205 | | | | |
206 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} | | | |
207 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | | | |
208 | touch $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | | | |
209 | | | | |
210 | # all files | | | |
211 | local _lib_prefix=${_lib%.*} | | | |
212 | local _lib_suffix=${_lib#*.} | | | |
213 | join $_TOP/$libgcc_db_objs_libs $_TOP/$libgcc_db_objs_tmplsrcs | \ | | | |
214 | grep ${_lib_prefix}'\.'${_lib_suffix} | cut -d' ' -f 3 | sort -u > \ | | | |
215 | $_tmplallsrcs | | | |
216 | | | | |
217 | # TMPLFPSRCS = [fdp]p-bit.c | | | |
218 | grep '[fdt]p-bit\.c' <$_tmplallsrcs | sort -u | \ | | | |
219 | writefile ${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | | | |
220 | | | | |
221 | # TMPLASMSRCS = $(LIB1ASMSRC) | | | |
222 | grep '\$(LIB1ASMSRC)' <$_tmplallsrcs | sort -u | \ | | | |
223 | writefile ${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | | | |
224 | | | | |
225 | # TMPLSRCS is anything else; exclude TMPLFPSRCS and TMPLASMSRCS | | | |
226 | cat $_tmplallsrcs | \ | | | |
227 | comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | \ | | | |
228 | comm -23 /dev/stdin $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \ | | | |
229 | writefile ${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} | | | |
230 | | | | |
231 | rm -f $_tmplallsrcs | | | |
232 | } | | | |
233 | | | | |
234 | get_libgcc_new_analyze () { | | | |
235 | local _abi=$1 | | | |
236 | | | | |
237 | mkdir -p $_TOP/${_machine_arch_subdir} | | | |
238 | | | | |
239 | touch $_TOP/${libgcc_db_funcs}.S | | | |
240 | get_libgcc_list_funcs_asm | \ | | | |
241 | writefile ${libgcc_db_funcs}.S | | | |
242 | | | | |
243 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do | | | |
244 | touch $_TOP/${libgcc_db_funcs}.${_lib%.*} | | | |
245 | get_libgcc_list_funcs_lib $_lib $_abi | \ | | | |
246 | writefile ${libgcc_db_funcs}.${_lib%.*} | | | |
247 | done | | | |
248 | | | | |
249 | get_libgcc_list_objs_libs $_abi | writefile ${libgcc_db_objs_libs} | | | |
250 | get_libgcc_list_objs_srcs $_abi | writefile ${libgcc_db_objs_srcs} | | | |
251 | get_libgcc_list_objs_tmplsrcs $_abi | writefile ${libgcc_db_objs_tmplsrcs} | | | |
252 | get_libgcc_list_objs_cppflags $_abi | writefile ${libgcc_db_objs_cppflags} | | | |
253 | get_libgcc_list_objs_copts $_abi | writefile ${libgcc_db_objs_copts} | | | |
254 | | | | |
255 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do | | | |
256 | get_libgcc_list_tmplsrcs $_lib $_abi | | | |
257 | done | | | |
258 | } | | | |
259 | | | | |
260 | ##### | | | |
261 | | | | |
262 | get_libgcc_gen_tmplsrcs_tmplsrcs () { | | | |
263 | local _lib=$1 | | | |
264 | | | | |
265 | printf '\n' | | | |
266 | printf 'TMPLSRCS.%s = \\\n' $_lib | | | |
267 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplsrcs.${_lib%.*} | | | |
268 | } | | | |
269 | | | | |
270 | get_libgcc_gen_tmplsrcs_tmplfpsrcs () { | | | |
271 | local _lib=$1 | | | |
272 | | | | |
273 | printf '\n' | | | |
274 | printf 'TMPLFPSRCS.%s = \\\n' $_lib | | | |
275 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplfpsrcs.${_lib%.*} | | | |
276 | } | | | |
277 | | | | |
278 | get_libgcc_gen_tmplsrcs_tmplasmsrcs () { | | | |
279 | local _lib=$1 | | | |
280 | | | | |
281 | printf '\n' | | | |
282 | printf 'TMPLASMSRCS.%s = \\\n' $_lib | | | |
283 | sed -e 's,^, ,; s,$, \\,' $_TOP/${libgcc_db_tmplsrcs}.tmplasmsrcs.${_lib%.*} | \ | | | |
284 | sed -e 's,LIB1ASMSRC,G_&,' | | | |
285 | } | | | |
286 | | | | |
287 | get_libgcc_gen_srcs () { | | | |
288 | local _lib=$1 | | | |
289 | | | | |
290 | printf '\n' | | | |
291 | printf 'SRCS.%s = \\\n' $_lib | | | |
292 | if [ -e $_TOP/${libgcc_db_funcs}.S ]; then | | | |
293 | comm -23 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \ | | | |
294 | sed -e 's,$,.c,; s,^,tmp_,' | | | |
295 | comm -12 $_TOP/${libgcc_db_funcs}.${_lib%.*} $_TOP/${libgcc_db_funcs}.S | \ | | | |
296 | sed -e 's,$,.S,; s,^,tmp_,' | | | |
297 | else | | | |
298 | cat $_TOP/${libgcc_db_funcs}.${_lib%.*} | \ | | | |
299 | sed -e 's,$,.c,; s,^,tmp_,' | | | |
300 | fi | sort | \ | | | |
301 | sed -e 's,^, ,; s,$, \\,' | | | |
302 | } | | | |
303 | | | | |
304 | _lookup_objs () { | | | |
305 | local _obj=$1; local _key=$2 | | | |
306 | | | | |
307 | eval grep \^$_obj\\\ \$_TOP/\${libgcc_db_objs_${_key}} | cut -f2 | | | |
308 | } | | | |
309 | | | | |
310 | get_libgcc_gen_srcs_tmplsrcs () { | | | |
311 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ | | | |
312 | while read _obj; do | | | |
313 | printf 'SRCS.tmp_%s=%s\n' \ | | | |
314 | "$( _lookup_objs $_obj srcs )" \ | | | |
315 | "$( _lookup_objs $_obj tmplsrcs )" | | | |
316 | done | \ | | | |
317 | sed -e 's,\$(\(.*\)),${G_\1},' | | | |
318 | } | | | |
319 | | | | |
320 | get_libgcc_gen_srcs_cppflags () { | | | |
321 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ | | | |
322 | while read _obj; do | | | |
323 | printf '_CPPFLAGS.tmp_%s=%s\n' \ | | | |
324 | "$( _lookup_objs $_obj srcs )" \ | | | |
325 | "$( _lookup_objs $_obj cppflags | xargs )" | | | |
326 | done | | | |
327 | } | | | |
328 | | | | |
329 | get_libgcc_gen_srcs_copts () { | | | |
330 | cut -f1 $_TOP/${libgcc_db_objs_libs} | \ | | | |
331 | while read _obj; do | | | |
332 | printf 'COPTS.tmp_%s=%s\n' \ | | | |
333 | "$( _lookup_objs $_obj srcs )" \ | | | |
334 | "$( _lookup_objs $_obj copts | xargs )" | | | |
335 | done | | | |
336 | } | | | |
337 | | | | |
338 | get_libgcc_new_generate () { | | | |
339 | local _abi=$1 | | | |
340 | | | | |
341 | for _lib in libgcc_s.so libgcc.a libgcc_eh.a libgcov.a; do | | | |
342 | for _tmpl in tmplsrcs tmplfpsrcs tmplasmsrcs; do | | | |
343 | eval get_libgcc_gen_tmplsrcs_${_tmpl} $_lib | \ | | | |
344 | write_mk ${libgcc_libs_mk}.${_lib%.*}.tmplsrcs.${_tmpl}.mk | | | |
345 | done | | | |
346 | | | | |
347 | get_libgcc_gen_srcs $_lib | \ | | | |
348 | write_mk ${libgcc_libs_mk}.${_lib%.*}.srcs.mk | | | |
349 | done | | | |
350 | | | | |
351 | for _arg in tmplsrcs cppflags copts; do | | | |
352 | eval get_libgcc_gen_srcs_${_arg} | \ | | | |
353 | eval writefile \$libgcc_srcs_mk_${_arg} | | | |
354 | done | | | |
355 | } | | | |
356 | | | | |
357 | ##### | | | |
358 | | | | |
359 | get_libgcc_new () { | | | |
360 | _subdir="$1" | | | |
361 | _abi="$2" | | | |
362 | | | | |
363 | # List of generated files. | | | |
364 | | | | |
365 | _machine_arch_subdir=$_OUTDIRBASE/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH/$_abi | | | |
366 | | | | |
367 | libgcc_db_funcs=${_machine_arch_subdir}/funcs | | | |
368 | libgcc_db_tmplsrcs=${_machine_arch_subdir}/tmplsrcs | | | |
369 | libgcc_db_objs_libs=${_machine_arch_subdir}/objs.libs | | | |
370 | libgcc_db_objs_srcs=${_machine_arch_subdir}/objs.srcs | | | |
371 | libgcc_db_objs_tmplsrcs=${_machine_arch_subdir}/objs.tmplsrcs | | | |
372 | libgcc_db_objs_cppflags=${_machine_arch_subdir}/objs.cppflags | | | |
373 | libgcc_db_objs_copts=${_machine_arch_subdir}/objs.copts | | | |
374 | | | | |
375 | get_libgcc_new_analyze $_abi | | | |
376 | | | | |
377 | libgcc_libs_mk=${_machine_arch_subdir}/libs | | | |
378 | libgcc_srcs_mk=${_machine_arch_subdir}/srcs.mk | | | |
379 | libgcc_srcs_mk_tmplsrcs=${_machine_arch_subdir}/srcs.tmplsrcs.mk | | | |
380 | libgcc_srcs_mk_cppflags=${_machine_arch_subdir}/srcs.cppflags.mk | | | |
381 | libgcc_srcs_mk_copts=${_machine_arch_subdir}/srcs.copts.mk | | | |
382 | | | | |
383 | get_libgcc_new_generate $_abi | | | |
384 | } | | | |
385 | | | 75 | |
386 | get_libgcc () { | | 76 | get_libgcc () { |
387 | _subdir="$1" | | 77 | _subdir="$1" |
388 | mkdir -p $_OUTDIR/lib/lib$_subdir/arch | | 78 | mkdir -p $_OUTDIR/lib/lib$_subdir/arch |
389 | | | 79 | |
390 | case "$_subdir" in | | | |
391 | gcc4|gcc) | | | |
392 | _extravars="COLLECT2 UNWIND_H xm_include_list" | | | |
393 | _archsubdir="" | | | |
394 | ;; | | | |
395 | esac | | | |
396 | | | | |
397 | # DPBIT, FPBIT only used on mn10[23]00, we don't need them. | | 80 | # DPBIT, FPBIT only used on mn10[23]00, we don't need them. |
398 | # XXX we should probably grab everything Just In Case for | | 81 | # XXX we should probably grab everything Just In Case for |
399 | # the future. | | 82 | # the future. |
| | | 83 | |
| | | 84 | mkdir -p $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH |
| | | 85 | cd $_TMPDIR/$_PLATFORM/libgcc |
400 | { | | 86 | { |
401 | getvars gcc/Makefile \ | | 87 | getvars $_PLATFORM/libgcc/Makefile \ |
402 | INCLUDES LIB2ADD LIB2ADDEH LIB2ADD_ST \ | | 88 | INCLUDES LIB2ADD LIB2ADDEH LIB2ADD_ST \ |
403 | LIB1ASMFUNCS LIB1ASMSRC \ | | 89 | LIB1ASMFUNCS LIB1ASMSRC \ |
404 | LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \ | | 90 | LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \ |
405 | LIB2FUNCS_EXTRA \ | | 91 | LIB2FUNCS_EXTRA \ |
406 | LIBGCC2_CFLAGS \ | | 92 | LIBGCC2_CFLAGS \ |
407 | SHLIB_MKMAP SHLIB_MKMAP_OPTS \ | | 93 | SHLIB_MKMAP SHLIB_MKMAP_OPTS \ |
408 | SHLIB_MAPFILES SHLIB_NM_FLAGS \ | | 94 | SHLIB_MAPFILES SHLIB_NM_FLAGS |
409 | EXTRA_HEADERS xm_defines \ | | 95 | getvars gcc/Makefile \ |
410 | tm_defines ${_extravars} | | 96 | NOEXCEPTION_FLAGS EXTRA_HEADERS |
| | | 97 | getlinks config.status libgcc |
411 | } | sanitise_includes \ | | 98 | } | sanitise_includes \ |
412 | | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk | | 99 | | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk |
413 | | | 100 | |
414 | # Generate new style files. | | 101 | if [ "${MACHINE_ARCH}" = "m68000" ] |
415 | if [ -n "${MKNATIVE_LIBGCC_NEW}" ]; then | | 102 | then |
416 | get_libgcc_new $_subdir $_ABI | | 103 | ex <<__EOF__ $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk |
| | | 104 | /G_LIBGCC2_CFLAGS/ s/-fPIC// |
| | | 105 | wq |
| | | 106 | __EOF__ |
417 | fi | | 107 | fi |
| | | 108 | |
| | | 109 | for f in auto-target.h; do |
| | | 110 | write_c $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/$f \ |
| | | 111 | <$_TMPDIR/$_PLATFORM/libgcc/$f |
| | | 112 | done |
418 | } | | 113 | } |
419 | | | 114 | |
420 | ##### gnu/lib/libgcov ##### | | 115 | ##### lib/libgcov ##### |
421 | | | 116 | |
422 | get_libgcov () { | | 117 | get_libgcov () { |
423 | _subdir="$1" | | 118 | _subdir="$1" |
| | | 119 | _mf="$2" |
424 | | | 120 | |
425 | mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH | | 121 | mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH |
426 | | | 122 | |
427 | { | | 123 | { |
428 | getvars gcc/Makefile \ | | 124 | getvars $_mf \ |
429 | LIBGCOV | | 125 | LIBGCOV |
430 | } | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk | | 126 | } | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk |
431 | | | 127 | |
432 | write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ | | 128 | write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ |
433 | <$_TMPDIR/gcc/gcov-iov.h | | 129 | <$_TMPDIR/gcc/gcov-iov.h |
434 | | | 130 | |
435 | } | | 131 | } |
436 | | | 132 | |
437 | ##### gnu/usr.bin/gcc[34]/libiberty ##### | | 133 | ##### lib/libiberty ##### |
438 | | | 134 | |
439 | get_gcc_libiberty () { | | 135 | get_gcc_libiberty () { |
440 | _subdir="$1" | | 136 | _subdir="$1" |
441 | case "$_subdir" in | | 137 | _libibertydir="lib/libiberty" |
442 | gcc4) | | | |
443 | _libibertydir="usr.bin/$_subdir/libiberty" | | | |
444 | ;; | | | |
445 | gcc) | | | |
446 | _libibertydir="lib/libiberty" | | | |
447 | ;; | | | |
448 | esac | | | |
449 | mkdir -p $_OUTDIR/$_libibertydir/arch/$MACHINE_ARCH | | 138 | mkdir -p $_OUTDIR/$_libibertydir/arch/$MACHINE_ARCH |
450 | | | 139 | |
451 | getvars libiberty/Makefile \ | | 140 | getvars libiberty/Makefile \ |
452 | ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ | | 141 | ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ |
453 | | write_mk $_OUTDIRBASE/$_libibertydir/defs.mk | | 142 | | write_mk $_OUTDIRBASE/$_libibertydir/defs.mk |
454 | | | 143 | |
455 | write_c $_OUTDIRBASE/$_libibertydir/arch/$MACHINE_ARCH/config.h \ | | 144 | write_c $_OUTDIRBASE/$_libibertydir/arch/$MACHINE_ARCH/config.h \ |
456 | <$_TMPDIR/libiberty/config.h | | 145 | <$_TMPDIR/libiberty/config.h |
457 | } | | 146 | } |
458 | | | 147 | |
459 | ##### lib/libdecnumber ##### | | 148 | ##### lib/libdecnumber ##### |
460 | | | 149 | |
461 | get_libdecnumber () { | | 150 | get_libdecnumber () { |
| @@ -472,275 +161,276 @@ get_libgomp () { | | | @@ -472,275 +161,276 @@ get_libgomp () { |
472 | _subdir="$1" | | 161 | _subdir="$1" |
473 | | | 162 | |
474 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH | | 163 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH |
475 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ | | 164 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ |
476 | <$_TMPDIR/$_PLATFORM/libgomp/config.h | | 165 | <$_TMPDIR/$_PLATFORM/libgomp/config.h |
477 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp_f.h \ | | 166 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp_f.h \ |
478 | <$_TMPDIR/$_PLATFORM/libgomp/libgomp_f.h | | 167 | <$_TMPDIR/$_PLATFORM/libgomp/libgomp_f.h |
479 | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp.spec \ | | 168 | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp.spec \ |
480 | <$_TMPDIR/$_PLATFORM/libgomp/libgomp.spec | | 169 | <$_TMPDIR/$_PLATFORM/libgomp/libgomp.spec |
481 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/omp.h \ | | 170 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/omp.h \ |
482 | <$_TMPDIR/$_PLATFORM/libgomp/omp.h | | 171 | <$_TMPDIR/$_PLATFORM/libgomp/omp.h |
483 | } | | 172 | } |
484 | | | 173 | |
485 | ##### gnu/lib/libobjc ##### | | 174 | ##### lib/libbacktrace ##### |
| | | 175 | |
| | | 176 | get_libbacktrace () { |
| | | 177 | _subdir="$1" |
| | | 178 | |
| | | 179 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH |
| | | 180 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ |
| | | 181 | <$_TMPDIR/$_subdir/config.h |
| | | 182 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/backtrace-supported.h \ |
| | | 183 | <$_TMPDIR/$_subdir/backtrace-supported.h |
| | | 184 | } |
| | | 185 | |
| | | 186 | ##### lib/libobjc ##### |
486 | | | 187 | |
487 | get_libobjc () { | | 188 | get_libobjc () { |
488 | _subdir="$1/arch/$MACHINE_ARCH" | | 189 | _subdir="$1/arch/$MACHINE_ARCH" |
489 | _options="ALL_OPT_FILES" | | 190 | _options="ALL_OPT_FILES" |
490 | _unwind="UNWIND_H" | | | |
491 | | | 191 | |
492 | mkdir -p $_OUTDIR/lib/$_subdir | | 192 | mkdir -p $_OUTDIR/lib/$_subdir |
493 | | | 193 | |
494 | { | | 194 | { |
495 | if [ -n "$_options" ]; then | | 195 | if [ -n "$_options" ]; then |
496 | getvars gcc/Makefile $_options | | 196 | getvars gcc/Makefile $_options |
497 | fi | | 197 | fi |
498 | getvars $_PLATFORM/libobjc/Makefile \ | | 198 | getvars $_PLATFORM/libobjc/Makefile \ |
499 | ALL_CFLAGS INCLUDES OBJS OBJC_H \ | | 199 | ALL_CFLAGS INCLUDES OBJC_SOURCE_FILES C_SOURCE_FILES OBJC_H \ |
500 | | sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" | | 200 | | sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" |
501 | if [ -n "$_unwind" ]; then | | 201 | getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc |
502 | getvars gcc/Makefile $_unwind | | 202 | } | sanitise_includes \ |
503 | fi | | 203 | | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk |
504 | } | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk | | | |
505 | | | 204 | |
506 | write_c $_OUTDIRBASE/lib/$_subdir/config.h \ | | 205 | write_c $_OUTDIRBASE/lib/$_subdir/config.h \ |
507 | <$_TMPDIR/$_PLATFORM/libobjc/config.h | | 206 | <$_TMPDIR/$_PLATFORM/libobjc/config.h |
508 | } | | 207 | } |
509 | | | 208 | |
510 | ##### gnu/lib/libstdc++-v3 ##### | | 209 | ##### lib/libstdc++-v3 ##### |
511 | | | 210 | |
512 | get_libstdcxx_v3 () { | | 211 | get_libstdcxx_v3 () { |
513 | _subdir="$1" | | 212 | _subdir="$1" |
| | | 213 | _ver="$2" |
| | | 214 | |
514 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH | | 215 | mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH |
515 | | | 216 | |
516 | case ${_subdir} in | | 217 | _build_headers="c++config.h cxxabi_tweaks.h gthr-posix.h gthr-single.h gthr.h" |
517 | *) | | 218 | _headers1="c_base_headers_extra_install" |
518 | _src_CC_files="atomicity_file CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC CLOCALE_CC BASIC_FILE_CC" | | 219 | _headers1="$_headers1 tr1_headers tr2_headers decimal_headers c_compatibility_headers_install" |
519 | _headers1="host_headers debug_headers tr1_headers c_compatibility_headers_extra tr1_impl_headers parallel_headers decimal_headers" | | 220 | _headers1="$_headers1 debug_headers parallel_headers" |
520 | _headers2="thread_host_headers host_headers_extra" | | 221 | _headers2="host_headers thread_host_headers" |
521 | _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" | | 222 | _pf_headers="profile_headers profile_impl_headers" |
522 | _unwind="UNWIND_H" | | 223 | _pb_headers="pb_headers1 pb_headers2 pb_headers3 pb_headers4 pb_headers5 pb_headers6 pb_headers7" |
523 | ;; | | | |
524 | esac | | | |
525 | | | 224 | |
526 | # build files | | 225 | # build files |
527 | for h in $_build_headers; do | | 226 | for h in $_build_headers; do |
528 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/$h \ | | 227 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/$h \ |
529 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h | | 228 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h |
530 | done | | 229 | done |
531 | | | 230 | |
532 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ | | | |
533 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h | | | |
534 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/gstdint.h \ | | 231 | write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/gstdint.h \ |
535 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h | | 232 | <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h |
536 | | | 233 | |
537 | { | | 234 | { |
538 | # libsupc++ | | 235 | # libsupc++ |
539 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ | | 236 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ |
540 | sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/' | | 237 | sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/' |
541 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ | | 238 | getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ |
542 | c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/' | | 239 | c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/' |
543 | | | 240 | |
| | | 241 | # includes |
| | | 242 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
| | | 243 | c_base_headers std_headers | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' |
| | | 244 | |
544 | # src | | 245 | # src |
545 | getvars $_PLATFORM/libstdc++-v3/src/Makefile \ | | 246 | getvars $_PLATFORM/libstdc++-v3/src/Makefile \ |
546 | sources $_src_CC_files SECTION_FLAGS | sed 's/^G_sources=/G_SRC_SOURCES=/' | | 247 | libstdc___la_SOURCES | sed 's/^G_libstdc___la_SOURCES=/G_SRC_SOURCES=/' |
| | | 248 | getvars $_PLATFORM/libstdc++-v3/src/c++11/Makefile \ |
| | | 249 | libc__11convenience_la_SOURCES | sed 's/^G_libc__11convenience_la_SOURCES=/G_CPP11_SOURCES=/' |
| | | 250 | getvars $_PLATFORM/libstdc++-v3/src/c++98/Makefile \ |
| | | 251 | libc__98convenience_la_SOURCES | sed 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/' |
| | | 252 | getvars $_PLATFORM/libstdc++-v3/Makefile ATOMICITY_SRCDIR \ |
| | | 253 | BASIC_FILE_CC CLOCALE_CC CCODECVT_CC CCOLLATE_CC \ |
| | | 254 | CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC \ |
| | | 255 | CPU_OPT_BITS_RANDOM |
547 | | | 256 | |
548 | # include | | 257 | # includes |
549 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 258 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
550 | c_base_headers std_headers | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' | | 259 | backward_headers c_base_headers_extra $_headers1 $_pb_headers | \ |
| | | 260 | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' |
551 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 261 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
552 | bits_headers backward_headers ext_headers c_base_headers_extra \ | | 262 | bits_headers ext_headers $_headers2 | \ |
553 | $_headers1 | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' | | 263 | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' -e 's#\${GNUHOSTDIST}/libstdc++-v3/config/##g' |
554 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ | | 264 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
555 | $_headers2 | sed -e 's#\./[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' | | 265 | $_pf_headers | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/profile/##g' |
556 | | | 266 | getvars $_PLATFORM/libstdc++-v3/include/Makefile \ |
557 | if [ -n "$_unwind" ]; then | | 267 | BASIC_FILE_H ALLOCATOR_H CSTDIO_H CLOCALE_H CMESSAGES_H CTIME_H |
558 | getvars gcc/Makefile $_unwind | | 268 | getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc |
559 | fi | | 269 | } | sanitise_includes \ |
560 | } | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk | | 270 | | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk |
561 | } | | 271 | } |
562 | | | 272 | |
563 | ##### gnu/usr.bin/gcc* ##### | | 273 | ##### usr.bin/gcc* ##### |
564 | | | 274 | |
565 | get_gcc_bootstrap () { | | 275 | get_gcc_bootstrap () { |
566 | _subdir="$1" | | 276 | _subdir="$1" |
567 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH | | 277 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH |
568 | for f in auto-host tm config gthr-default; do | | 278 | for f in auto-host tm config; do |
569 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h | | 279 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h |
570 | done | | 280 | done |
571 | } | | 281 | } |
572 | | | 282 | |
573 | get_gcc () { | | 283 | get_gcc () { |
574 | _subdir="$1" | | 284 | _subdir="$1" |
575 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH | | 285 | mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH |
576 | mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$MACHINE_ARCH | | 286 | mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$MACHINE_ARCH |
577 | case ${_subdir} in | | 287 | mkdir -p $_OUTDIR/usr.bin/include/arch |
578 | gcc4) | | 288 | _buildname="BUILD_" |
579 | _buildname="BUILD_" | | 289 | _libcppsubdir="" |
580 | _libcppsubdir="" | | 290 | _extravars="TM_H ALL_OPT_FILES" |
581 | _extravars="TM_H ALL_OPT_FILES" | | 291 | _hconfig_h="" |
582 | _hconfig_h="" | | 292 | _extravars2="tm_file_list build_xm_include_list" |
583 | _extravars2="tm_file_list build_xm_include_list" | | 293 | _extravars3="tm_p_include_list" |
584 | _extravars3="tm_p_include_list" | | | |
585 | ;; | | | |
586 | | | | |
587 | gcc) | | | |
588 | _buildname="BUILD_" | | | |
589 | _libcppsubdir="" | | | |
590 | _extravars="TM_H ALL_OPT_FILES" | | | |
591 | _hconfig_h="" | | | |
592 | _extravars2="tm_file_list build_xm_include_list" | | | |
593 | _extravars3="tm_p_include_list" | | | |
594 | ;; | | | |
595 | esac | | | |
596 | | | 294 | |
597 | { | | 295 | { |
598 | getvars gcc/Makefile \ | | 296 | getvars gcc/Makefile \ |
599 | ${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \ | | 297 | ${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \ |
600 | ${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY | \ | | 298 | ${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY \ |
| | | 299 | ${_buildname}MD | \ |
601 | sed -e 's#build/errors.o#build-errors.o#g' \ | | 300 | sed -e 's#build/errors.o#build-errors.o#g' \ |
602 | -e 's#build/print-rtl.o#build-print-rtl.o#g' \ | | 301 | -e 's#build/print-rtl.o#build-print-rtl.o#g' \ |
603 | -e 's#build/rtl.o#build-rtl.o#g' \ | | 302 | -e 's#build/rtl.o#build-rtl.o#g' \ |
604 | -e 's#build/varray.o#build-varray.o#g' \ | | 303 | -e 's#build/varray.o#build-varray.o#g' \ |
605 | -e 's#build/ggc-none.o#build-ggc-none.o#g' \ | | 304 | -e 's#build/ggc-none.o#build-ggc-none.o#g' \ |
606 | -e 's#build/##g' | | 305 | -e 's#build/##g' |
607 | getvars gcc/Makefile \ | | 306 | getvars gcc/Makefile \ |
608 | ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \ | | 307 | ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \ |
609 | GCOV_OBJS PROTO_OBJS ${_extravars1} \ | | 308 | GCC_OBJS GCOV_OBJS GXX_OBJS GTM_H PROTO_OBJS ${_extravars1} \ |
610 | INCLUDES md_file OBJC_OBJS OBJS out_file version \ | | 309 | INCLUDES md_file OBJC_OBJS OBJS out_file version \ |
611 | BUILD_PREFIX RTL_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \ | | 310 | BUILD_PREFIX RTL_H RTL_BASE_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \ |
612 | GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \ | | 311 | GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \ |
613 | GTFILES GTFILES_LANG_DIR_NAMES \ | | 312 | GTFILES GTFILES_LANG_DIR_NAMES NOEXCEPTION_FLAGS \ |
| | | 313 | NATIVE_SYSTEM_HEADER_DIR \ |
614 | tm_defines host_xm_file host_xm_defines tm_p_file \ | | 314 | tm_defines host_xm_file host_xm_defines tm_p_file \ |
615 | target_cpu_default ${_extravars} ${_extravars2} \ | | 315 | target_cpu_default ${_extravars} ${_extravars2} \ |
616 | lang_specs_files ${_extravars3} \ | | 316 | lang_specs_files ${_extravars3} \ |
| | | 317 | common_out_file \ |
617 | | sanitise_includes | | 318 | | sanitise_includes |
618 | getvars gcc/Makefile \ | | 319 | getvars gcc/Makefile \ |
619 | LIB2ADDEHDEP | sed 's/unwind.inc//' | | 320 | LIB2ADDEHDEP | sed 's/unwind.inc//' |
620 | getvars gcc/Makefile \ | | 321 | getvars gcc/Makefile \ |
621 | CXX_OBJS CXX_C_OBJS | sed 's/cp\///g' | | 322 | CXX_OBJS CXX_C_OBJS | sed 's/cp\///g' |
622 | getvars gcc/Makefile \ | | 323 | getvars gcc/Makefile \ |
623 | F77_OBJS | sed 's/f\///g' | | 324 | F77_OBJS | sed 's/f\///g' |
624 | case ${_subdir} in | | 325 | getvars libcpp/Makefile \ |
625 | gcc4 | gcc) | | 326 | libcpp_a_OBJS |
626 | getvars libcpp/Makefile \ | | | |
627 | libcpp_a_OBJS | | | |
628 | ;; | | | |
629 | esac | | | |
630 | getvars gcc/Makefile \ | | 327 | getvars gcc/Makefile \ |
631 | ENABLE_SHARED | | 328 | ENABLE_SHARED |
632 | case ${_subdir} in | | 329 | echo G_SHLIB_LINK="$CC -shared" |
633 | gcc4 | gcc) | | 330 | echo G_SHLIB_MULTILIB=. |
634 | echo G_SHLIB_LINK="$CC -shared" | | | |
635 | echo G_SHLIB_MULTILIB=. | | | |
636 | ;; | | | |
637 | esac | | | |
638 | } | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk | | 331 | } | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk |
639 | | | 332 | |
640 | case "$_subdir" in | | 333 | getvars gcc/Makefile \ |
641 | gcc4) | | 334 | EXTRA_HEADERS \ |
642 | write_c $_OUTDIRBASE/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h | | 335 | | write_mk $_OUTDIRBASE/usr.bin/include/arch/$MACHINE_ARCH.mk |
643 | hfiles='auto-host gencheck configargs gthr-default tm bconfig config multilib' | | 336 | |
644 | ;; | | 337 | write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h |
645 | gcc) | | 338 | hfiles='auto-host configargs config bconfig bversion plugin-version multilib tm' |
646 | write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h | | | |
647 | hfiles='auto-host configargs gthr-default tm bconfig config multilib bversion plugin-version' | | | |
648 | ;; | | | |
649 | esac | | | |
650 | for f in $hfiles; do | | 339 | for f in $hfiles; do |
651 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h | | 340 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h |
652 | if [ "${MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] | | 341 | if [ "${MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] |
653 | then | | 342 | then |
654 | ex <<__EOF__ $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h | | 343 | ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h |
655 | /configuration_arguments/ s/$// | | 344 | /configuration_arguments/ s/$// |
656 | ya | | 345 | ya |
657 | i | | 346 | i |
658 | #ifdef _SOFT_FLOAT | | 347 | #ifdef _SOFT_FLOAT |
659 | . | | 348 | . |
660 | pu | | 349 | pu |
661 | s/";$/ -with-float=soft";/ | | 350 | s/";$/ -with-float=soft";/ |
662 | a | | 351 | a |
663 | #else | | 352 | #else |
664 | #endif | | 353 | #endif |
665 | . | | 354 | . |
666 | . m +1 | | 355 | . m +1 |
667 | /configure_default_options/ s/{ NULL.*$// | | 356 | /configure_default_options/ s/{ NULL.*$// |
668 | a | | 357 | a |
669 | #ifdef _SOFT_FLOAT | | 358 | #ifdef _SOFT_FLOAT |
670 | { "float", "soft" }, | | 359 | { "float", "soft" }, |
671 | #endif | | 360 | #endif |
672 | { NULL, NULL } | | 361 | { NULL, NULL } |
673 | }; | | 362 | }; |
674 | . | | 363 | . |
675 | wq | | 364 | wq |
676 | __EOF__ | | 365 | __EOF__ |
677 | fi | | 366 | fi |
| | | 367 | if [ "${f}" = "configargs" ] |
| | | 368 | then |
| | | 369 | _srcquoted=$(echo "$_SRC" | sed 's/\//\\\//g') |
| | | 370 | ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h |
| | | 371 | /static const char configuration_arguments/ s/$_srcquoted/\/usr\/src/g |
| | | 372 | wq |
| | | 373 | __EOF__ |
| | | 374 | fi |
678 | done | | 375 | done |
679 | | | 376 | |
680 | # keep identical | | 377 | # keep identical |
681 | for f in all-tree.def; do | | 378 | for f in all-tree.def; do |
682 | cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f | | 379 | cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f |
683 | done | | 380 | done |
684 | | | 381 | |
685 | # special transforms | | 382 | # special transforms |
686 | for f in gtyp-input.list; do | | 383 | for f in gtyp-input.list; do |
687 | sed -e 's/^.*external\/gpl3\/gcc\.old\/dist/SRCDIR/' < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f | | 384 | sed -e 's/^.*external\/gpl3\/gcc\/dist/SRCDIR/' < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f |
688 | done | | 385 | done |
689 | | | 386 | |
690 | # special platforms | | 387 | # special platforms |
691 | if [ "${MACHINE_ARCH}" = "sh3el" -o "${MACHINE_ARCH}" = "sh3eb" ]; then | | 388 | if [ "${MACHINE_ARCH}" = "sh3el" -o "${MACHINE_ARCH}" = "sh3eb" ]; then |
692 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h | | 389 | write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h |
693 | fi | | 390 | fi |
694 | } | | 391 | } |
695 | | | 392 | |
696 | ##### main ##### | | 393 | ##### main ##### |
697 | | | 394 | |
698 | case "$1" in | | 395 | case "$1" in |
699 | # .mk and .h files for libgcc bootstrap (from host build) | | 396 | # .mk and .h files for libgcc bootstrap (from host build) |
700 | | | 397 | |
701 | libgcc4) | | 398 | libgcc*-bootstrap) |
702 | get_libgcc gcc4 | | 399 | _OUTDIR="$_TOP/external/gpl3/gcc" |
703 | get_crtstuff crtstuff4 | | 400 | _OUTDIRBASE="external/gpl3/gcc" |
704 | exit 0 | | | |
705 | ;; | | | |
706 | | | | |
707 | libgcc45) | | | |
708 | _OUTDIR="$_TOP/external/gpl3/gcc.old" | | | |
709 | _OUTDIRBASE="external/gpl3/gcc.old" | | | |
710 | get_libgcc gcc | | 401 | get_libgcc gcc |
| | | 402 | get_libgcov gcc $_PLATFORM/libgcc/Makefile |
711 | get_crtstuff crtstuff | | 403 | get_crtstuff crtstuff |
712 | get_libgcov gcc | | | |
713 | get_gcc_bootstrap gcc | | 404 | get_gcc_bootstrap gcc |
714 | exit 0 | | 405 | exit 0 |
715 | ;; | | 406 | ;; |
716 | | | 407 | |
717 | # gcc files | | 408 | libstdc++-bootstrap) |
718 | gcc4) | | 409 | _OUTDIR="$_TOP/external/gpl3/gcc" |
719 | get_gcc gcc4 | | 410 | _OUTDIRBASE="external/gpl3/gcc" |
720 | get_libgcc gcc4 | | 411 | get_libstdcxx_v3 libstdc++-v3 gcc |
721 | get_libgcov gcc4 | | | |
722 | get_crtstuff crtstuff4 | | | |
723 | get_gcc_libiberty gcc4 | | | |
724 | get_libobjc libobjc4 | | | |
725 | get_libstdcxx_v3 libstdc++-v3_4 | | | |
726 | exit 0 | | 412 | exit 0 |
727 | ;; | | 413 | ;; |
728 | | | 414 | |
729 | gcc45) | | 415 | gcc*) |
730 | _OUTDIR="$_TOP/external/gpl3/gcc.old" | | 416 | _OUTDIR="$_TOP/external/gpl3/gcc" |
731 | _OUTDIRBASE="external/gpl3/gcc.old" | | 417 | _OUTDIRBASE="external/gpl3/gcc" |
732 | get_gcc gcc | | 418 | get_gcc gcc |
733 | get_libgcc gcc | | 419 | get_libgcc gcc |
734 | get_libgcov gcc | | 420 | get_libgcov gcc $_PLATFORM/libgcc/Makefile |
735 | get_crtstuff crtstuff | | 421 | get_crtstuff crtstuff |
736 | get_gcc_libiberty gcc | | 422 | get_gcc_libiberty gcc |
737 | get_libobjc libobjc | | 423 | get_libobjc libobjc |
738 | get_libstdcxx_v3 libstdc++-v3 | | 424 | get_libstdcxx_v3 libstdc++-v3 gcc |
739 | get_libdecnumber libdecnumber | | 425 | get_libdecnumber libdecnumber |
740 | get_libgomp libgomp | | 426 | get_libgomp libgomp |
| | | 427 | get_libbacktrace libbacktrace |
741 | exit 0 | | 428 | exit 0 |
742 | ;; | | 429 | ;; |
743 | | | 430 | |
744 | | | 431 | |
745 | *) echo invalid arguments; exit 1;; | | 432 | *) |
| | | 433 | echo invalid arguments; |
| | | 434 | exit 1 |
| | | 435 | ;; |
746 | esac | | 436 | esac |