From 6e26327fd8d74aaeab46bd3eb2e7034839f6ecc5 Mon Sep 17 00:00:00 2001 From: mrg Date: Sun, 6 Sep 2020 02:24:38 +0000 Subject: [PATCH] pass down earm* not earmv5* to mknative-gcc. --- tools/gcc/Makefile | 15 ++--- tools/gcc/mknative-gcc | 115 +++++++++++++++++++------------------ tools/gcc/mknative-gcc.old | 107 +++++++++++++++++----------------- 3 files changed, 120 insertions(+), 117 deletions(-) diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile index b8510b51edb6..dc6ef2de451c 100644 --- a/tools/gcc/Makefile +++ b/tools/gcc/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.99 2020/09/05 10:58:08 mrg Exp $ +# $NetBSD: Makefile,v 1.100 2020/09/06 02:24:38 mrg Exp $ .include @@ -95,7 +95,6 @@ MKNATIVE_CONFIG_TARGET_LIBS= MKNATIVE_CONFIG_TARGET_LIBS+= configure-target-libgcc MKNATIVE_CONFIG_TARGET_LIBS+= configure-target-libgomp -MKNATIVE_TARGET= gcc MKNATIVE_CONFIG_TARGET_LIBS+= \ configure-target-libstdc++-v3 \ @@ -142,25 +141,27 @@ CCADDFLAGS= --sysroot=${DESTDIR} -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTD # in case the version being used is not. NEWCONFIGDIR?= ${.CURDIR}/../.. +GCC_MACHINE_ARCH= ${MACHINE_ARCH:S/earmv5/earm/} + bootstrap-libgcc: .configure_done @echo 'Creating files needed for libgcc by a native bootstrap build.' (cd ${.OBJDIR}/build && ${BUILD_COMMAND} configure-target-libgcc) - @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} lib${MKNATIVE_TARGET}-bootstrap \ + @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} libgcc-bootstrap \ ${.OBJDIR}/build ${NEWCONFIGDIR} ${NETBSDSRCDIR} \ - ${MACHINE_GNU_PLATFORM} ${DESTDIR} ${TOOLDIR} + ${MACHINE_GNU_PLATFORM} ${GCC_MACHINE_ARCH} ${DESTDIR} ${TOOLDIR} bootstrap-libstdc++: .configure_done @echo 'Creating files needed for libstdc++ by a native bootstrap build.' (cd ${.OBJDIR}/build && ${BUILD_COMMAND} configure-target-libstdc++-v3) @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} libstdc++-bootstrap \ ${.OBJDIR}/build ${NEWCONFIGDIR} ${NETBSDSRCDIR} \ - ${MACHINE_GNU_PLATFORM} ${DESTDIR} ${TOOLDIR} + ${MACHINE_GNU_PLATFORM} ${GCC_MACHINE_ARCH} ${DESTDIR} ${TOOLDIR} native-gcc: .native/.configure_done @echo 'Extracting GNU GCC configury for a native toolchain.' - @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \ + @MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} gcc \ ${.OBJDIR}/.native ${NEWCONFIGDIR} ${NETBSDSRCDIR} \ - ${MACHINE_GNU_PLATFORM} ${DESTDIR} ${TOOLDIR} + ${MACHINE_GNU_PLATFORM} ${GCC_MACHINE_ARCH} ${DESTDIR} ${TOOLDIR} NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS} MPC= ${NETBSDSRCDIR}/external/lgpl3/mpc diff --git a/tools/gcc/mknative-gcc b/tools/gcc/mknative-gcc index 76ccb8c022a6..0efd07da2e0e 100755 --- a/tools/gcc/mknative-gcc +++ b/tools/gcc/mknative-gcc @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mknative-gcc,v 1.108 2020/09/05 10:58:08 mrg Exp $ +# $NetBSD: mknative-gcc,v 1.109 2020/09/06 02:24:38 mrg Exp $ # # Shell script for generating all the constants needed for a native # platform build of gcc. @@ -12,8 +12,9 @@ _TMPDIR=$2 _TOP=$3 _SRC=$4 _PLATFORM=$5 -_DESTDIR=$6 -_TOOLDIR=$7 +_MACHINE_ARCH=$6 +_DESTDIR=$7 +_TOOLDIR=$8 _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` _GNU_DIST=`cd ${_VPATH}; pwd` @@ -47,10 +48,10 @@ sanitise_includes () { ##### lib/libg2c ##### get_libg2c () { - mkdir -p $_OUTDIR/lib/libg2c3/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/libg2c3/arch/$_MACHINE_ARCH - write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h - write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h + write_c $_OUTDIRBASE/lib/libg2c3/arch/$_MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h + write_c $_OUTDIRBASE/lib/libg2c3/arch/$_MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h { getvars $_PLATFORM/libf2c/Makefile \ @@ -61,7 +62,7 @@ get_libg2c () { ALL_CFLAGS OBJS | sed 's,=,+=,' getvars $_PLATFORM/libf2c/libU77/Makefile \ ALL_CFLAGS OBJS | sed 's,=,+=,' - } | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk + } | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$_MACHINE_ARCH/defs.mk } ##### lib/libgcc ##### @@ -74,7 +75,7 @@ get_libgcc () { # XXX we should probably grab everything Just In Case for # the future. - mkdir -p $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/lib$_subdir/arch/$_MACHINE_ARCH cd $_TMPDIR/$_PLATFORM/libgcc { getvars $_PLATFORM/libgcc/Makefile \ @@ -90,7 +91,7 @@ get_libgcc () { getvars gcc/Makefile \ NOEXCEPTION_FLAGS EXTRA_HEADERS } | sanitise_includes \ - | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk + | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$_MACHINE_ARCH/defs.mk cd $_TMPDIR/$_PLATFORM/libgcc { @@ -99,18 +100,18 @@ get_libgcc () { unwind_header md_unwind_header \ sfp_machine_header thread_header } | sanitise_includes \ - | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/gthr-defs.mk + | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$_MACHINE_ARCH/gthr-defs.mk - if [ "${MACHINE_ARCH}" = "m68000" ] + if [ "${_MACHINE_ARCH}" = "m68000" ] then - ex <<__EOF__ $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk + ex <<__EOF__ $_OUTDIR/lib/lib$_subdir/arch/$_MACHINE_ARCH/defs.mk /G_LIBGCC2_CFLAGS/ s/-fPIC// wq __EOF__ fi for f in auto-target.h; do - write_c $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/$f \ + write_c $_OUTDIRBASE/lib/lib$_subdir/arch/$_MACHINE_ARCH/$f \ <$_TMPDIR/$_PLATFORM/libgcc/$f done } @@ -121,7 +122,7 @@ get_libgcov () { _subdir="$1" _mf="$2" - mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$_MACHINE_ARCH { getvars $_mf \ @@ -129,9 +130,9 @@ get_libgcov () { LIBGCOV_PROFILER \ LIBGCOV_INTERFACE \ LIBGCOV_DRIVER - } | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk + } | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$_MACHINE_ARCH/defs.mk - write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ + write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$_MACHINE_ARCH/gcov-iov.h \ <$_TMPDIR/gcc/gcov-iov.h } @@ -141,13 +142,13 @@ get_libgcov () { get_gcc_libiberty () { _subdir="$1" _libibertydir="lib/libiberty" - mkdir -p $_OUTDIR/$_libibertydir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/$_libibertydir/arch/$_MACHINE_ARCH getvars libiberty/Makefile \ ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ | write_mk $_OUTDIRBASE/$_libibertydir/defs.mk - write_c $_OUTDIRBASE/$_libibertydir/arch/$MACHINE_ARCH/config.h \ + write_c $_OUTDIRBASE/$_libibertydir/arch/$_MACHINE_ARCH/config.h \ <$_TMPDIR/libiberty/config.h } @@ -156,8 +157,8 @@ get_gcc_libiberty () { get_libdecnumber () { _subdir="$1" - mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/config.h \ + mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/config.h \ <$_TMPDIR/libdecnumber/config.h } @@ -166,19 +167,19 @@ get_libdecnumber () { get_libgomp () { _subdir="$1" - mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH getvars $_PLATFORM/libgomp/Makefile \ libgomp_la_SOURCES \ | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/config.h \ <$_TMPDIR/$_PLATFORM/libgomp/config.h - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp_f.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/libgomp_f.h \ <$_TMPDIR/$_PLATFORM/libgomp/libgomp_f.h - write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp.spec \ + write_mk $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/libgomp.spec \ <$_TMPDIR/$_PLATFORM/libgomp/libgomp.spec - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/omp.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/omp.h \ <$_TMPDIR/$_PLATFORM/libgomp/omp.h } @@ -187,17 +188,17 @@ get_libgomp () { get_libbacktrace () { _subdir="$1" - mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ + mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/config.h \ <$_TMPDIR/$_PLATFORM/$_subdir/config.h - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/backtrace-supported.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/backtrace-supported.h \ <$_TMPDIR/$_PLATFORM/$_subdir/backtrace-supported.h } ##### lib/libobjc ##### get_libobjc () { - _subdir="$1/arch/$MACHINE_ARCH" + _subdir="$1/arch/$_MACHINE_ARCH" _options="ALL_OPT_FILES" mkdir -p $_OUTDIR/lib/$_subdir @@ -222,7 +223,7 @@ get_libstdcxx_v3 () { _subdir="$1" _ver="$2" - mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH _build_headers="c++config.h cxxabi_tweaks.h" _headers1="c_base_headers_extra_install" @@ -234,13 +235,13 @@ get_libstdcxx_v3 () { # build files for h in $_build_headers; do - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/$h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/$h \ <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h done - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/gstdint.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/gstdint.h \ <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/symver-config.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/symver-config.h \ <$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h { @@ -295,7 +296,7 @@ get_libstdcxx_v3 () { getvars $_PLATFORM/libstdc++-v3/include/Makefile \ BASIC_FILE_H ALLOCATOR_H CSTDIO_H CLOCALE_H CMESSAGES_H CTIME_H } | sanitise_includes \ - | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk + | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/defs.mk } ##### lib/libsanitizer ##### @@ -303,7 +304,7 @@ get_libstdcxx_v3 () { get_libsanitizer () { _subdir="$1" - mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH { getvars $_PLATFORM/libsanitizer/asan/Makefile \ @@ -316,28 +317,28 @@ get_libsanitizer () { ubsan_plugin_files } | sanitise_includes \ - | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk + | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/defs.mk } ##### usr.bin/gcc* ##### get_gcc_bootstrap () { _subdir="$1" - mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH for f in auto-host tm config; do - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h done # XXXGCC5 don't really want to copy insn-modes as we build # it but libgcc needs to too early yet for f in insn-modes; do - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h done } get_gcc () { _subdir="$1" - mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH - mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH + mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$_MACHINE_ARCH mkdir -p $_OUTDIR/usr.bin/include/arch mkdir -p $_OUTDIR/usr.bin/common-target/arch _buildname="BUILD_" @@ -384,26 +385,26 @@ get_gcc () { ENABLE_SHARED echo G_SHLIB_LINK="$CC -shared" echo G_SHLIB_MULTILIB=. - } | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk + } | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/defs.mk getvars gcc/Makefile \ EXTRA_HEADERS \ - | write_mk $_OUTDIRBASE/usr.bin/include/arch/$MACHINE_ARCH.mk + | write_mk $_OUTDIRBASE/usr.bin/include/arch/$_MACHINE_ARCH.mk getvars gcc/Makefile \ OBJS-libcommon \ | write_mk $_OUTDIRBASE/usr.bin/common/defs.mk getvars gcc/Makefile \ OBJS-libcommon-target \ - | write_mk $_OUTDIRBASE/usr.bin/common-target/arch/$MACHINE_ARCH.mk + | write_mk $_OUTDIRBASE/usr.bin/common-target/arch/$_MACHINE_ARCH.mk - write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h + write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$_MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h hfiles='auto-host configargs config bconfig bversion plugin-version multilib tm' for f in $hfiles; do - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h - if [ "${MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h + if [ "${_MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] then - ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h + ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h /configuration_arguments/ s/$// ya i @@ -432,32 +433,32 @@ __EOF__ _srcquoted=$(echo "$_SRC" | sed 's/\//\\\//g') sed -i -E -e "s,$_srcquoted,/usr/src,g" \ -e 's/--build=[^ ]+ --host=([^ ]+)/--build=\1 --host=\1/' \ - $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h + $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h fi done # keep identical for f in all-tree.def; do - cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f + cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f done # special transforms for f in gtyp-input.list; do - sed -e "s@^.*$_OUTDIRBASE/dist@SRCDIR@" < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f + sed -e "s@^.*$_OUTDIRBASE/dist@SRCDIR@" < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f done # special platforms - if [ "${MACHINE_ARCH}" = "sh3el" -o "${MACHINE_ARCH}" = "sh3eb" ]; then - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h + if [ "${_MACHINE_ARCH}" = "sh3el" -o "${_MACHINE_ARCH}" = "sh3eb" ]; then + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h fi - if [ "${MACHINE_ARCH}" = "i386" -o "${MACHINE_ARCH}" = "x86_64" ]; then - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/i386-builtin-types.inc <$_TMPDIR/gcc/i386-builtin-types.inc + if [ "${_MACHINE_ARCH}" = "i386" -o "${_MACHINE_ARCH}" = "x86_64" ]; then + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/i386-builtin-types.inc <$_TMPDIR/gcc/i386-builtin-types.inc fi - case "${MACHINE_ARCH}" in + case "${_MACHINE_ARCH}" in (*arm*) - d=$_OUTDIRBASE/usr.bin/$_subdir/arch/${MACHINE_ARCH} + d=$_OUTDIRBASE/usr.bin/$_subdir/arch/${_MACHINE_ARCH} for f in arm-cpu.h arm-cpu-cdata.h arm-cpu-data.h arm-isa.h; do write_c $d/$f <$_TMPDIR/gcc/$f done diff --git a/tools/gcc/mknative-gcc.old b/tools/gcc/mknative-gcc.old index 02ff8e44b5a1..efe3693b4b9c 100755 --- a/tools/gcc/mknative-gcc.old +++ b/tools/gcc/mknative-gcc.old @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mknative-gcc.old,v 1.8 2020/08/13 01:52:37 mrg Exp $ +# $NetBSD: mknative-gcc.old,v 1.9 2020/09/06 02:24:38 mrg Exp $ # # Shell script for generating all the constants needed for a native # platform build of gcc. @@ -12,8 +12,9 @@ _TMPDIR=$2 _TOP=$3 _SRC=$4 _PLATFORM=$5 -_DESTDIR=$6 -_TOOLDIR=$7 +_MACHINE_ARCH=$6 +_DESTDIR=$7 +_TOOLDIR=$8 _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` _GNU_DIST=`cd ${_VPATH}; pwd` @@ -47,10 +48,10 @@ sanitise_includes () { ##### lib/libg2c ##### get_libg2c () { - mkdir -p $_OUTDIR/lib/libg2c3/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/libg2c3/arch/$_MACHINE_ARCH - write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h - write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h + write_c $_OUTDIRBASE/lib/libg2c3/arch/$_MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h + write_c $_OUTDIRBASE/lib/libg2c3/arch/$_MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h { getvars $_PLATFORM/libf2c/Makefile \ @@ -61,7 +62,7 @@ get_libg2c () { ALL_CFLAGS OBJS | sed 's,=,+=,' getvars $_PLATFORM/libf2c/libU77/Makefile \ ALL_CFLAGS OBJS | sed 's,=,+=,' - } | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk + } | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$_MACHINE_ARCH/defs.mk } ##### lib/libgcc ##### @@ -74,7 +75,7 @@ get_libgcc () { # XXX we should probably grab everything Just In Case for # the future. - mkdir -p $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/lib$_subdir/arch/$_MACHINE_ARCH cd $_TMPDIR/$_PLATFORM/libgcc { getvars $_PLATFORM/libgcc/Makefile \ @@ -90,7 +91,7 @@ get_libgcc () { getvars gcc/Makefile \ NOEXCEPTION_FLAGS EXTRA_HEADERS } | sanitise_includes \ - | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk + | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$_MACHINE_ARCH/defs.mk cd $_TMPDIR/$_PLATFORM/libgcc { @@ -99,18 +100,18 @@ get_libgcc () { unwind_header md_unwind_header \ sfp_machine_header thread_header } | sanitise_includes \ - | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/gthr-defs.mk + | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$_MACHINE_ARCH/gthr-defs.mk - if [ "${MACHINE_ARCH}" = "m68000" ] + if [ "${_MACHINE_ARCH}" = "m68000" ] then - ex <<__EOF__ $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk + ex <<__EOF__ $_OUTDIR/lib/lib$_subdir/arch/$_MACHINE_ARCH/defs.mk /G_LIBGCC2_CFLAGS/ s/-fPIC// wq __EOF__ fi for f in auto-target.h; do - write_c $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/$f \ + write_c $_OUTDIRBASE/lib/lib$_subdir/arch/$_MACHINE_ARCH/$f \ <$_TMPDIR/$_PLATFORM/libgcc/$f done } @@ -121,7 +122,7 @@ get_libgcov () { _subdir="$1" _mf="$2" - mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$_MACHINE_ARCH { getvars $_mf \ @@ -129,9 +130,9 @@ get_libgcov () { LIBGCOV_PROFILER \ LIBGCOV_INTERFACE \ LIBGCOV_DRIVER - } | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk + } | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$_MACHINE_ARCH/defs.mk - write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ + write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$_MACHINE_ARCH/gcov-iov.h \ <$_TMPDIR/gcc/gcov-iov.h } @@ -141,13 +142,13 @@ get_libgcov () { get_gcc_libiberty () { _subdir="$1" _libibertydir="lib/libiberty" - mkdir -p $_OUTDIR/$_libibertydir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/$_libibertydir/arch/$_MACHINE_ARCH getvars libiberty/Makefile \ ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ | write_mk $_OUTDIRBASE/$_libibertydir/defs.mk - write_c $_OUTDIRBASE/$_libibertydir/arch/$MACHINE_ARCH/config.h \ + write_c $_OUTDIRBASE/$_libibertydir/arch/$_MACHINE_ARCH/config.h \ <$_TMPDIR/libiberty/config.h } @@ -156,8 +157,8 @@ get_gcc_libiberty () { get_libdecnumber () { _subdir="$1" - mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/config.h \ + mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/config.h \ <$_TMPDIR/libdecnumber/config.h } @@ -166,19 +167,19 @@ get_libdecnumber () { get_libgomp () { _subdir="$1" - mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH getvars $_PLATFORM/libgomp/Makefile \ libgomp_la_SOURCES \ | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/config.h \ <$_TMPDIR/$_PLATFORM/libgomp/config.h - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp_f.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/libgomp_f.h \ <$_TMPDIR/$_PLATFORM/libgomp/libgomp_f.h - write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp.spec \ + write_mk $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/libgomp.spec \ <$_TMPDIR/$_PLATFORM/libgomp/libgomp.spec - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/omp.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/omp.h \ <$_TMPDIR/$_PLATFORM/libgomp/omp.h } @@ -187,17 +188,17 @@ get_libgomp () { get_libbacktrace () { _subdir="$1" - mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ + mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/config.h \ <$_TMPDIR/$_PLATFORM/$_subdir/config.h - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/backtrace-supported.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/backtrace-supported.h \ <$_TMPDIR/$_PLATFORM/$_subdir/backtrace-supported.h } ##### lib/libobjc ##### get_libobjc () { - _subdir="$1/arch/$MACHINE_ARCH" + _subdir="$1/arch/$_MACHINE_ARCH" _options="ALL_OPT_FILES" mkdir -p $_OUTDIR/lib/$_subdir @@ -222,7 +223,7 @@ get_libstdcxx_v3 () { _subdir="$1" _ver="$2" - mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/lib/$_subdir/arch/$_MACHINE_ARCH _build_headers="c++config.h cxxabi_tweaks.h" _headers1="c_base_headers_extra_install" @@ -234,13 +235,13 @@ get_libstdcxx_v3 () { # build files for h in $_build_headers; do - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/$h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/$h \ <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h done - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/gstdint.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/gstdint.h \ <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h - write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/symver-config.h \ + write_c $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/symver-config.h \ <$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h { @@ -291,28 +292,28 @@ get_libstdcxx_v3 () { getvars $_PLATFORM/libstdc++-v3/include/Makefile \ BASIC_FILE_H ALLOCATOR_H CSTDIO_H CLOCALE_H CMESSAGES_H CTIME_H } | sanitise_includes \ - | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk + | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$_MACHINE_ARCH/defs.mk } ##### usr.bin/gcc* ##### get_gcc_bootstrap () { _subdir="$1" - mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH for f in auto-host tm config; do - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h done # XXXGCC5 don't really want to copy insn-modes as we build # it but libgcc needs to too early yet for f in insn-modes; do - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h done } get_gcc () { _subdir="$1" - mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH - mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$MACHINE_ARCH + mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH + mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$_MACHINE_ARCH mkdir -p $_OUTDIR/usr.bin/include/arch mkdir -p $_OUTDIR/usr.bin/common-target/arch _buildname="BUILD_" @@ -359,26 +360,26 @@ get_gcc () { ENABLE_SHARED echo G_SHLIB_LINK="$CC -shared" echo G_SHLIB_MULTILIB=. - } | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk + } | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/defs.mk getvars gcc/Makefile \ EXTRA_HEADERS \ - | write_mk $_OUTDIRBASE/usr.bin/include/arch/$MACHINE_ARCH.mk + | write_mk $_OUTDIRBASE/usr.bin/include/arch/$_MACHINE_ARCH.mk getvars gcc/Makefile \ OBJS-libcommon \ | write_mk $_OUTDIRBASE/usr.bin/common/defs.mk getvars gcc/Makefile \ OBJS-libcommon-target \ - | write_mk $_OUTDIRBASE/usr.bin/common-target/arch/$MACHINE_ARCH.mk + | write_mk $_OUTDIRBASE/usr.bin/common-target/arch/$_MACHINE_ARCH.mk - write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h + write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$_MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h hfiles='auto-host configargs config bconfig bversion plugin-version multilib tm' for f in $hfiles; do - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h - if [ "${MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h + if [ "${_MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] then - ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h + ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h /configuration_arguments/ s/$// ya i @@ -407,27 +408,27 @@ __EOF__ _srcquoted=$(echo "$_SRC" | sed 's/\//\\\//g') sed -i -E -e "s,$_srcquoted,/usr/src,g" \ -e 's/--build=[^ ]+ --host=([^ ]+)/--build=\1 --host=\1/' \ - $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h + $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f.h fi done # keep identical for f in all-tree.def; do - cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f + cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f done # special transforms for f in gtyp-input.list; do - sed -e "s@^.*$_OUTDIRBASE/dist@SRCDIR@" < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f + sed -e "s@^.*$_OUTDIRBASE/dist@SRCDIR@" < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$_MACHINE_ARCH/$f done # special platforms - if [ "${MACHINE_ARCH}" = "sh3el" -o "${MACHINE_ARCH}" = "sh3eb" ]; then - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h + if [ "${_MACHINE_ARCH}" = "sh3el" -o "${_MACHINE_ARCH}" = "sh3eb" ]; then + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h fi - if [ "${MACHINE_ARCH}" = "i386" -o "${MACHINE_ARCH}" = "x86_64" ]; then - write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/i386-builtin-types.inc <$_TMPDIR/gcc/i386-builtin-types.inc + if [ "${_MACHINE_ARCH}" = "i386" -o "${_MACHINE_ARCH}" = "x86_64" ]; then + write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$_MACHINE_ARCH/i386-builtin-types.inc <$_TMPDIR/gcc/i386-builtin-types.inc fi }