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