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