Home | History | Annotate | Line # | Download | only in gcc
      1 #!/bin/sh
      2 #	$NetBSD: mknative-gcc,v 1.121 2025/09/17 02:17:51 mrg Exp $
      3 #
      4 # Shell script for generating all the constants needed for a native
      5 # platform build of gcc.
      6 #
      7 # This version is for GCC 14.3
      8 
      9 # initialise
     10 
     11 _TMPDIR=$2
     12 _TOP=$3
     13 _SRC=$4
     14 _PLATFORM=$5
     15 _MACHINE_ARCH=$6
     16 _DESTDIR=$7
     17 _TOOLDIR=$8
     18 _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ 	]*,,'`
     19 _GNU_DIST=`cd ${_VPATH}; pwd`
     20 
     21 if [ -z "$_DESTDIR" ]; then
     22 	echo "\$_DESTDIR is empty" 2>&1
     23 	exit 1
     24 fi
     25 
     26 . $_TOP/tools/gcc/mknative.common
     27 
     28 case $0 in
     29 	*mknative-gcc.old)
     30 		_OUTDIRBASE="external/gpl3/gcc.old"
     31 		;;
     32 	*)
     33 		_OUTDIRBASE="external/gpl3/gcc"
     34 		;;
     35 esac
     36 _OUTDIR="$_TOP/$_OUTDIRBASE"
     37 
     38 sanitise_includes () {
     39 	sed \
     40 		-e "s,-I$_DESTDIR/usr/include,,g" \
     41 		-e "s,-I$_SRC/external/lgpl3/mpfr/dist/src,,g" \
     42 		-e "s,-I$_SRC/external/lgpl3/mpc/dist/src,,g" \
     43 		-e "s,-I$_SRC/external/lgpl3/gmp/lib/libgmp/arch/[a-z_0-9-]*,,g" \
     44 		-e "s,-I$_TOOLDIR/include,,g" \
     45 		-e "s,-I/usr/include/[^ 	]*,,"
     46 }
     47 
     48 ##### lib/libg2c #####
     49 
     50 get_libg2c () {
     51 	mkdir -p $_OUTDIR/lib/libg2c3/arch/$_MACHINE_ARCH
     52 
     53 	write_c $_OUTDIRBASE/lib/libg2c3/arch/$_MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h
     54 	write_c $_OUTDIRBASE/lib/libg2c3/arch/$_MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h
     55 
     56 	{
     57 		getvars $_PLATFORM/libf2c/Makefile \
     58 			F2CEXT
     59 		getvars $_PLATFORM/libf2c/libF77/Makefile \
     60 			ALL_CFLAGS OBJS
     61 		getvars $_PLATFORM/libf2c/libI77/Makefile \
     62 			ALL_CFLAGS OBJS | sed 's,=,+=,'
     63 		getvars $_PLATFORM/libf2c/libU77/Makefile \
     64 			ALL_CFLAGS OBJS | sed 's,=,+=,'
     65 	} | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$_MACHINE_ARCH/defs.mk
     66 }
     67 
     68 ##### lib/libgcc #####
     69 
     70 get_libgcc () {
     71 	_subdir="$1"
     72 	mkdir -p $_OUTDIR/lib/lib$_subdir/arch
     73 
     74 	# DPBIT, FPBIT only used on mn10[23]00, we don't need them.
     75 	# XXX we should probably grab everything Just In Case for
     76 	# the future.
     77 
     78 	mkdir -p $_OUTDIR/lib/lib$_subdir/arch/$_MACHINE_ARCH
     79 	cd $_TMPDIR/$_PLATFORM/libgcc
     80 	{
     81 		getvars $_PLATFORM/libgcc/Makefile \
     82 			INCLUDES \
     83 			INTERNAL_CFLAGS \
     84 			LIB2ADD LIB2ADDEH LIB2ADD_ST \
     85 			LIB1ASMFUNCS LIB1ASMSRC \
     86 			LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \
     87 			LIB2FUNCS_EXTRA \
     88 			LIBGCC2_CFLAGS \
     89 			SHLIB_MKMAP SHLIB_MKMAP_OPTS \
     90 			SHLIB_MAPFILES SHLIB_NM_FLAGS
     91 		getvars gcc/Makefile \
     92 			NOEXCEPTION_FLAGS EXTRA_HEADERS
     93 	}	| sanitise_includes \
     94 		| write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$_MACHINE_ARCH/defs.mk
     95 
     96 	cd $_TMPDIR/$_PLATFORM/libgcc
     97 	{
     98 		getvars $_PLATFORM/libgcc/Makefile \
     99 			enable_execute_stack \
    100 			unwind_header md_unwind_header \
    101 			sfp_machine_header thread_header
    102 	}	| sanitise_includes \
    103 		| write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$_MACHINE_ARCH/gthr-defs.mk
    104 
    105 	if [ "${_MACHINE_ARCH}" = "m68000" ]
    106 	then
    107 		ex <<__EOF__ $_OUTDIR/lib/lib$_subdir/arch/$_MACHINE_ARCH/defs.mk
    108 /G_LIBGCC2_CFLAGS/ s/-fPIC//
    109 wq
    110 __EOF__
    111 	fi
    112 
    113 	for f in auto-target.h; do
    114 		write_c $_OUTDIRBASE/lib/lib$_subdir/arch/$_MACHINE_ARCH/$f \
    115 		    <$_TMPDIR/$_PLATFORM/libgcc/$f
    116 	done
    117 }
    118 
    119 ##### lib/libgcov #####
    120 
    121 get_libgcov () {
    122 	_subdir="$1"
    123 	_mf="$2"
    124 
    125 	mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$_MACHINE_ARCH
    126 
    127 	{
    128 		getvars $_mf \
    129 			LIBGCOV_MERGE \
    130 			LIBGCOV_PROFILER \
    131 			LIBGCOV_INTERFACE \
    132 			LIBGCOV_DRIVER
    133 	} | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$_MACHINE_ARCH/defs.mk
    134 
    135 }
    136 
    137 ##### lib/libiberty #####
    138 
    139 get_gcc_libiberty () {
    140 	_subdir="$1"
    141 	_libibertydir="lib/libiberty"
    142 	mkdir -p $_OUTDIR/$_libibertydir/arch/$_MACHINE_ARCH
    143 
    144 	getvars libiberty/Makefile \
    145 		ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
    146 		| write_mk $_OUTDIRBASE/$_libibertydir/defs.mk
    147 
    148 	write_c $_OUTDIRBASE/$_libibertydir/arch/$_MACHINE_ARCH/config.h \
    149 		<$_TMPDIR/libiberty/config.h
    150 }
    151 
    152 ##### lib/libdecnumber #####
    153 
    154 get_libdecnumber () {
    155 	_subdir="$1"
    156 
    157 	mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH
    158 	write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/config.h \
    159 		<$_TMPDIR/libdecnumber/config.h
    160 }
    161 
    162 ##### lib/libgomp #####
    163 
    164 get_libgomp () {
    165 	_subdir="$1"
    166 
    167 	mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH
    168 
    169 	getvars $_PLATFORM/libgomp/Makefile \
    170 		libgomp_la_SOURCES \
    171 		| write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk
    172 
    173 	write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/config.h \
    174 		<$_TMPDIR/$_PLATFORM/libgomp/config.h
    175 	write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/libgomp_f.h \
    176 		<$_TMPDIR/$_PLATFORM/libgomp/libgomp_f.h
    177 	write_mk $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/libgomp.spec \
    178 		<$_TMPDIR/$_PLATFORM/libgomp/libgomp.spec
    179 	write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/omp.h \
    180 		<$_TMPDIR/$_PLATFORM/libgomp/omp.h
    181 }
    182 
    183 ##### lib/libbacktrace #####
    184 
    185 get_libbacktrace () {
    186 	_subdir="$1"
    187 
    188 	mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH
    189 	write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/config.h \
    190 		<$_TMPDIR/$_PLATFORM/$_subdir/config.h
    191 	write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/backtrace-supported.h \
    192 		<$_TMPDIR/$_PLATFORM/$_subdir/backtrace-supported.h
    193 }
    194 
    195 ##### lib/libobjc #####
    196 
    197 get_libobjc () {
    198 	_subdir="$1/arch/$_MACHINE_ARCH"
    199 	_options="ALL_OPT_FILES ALL_OPT_URL_FILES"
    200 
    201 	mkdir -p $_OUTDIR/lib/$_subdir
    202 
    203 	{
    204 		if [ -n "$_options" ]; then
    205 			getvars gcc/Makefile $_options
    206 		fi
    207 		getvars $_PLATFORM/libobjc/Makefile \
    208 			ALL_CFLAGS INCLUDES OBJC_SOURCE_FILES C_SOURCE_FILES OBJC_H \
    209 			| sed "s,$_GNU_DIST,\${GNUHOSTDIST},g"
    210 	} | sanitise_includes \
    211 	  | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk
    212 
    213 	write_c $_OUTDIRBASE/lib/$_subdir/config.h \
    214 		<$_TMPDIR/$_PLATFORM/libobjc/config.h
    215 }
    216 
    217 ##### lib/libstdc++-v3 #####
    218 
    219 get_libstdcxx_v3 () {
    220 	_subdir="$1"
    221 	_ver="$2"
    222 
    223 	mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH
    224 
    225 	_build_headers="c++config.h"
    226 	_headers1="backward_headers c_base_headers_extra"
    227 	_headers1="$_headers1 c_base_headers_extra_install"
    228 	_headers1="$_headers1 tr1_headers tr2_headers"
    229 	_headers1="$_headers1 decimal_headers c_compatibility_headers_install"
    230 	_headers1="$_headers1 debug_headers parallel_headers"
    231 	_headers1="$_headers1 pb_headers1 pb_headers2 pb_headers3 pb_headers4"
    232 	_headers1="$_headers1 pb_headers5 pb_headers6 pb_headers7"
    233 	_headers1="$_headers1 bits_headers ext_headers host_headers"
    234 	_headers1="$_headers1 pstl_headers"
    235 	_headers1="$_headers1 profile_headers profile_impl_headers"
    236 	_headers1="$_headers1 experimental_headers experimental_bits_headers"
    237 	_headers1="$_headers1 ext_host_headers"
    238 
    239 	# build files
    240 	for h in $_build_headers; do
    241 		write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/$h \
    242 			<$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h
    243 	done
    244 
    245 	write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/symver-config.h \
    246 		<$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h
    247 
    248 	{
    249 		getvars $_PLATFORM/libstdc++-v3/Makefile \
    250 			port_specific_symbol_files
    251 		getvars $_PLATFORM/libstdc++-v3/src/Makefile \
    252 			cxx11_sources \
    253 			cxx17_sources \
    254 			cxx20_sources \
    255 			cxx23_sources \
    256 			cxx26_sources \
    257 			cxx98_sources
    258 
    259 		# libsupc++
    260 		getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \
    261 			sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/'
    262 		getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \
    263 			c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/'
    264 
    265 		# includes
    266 		getvars $_PLATFORM/libstdc++-v3/include/Makefile \
    267 			c_base_headers std_headers | sed -e 's#/[^ 	][^ 	]*/##g' -e 's/\${GNUHOSTDIST}//g'
    268 
    269 		# src
    270 		getvars $_PLATFORM/libstdc++-v3/src/Makefile \
    271 			libstdc___la_SOURCES | sed 's/^G_libstdc___la_SOURCES=/G_SRC_SOURCES=/'
    272 		getvars $_PLATFORM/libstdc++-v3/src/c++17/Makefile \
    273 			libc__17convenience_la_SOURCES | \
    274 			sed -e 's/^G_libc__17convenience_la_SOURCES=/G_CPP17_SOURCES=/'
    275 		getvars $_PLATFORM/libstdc++-v3/src/c++20/Makefile \
    276 			libc__20convenience_la_SOURCES | \
    277 			sed -e 's/^G_libc__20convenience_la_SOURCES=/G_CPP20_SOURCES=/'
    278 		getvars $_PLATFORM/libstdc++-v3/src/c++23/Makefile \
    279 			libc__23convenience_la_SOURCES | \
    280 			sed -e 's/^G_libc__23convenience_la_SOURCES=/G_CPP23_SOURCES=/'
    281 		getvars $_PLATFORM/libstdc++-v3/src/c++26/Makefile \
    282 			libc__26convenience_la_SOURCES | \
    283 			sed -e 's/^G_libc__26convenience_la_SOURCES=/G_CPP26_SOURCES=/'
    284 		getvars $_PLATFORM/libstdc++-v3/src/c++11/Makefile \
    285 			libc__11convenience_la_SOURCES | \
    286 			sed -e 's/^G_libc__11convenience_la_SOURCES=/G_CPP11_SOURCES=/'
    287 		getvars $_PLATFORM/libstdc++-v3/src/c++98/Makefile \
    288 			GLIBCXX_ABI_FLAGS libc__98convenience_la_SOURCES | \
    289 			sed -e 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/'
    290 		getvars $_PLATFORM/libstdc++-v3/src/filesystem/Makefile \
    291 			libstdc__fs_la_SOURCES | \
    292 			sed -e 's/^G_libstdc__fs_la_SOURCES=/G_FILESYSTEM_SOURCES=/'
    293 		getvars $_PLATFORM/libstdc++-v3/Makefile ATOMICITY_SRCDIR \
    294 			BASIC_FILE_CC CLOCALE_CC CCODECVT_CC CCOLLATE_CC \
    295 			CCTYPE_CC  CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC \
    296 			CPU_OPT_BITS_RANDOM
    297 
    298 		# includes
    299 		getvars $_PLATFORM/libstdc++-v3/include/Makefile \
    300 			$_headers1 | \
    301 				sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' \
    302 				    -e 's#\${GNUHOSTDIST}/libstdc++-v3/config/##g'
    303 		getvars $_PLATFORM/libstdc++-v3/include/Makefile \
    304 			BASIC_FILE_H ALLOCATOR_H CSTDIO_H CLOCALE_H CMESSAGES_H CTIME_H
    305 	} | sanitise_includes \
    306 	  | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/defs.mk
    307 }
    308 
    309 ##### lib/libsanitizer #####
    310 
    311 get_libsanitizer () {
    312 	_subdir="$1"
    313 
    314 	mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH
    315 
    316 	{
    317 		getvars $_PLATFORM/libsanitizer/asan/Makefile \
    318 			asan_files
    319 		getvars $_PLATFORM/libsanitizer/lsan/Makefile \
    320 			lsan_files
    321 		getvars $_PLATFORM/libsanitizer/tsan/Makefile \
    322 			tsan_files
    323 		getvars $_PLATFORM/libsanitizer/ubsan/Makefile \
    324 			ubsan_files
    325 		getvars $_PLATFORM/libsanitizer/interception/Makefile \
    326 			interception_files
    327 
    328 	} | sanitise_includes \
    329 	  | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/defs.mk
    330 }
    331 
    332 ##### usr.bin/gcc* #####
    333 
    334 get_gcc_bootstrap () {
    335 	_subdir="$1"
    336 	mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH
    337 	for f in auto-host tm config; do
    338 		write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h
    339 	done
    340 	# XXXGCC5 don't really want to copy insn-modes as we build
    341 	# it but libgcc needs to too early yet
    342 	for f in insn-modes; do
    343 		write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h
    344 	done
    345 }
    346 
    347 get_gcc () {
    348 	_subdir="$1"
    349 	mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH
    350 	mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$_MACHINE_ARCH
    351 	mkdir -p $_OUTDIR/usr.bin/include/arch
    352 	mkdir -p $_OUTDIR/usr.bin/common-target/arch
    353 	_buildname="BUILD_"
    354 	_libcppsubdir=""
    355 	_extravars="TM_H ALL_OPT_FILES ALL_OPT_URL_FILES"
    356 	_hconfig_h=""
    357 	_extravars2="tm_file_list build_xm_include_list"
    358 	_extravars3="tm_p_include_list"
    359 
    360 	{
    361 		getvars gcc/Makefile \
    362 			${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \
    363 			${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY \
    364 			${_buildname}MD | \
    365 		    sed -e 's#build/errors.o#build-errors.o#g' \
    366 			-e 's#build/print-rtl.o#build-print-rtl.o#g' \
    367 			-e 's#build/rtl.o#build-rtl.o#g' \
    368 			-e 's#build/varray.o#build-varray.o#g' \
    369 			-e 's#build/ggc-none.o#build-ggc-none.o#g' \
    370 			-e 's#build/##g'
    371 		getvars gcc/Makefile \
    372 			ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \
    373 			GCC_OBJS GCOV_OBJS GCOV_DUMP_OBJS GXX_OBJS GTM_H PROTO_OBJS ${_extravars1} \
    374 			INCLUDES md_file OBJC_OBJS OBJS out_file version \
    375 			BUILD_PREFIX RTL_H RTL_BASE_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \
    376 			D_TARGET_DEF \
    377 			GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \
    378 			GTFILES GTFILES_LANG_DIR_NAMES HASH_TABLE_H \
    379 			NOEXCEPTION_FLAGS NATIVE_SYSTEM_HEADER_DIR \
    380 			tm_defines host_xm_file host_xm_defines tm_p_file \
    381 			target_cpu_default ${_extravars} ${_extravars2} \
    382 			lang_specs_files ${_extravars3} \
    383 			common_out_file \
    384 				| sanitise_includes
    385 		getvars gcc/Makefile \
    386 			LIB2ADDEHDEP | sed 's/unwind.inc//'
    387 		getvars gcc/Makefile \
    388 			CXX_OBJS CXX_C_OBJS | sed 's/cp\///g'
    389 		getvars gcc/Makefile \
    390 			F77_OBJS | sed 's/f\///g'
    391 		getvars libcpp/Makefile \
    392 			libcpp_a_OBJS
    393 		getvars gcc/Makefile \
    394 			ENABLE_SHARED
    395 		echo G_SHLIB_LINK="$CC -shared"
    396 		echo G_SHLIB_MULTILIB=.
    397 	} | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/defs.mk
    398 
    399 	getvars gcc/Makefile \
    400 		EXTRA_HEADERS \
    401 			| write_mk $_OUTDIRBASE/usr.bin/include/arch/$_MACHINE_ARCH.mk
    402 
    403 	getvars gcc/Makefile \
    404 		OBJS-libcommon \
    405 			| write_mk $_OUTDIRBASE/usr.bin/common/defs.mk
    406 	getvars gcc/Makefile \
    407 		OBJS-libcommon-target \
    408 			| write_mk $_OUTDIRBASE/usr.bin/common-target/arch/$_MACHINE_ARCH.mk
    409 
    410 	write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$_MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h
    411 	hfiles='auto-host configargs config bconfig bversion plugin-version multilib tm omp-device-properties'
    412 	for f in $hfiles; do
    413 		write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h
    414 		if [ "${_MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ]
    415 		then
    416 			ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h
    417 /configuration_arguments/ s/$//
    418 ya
    419 i
    420 #ifdef _SOFT_FLOAT
    421 .
    422 pu
    423 s/";$/ -with-float=soft";/
    424 a
    425 #else
    426 #endif
    427 .
    428 . m +1
    429 /configure_default_options/ s/{ NULL.*$//
    430 a
    431 #ifdef _SOFT_FLOAT
    432   { "float", "soft" },
    433 #endif
    434   { NULL, NULL }
    435 };
    436 .
    437 wq
    438 __EOF__
    439 		fi
    440 		if [ "${f}" = "configargs" ]
    441 		then
    442 			_srcquoted=$(echo "$_SRC" | sed 's/\//\\\//g')
    443 			sed -i -E -e "s,$_srcquoted,/usr/src,g" \
    444 				  -e 's/--build=[^ ]+ --host=([^ ]+)/--build=\1 --host=\1/' \
    445 				$_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h
    446 		fi
    447 	done
    448 
    449 	# keep identical
    450 	for f in all-tree.def; do
    451 		cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f
    452 	done
    453 
    454 	# special transforms
    455 	for f in gtyp-input.list; do
    456 		sed -e "s@^.*$_OUTDIRBASE/dist@SRCDIR@" < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f
    457 	done
    458 
    459 	# special platforms
    460 	if [ "${_MACHINE_ARCH}" = "sh3el" -o "${_MACHINE_ARCH}" = "sh3eb" ]; then
    461 		write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h
    462 	fi
    463 
    464 	if [ "${_MACHINE_ARCH}" = "i386" -o "${_MACHINE_ARCH}" = "x86_64" ]; then
    465 		write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/i386-builtin-types.inc <$_TMPDIR/gcc/i386-builtin-types.inc
    466 	fi
    467 
    468 	case "${_MACHINE_ARCH}" in
    469 	(*arm*)
    470 		d=$_OUTDIRBASE/usr.bin/$_subdir/arch/${_MACHINE_ARCH}
    471 		for f in arm-cpu.h arm-cpu-cdata.h arm-cpu-data.h arm-isa.h; do
    472 			write_c $d/$f <$_TMPDIR/gcc/$f
    473 		done
    474 		;;
    475 	esac
    476 }
    477 
    478 ##### main #####
    479 
    480 case "$1" in
    481 # .mk and .h files for libgcc bootstrap (from host build)
    482 
    483 libgcc*-bootstrap)
    484 	get_libgcc gcc
    485 	get_libgcov gcc $_PLATFORM/libgcc/Makefile
    486 	get_gcc_bootstrap gcc
    487 	exit 0
    488 	;;
    489 
    490 libstdc++-bootstrap)
    491 	get_libstdcxx_v3 libstdc++-v3 gcc
    492 	exit 0
    493 	;;
    494 
    495 gcc*)
    496 	get_gcc gcc
    497 	get_libgcc gcc
    498 	get_libgcov gcc $_PLATFORM/libgcc/Makefile
    499 	get_gcc_bootstrap gcc
    500 	get_gcc_libiberty gcc
    501 	get_libobjc libobjc
    502 	get_libstdcxx_v3 libstdc++-v3 gcc
    503 	# wants libstdc++-v3 built
    504 	# get_libsanitizer libsanitizer
    505 	get_libdecnumber libdecnumber
    506 	get_libgomp libgomp
    507 	get_libbacktrace libbacktrace
    508 	exit 0
    509 	;;
    510 
    511 
    512 *)
    513 	echo invalid arguments;
    514 	exit 1
    515 	;;
    516 esac
    517