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