Merge gcc-4.8 mknative bits.

This commit is contained in:
christos 2014-02-17 21:39:43 +00:00
parent 0df5988fd8
commit 8140d3b7fb
3 changed files with 494 additions and 23 deletions

View File

@ -1,14 +1,25 @@
# $NetBSD: Makefile,v 1.62 2014/02/16 11:26:31 skrll Exp $
# $NetBSD: Makefile,v 1.63 2014/02/17 21:39:43 christos Exp $
.include <bsd.own.mk>
GCC_LANGUAGES=c c++ objc
MODULE= gcc4
.if ${HAVE_GCC} == 45
.if ${HAVE_GCC} == 48
CC_FOR_BUILD= ${HOST_CXX:Q}
LIB_INTL=
MKNATIVE= ${.CURDIR}/mknative-gcc48
GNUHOSTDIST= ${.CURDIR}/../../external/gpl3/yagcc/dist
.elif ${HAVE_GCC} == 45
GNUHOSTDIST= ${.CURDIR}/../../external/gpl3/gcc/dist
UNWIND_H=unwind.h
.endif
# Defaults
CC_FOR_BUILD?= ${HOST_CC:Q}
LIB_INTL?= "LIBS=-lintl"
MKNATIVE?= ${.CURDIR}/mknative-gcc
.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64"
MULTILIB_ARGS= --enable-multilib
.else
@ -36,6 +47,7 @@ COMMON_CONFIGURE_ARGS+= --with-tune=${GCC_CONFIG_TUNE.${MACHINE_ARCH}}
CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
.if ${HAVE_GCC} >= 45
CONFIGURE_ARGS+= \
--with-sysroot=${DESTDIR} \
--with-mpc=${TOOLDIR} \
--with-mpfr=${TOOLDIR} \
--with-gmp=${TOOLDIR}
@ -47,8 +59,7 @@ CONFIGURE_ARGS+= \
--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
--enable-languages="${GCC_LANGUAGES}"
GCC_CPPFLAGS= -DNETBSD_TOOLS -DTARGET_SYSTEM_ROOT=0 \
-DTARGET_SYSTEM_ROOT_RELOCATABLE
GCC_CPPFLAGS= -DNETBSD_TOOLS
MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} \
LIBGCC= LIBGCC1= LIBGCC1_TEST= LIBGCC2= INSTALL_LIBGCC= \
@ -67,11 +78,17 @@ BUILD_MAKE=${TOOL_GMAKE}
#
# mknative-gcc specific stuff
#
MKNATIVE_CONFIG_TARGET_LIBS= \
configure-target-libstdc++-v3 \
configure-target-libobjc
.if ${HAVE_GCC} == 45
.if ${HAVE_GCC} == 48
MKNATIVE_CONFIG_TARGET_LIBS += configure-target-libgcc
MKNATIVE_TARGET= gcc48
MKNATIVE_CONFIG_TARGET_LIBS+= \
configure-target-libgomp
.elif ${HAVE_GCC} == 45
MKNATIVE_TARGET= gcc45
MKNATIVE_CONFIG_TARGET_LIBS+= \
configure-target-libgomp
@ -81,8 +98,11 @@ MKNATIVE_TARGET= gcc4
BINENV= /usr/bin/env -i
MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*} \
CC_FOR_BUILD=${HOST_CC:Q} \
CC_FOR_BUILD=${CC_FOR_BUILD:Q} \
CXX_FOR_BUILD=${HOST_CXX:Q} \
CFLAGS_FOR_BUILD="-I${TOOLDIR}/include" \
CC=${CC:Q}' '${CCADDFLAGS:Q} \
CXX=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
@ -91,7 +111,7 @@ MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*} \
MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
NM=${NM:Q} OBJDUMP=${OBJDUMP:Q} \
XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
LIBS=-lintl \
${LIB_INTL} \
ac_cv_prog_cc_cross=yes \
ac_cv_func_strcoll_works=yes \
ac_cv_func_elf_getshstrndx=no \
@ -114,19 +134,28 @@ CCADDFLAGS= --sysroot=${DESTDIR} -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTD
# NEWCONFIGDIR can be set to a read-write location of the source tree
# in case the version being used is not.
NEWCONFIGDIR?= ${.CURDIR}/../..
MKNATIVE?= ${.CURDIR}/mknative-gcc
bootstrap-libgcc: .configure_done
@echo 'Creating files needed for libgcc by a native bootstrap build.'
@MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} lib${MKNATIVE_TARGET} \
(cd ${.OBJDIR}/build && ${BUILD_COMMAND} configure-target-libgcc)
@MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} lib${MKNATIVE_TARGET}-bootstrap \
${.OBJDIR}/build ${NEWCONFIGDIR} ${NETBSDSRCDIR} \
${MACHINE_GNU_PLATFORM} ${DESTDIR}
${MACHINE_GNU_PLATFORM} ${DESTDIR} ${TOOLDIR}
.if ${HAVE_GCC} == "48"
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}
.endif
native-gcc: .native/.configure_done
@echo 'Extracting GNU GCC configury for a native toolchain.'
@MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
${.OBJDIR}/.native ${NEWCONFIGDIR} ${NETBSDSRCDIR} \
${MACHINE_GNU_PLATFORM} ${DESTDIR}
${MACHINE_GNU_PLATFORM} ${DESTDIR} ${TOOLDIR}
NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
.if ${HAVE_GCC} >= 45
@ -137,24 +166,31 @@ MPCOBJ!= cd ${MPC}/lib/libmpc && ${PRINTOBJDIR}
MPFROBJ!= cd ${MPFR}/lib/libmpfr && ${PRINTOBJDIR}
GMPOBJ!= cd ${GMP}/lib/libgmp && ${PRINTOBJDIR}
GMP_MACHINE_ARCH?= ${MACHINE_ARCH:S/earmv4/arm/:C/armv[5-7]/arm/}
NATIVE_CONFIGURE_ARGS+= \
--with-mpc-lib=${MPCOBJ} \
--with-mpfr-lib=${MPFROBJ} \
--with-gmp-lib=${GMPOBJ} \
--with-mpc-include=${MPC}/dist/src \
--with-mpfr-include=${MPFR}/dist/src \
--with-gmp-include=${GMP}/lib/libgmp/arch/${MACHINE_ARCH}
--with-gmp-include=${GMP}/lib/libgmp/arch/${GMP_MACHINE_ARCH}
. if ${MACHINE_ARCH} != "vax"
NATIVE_CONFIGURE_ARGS+= --enable-tls
. endif
. if !empty(MACHINE_ARCH:Mearm*)
NATIVE_CONFIGURE_ARGS+= --enable-initfini-array
. endif
.endif
NATIVE_CONFIGURE_ARGS+= \
--disable-multilib \
--disable-symvers \
--disable-libstdcxx-pch \
--build=`${GCCSRCDIR}/config.guess` \
--host=${MACHINE_GNU_PLATFORM}
--host=${MACHINE_GNU_PLATFORM} \
--with-sysroot=${DESTDIR}
MKENV_BUILD_MAKE=cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE}
.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
mkdir .native 2>/dev/null || true
@ -162,11 +198,15 @@ NATIVE_CONFIGURE_ARGS+= \
(cd .native && ${MKNATIVE_ENV} \
${HOST_SH} ${GNUHOSTDIST}/configure \
${NATIVE_CONFIGURE_ARGS}) && \
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} all-build-libiberty)
(${MKENV_BUILD_MAKE} all-build-libiberty) && \
([ "${HAVE_GCC}" = "48" ] && \
(${MKENV_BUILD_MAKE} all-libcpp) && \
(${MKENV_BUILD_MAKE} all-libbacktrace) && \
(${MKENV_BUILD_MAKE} all-libdecnumber) || true)
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-gcc configure-libcpp) && \
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libiberty) && \
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libdecnumber)
(${MKENV_BUILD_MAKE} configure-gcc configure-libcpp) && \
(${MKENV_BUILD_MAKE} configure-libiberty) && \
(${MKENV_BUILD_MAKE} configure-libdecnumber)
# edit Makefile so that maybe-all-gcc does not depend on all-gcc any more.
(cd .native && mv Makefile Makefile.config && \
${TOOL_SED} -e 's/\(maybe-all-gcc:\) all-gcc/\1/' \
@ -175,7 +215,7 @@ NATIVE_CONFIGURE_ARGS+= \
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h)
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e libgcc.mvars tconfig.h unwind.h)
(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e libgcc.mvars tconfig.h ${UNWIND_H})
(cd .native && touch gcc/cc1obj gcc/cc1plus gcc/f771 gcc/libgcc.a gcc/libgcc_s.so)
.for _lib in ${MKNATIVE_CONFIG_TARGET_LIBS}
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \

421
tools/gcc/mknative-gcc48 Executable file
View File

@ -0,0 +1,421 @@
#!/bin/sh
# $NetBSD: mknative-gcc48,v 1.1 2014/02/17 21:39:43 christos Exp $
#
# Shell script for generating all the constants needed for a native
# platform build of gcc.
#
# initialise
_TMPDIR=$2
_TOP=$3
_SRC=$4
_PLATFORM=$5
_DESTDIR=$6
_TOOLDIR=$7
_VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'`
_GNU_DIST=`cd ${_VPATH}; pwd`
if [ -z "$_DESTDIR" ]; then
echo "\$_DESTDIR is empty" 2>&1
exit 1
fi
. $_TOP/tools/gcc/mknative.common
# default to GCC 4.1 for now
_OUTDIR="$_TOP/gnu"
_OUTDIRBASE="gnu"
sanitise_includes () {
sed \
-e "s,-I$_DESTDIR/usr/include,,g" \
-e "s,-I$_SRC/external/lgpl3/mpfr/dist/src,,g" \
-e "s,-I$_SRC/external/lgpl3/mpc/dist/src,,g" \
-e "s,-I$_SRC/external/lgpl3/gmp/lib/libgmp/arch/[a-z_0-9-]*,,g" \
-e "s,-I$_TOOLDIR/include,,g" \
-e "s,-I/usr/include/[^ ]*,,"
}
##### lib/crtstuff #####
get_crtstuff () {
_subdir="$1"
mkdir -p $_OUTDIR/lib/$_subdir/arch
getvars gcc/Makefile \
INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS CRTSTUFF_T_CFLAGS_S \
tm_defines xm_file xm_defines \
| sanitise_includes \
| write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH.mk
}
##### lib/libg2c #####
get_libg2c () {
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
{
getvars $_PLATFORM/libf2c/Makefile \
F2CEXT
getvars $_PLATFORM/libf2c/libF77/Makefile \
ALL_CFLAGS OBJS
getvars $_PLATFORM/libf2c/libI77/Makefile \
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
}
##### lib/libgcc #####
get_libgcc () {
_subdir="$1"
mkdir -p $_OUTDIR/lib/lib$_subdir/arch
# DPBIT, FPBIT only used on mn10[23]00, we don't need them.
# XXX we should probably grab everything Just In Case for
# the future.
mkdir -p $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH
cd $_TMPDIR/$_PLATFORM/libgcc
{
getvars $_PLATFORM/libgcc/Makefile \
INCLUDES LIB2ADD LIB2ADDEH LIB2ADD_ST \
LIB1ASMFUNCS LIB1ASMSRC \
LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \
LIB2FUNCS_EXTRA \
LIBGCC2_CFLAGS \
SHLIB_MKMAP SHLIB_MKMAP_OPTS \
SHLIB_MAPFILES SHLIB_NM_FLAGS
getvars gcc/Makefile \
NOEXCEPTION_FLAGS EXTRA_HEADERS
getlinks config.status libgcc
} | sanitise_includes \
| write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk
for f in auto-target.h; do
write_c $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/$f \
<$_TMPDIR/$_PLATFORM/libgcc/$f
done
}
##### lib/libgcov #####
get_libgcov () {
_subdir="$1"
_mf="$2"
mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH
{
getvars $_mf \
LIBGCOV
} | 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 \
<$_TMPDIR/gcc/gcov-iov.h
}
##### lib/libiberty #####
get_gcc_libiberty () {
_subdir="$1"
_libibertydir="lib/libiberty"
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 \
<$_TMPDIR/libiberty/config.h
}
##### lib/libdecnumber #####
get_libdecnumber () {
_subdir="$1"
mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH
write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/config.h \
<$_TMPDIR/libdecnumber/config.h
}
##### lib/libgomp #####
get_libgomp () {
_subdir="$1"
mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH
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 \
<$_TMPDIR/$_PLATFORM/libgomp/libgomp_f.h
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 \
<$_TMPDIR/$_PLATFORM/libgomp/omp.h
}
##### lib/libbacktrace #####
get_libbacktrace () {
_subdir="$1"
mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH
write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \
<$_TMPDIR/$_subdir/config.h
write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/backtrace-supported.h \
<$_TMPDIR/$_subdir/backtrace-supported.h
}
##### lib/libobjc #####
get_libobjc () {
_subdir="$1/arch/$MACHINE_ARCH"
_options="ALL_OPT_FILES"
mkdir -p $_OUTDIR/lib/$_subdir
{
if [ -n "$_options" ]; then
getvars gcc/Makefile $_options
fi
getvars $_PLATFORM/libobjc/Makefile \
ALL_CFLAGS INCLUDES OBJC_SOURCE_FILES C_SOURCE_FILES OBJC_H \
| sed "s,$_GNU_DIST,\${GNUHOSTDIST},g"
getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc
} | sanitise_includes \
| write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk
write_c $_OUTDIRBASE/lib/$_subdir/config.h \
<$_TMPDIR/$_PLATFORM/libobjc/config.h
}
##### lib/libstdc++-v3 #####
get_libstdcxx_v3 () {
_subdir="$1"
_ver="$2"
mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH
_build_headers="c++allocator.h c++config.h cxxabi_tweaks.h gthr-default.h gthr-posix.h gthr-single.h gthr.h"
_headers1="c_base_headers_extra_install"
_headers1="$_headers1 tr1_headers tr2_headers decimal_headers c_compatibility_headers_install"
_headers1="$_headers1 debug_headers parallel_headers"
_headers2="host_headers thread_host_headers"
_pf_headers="profile_headers profile_impl_headers"
_pb_headers="pb_headers1 pb_headers2 pb_headers3 pb_headers4 pb_headers5 pb_headers6 pb_headers7"
# build files
for h in $_build_headers; do
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/config.h \
<$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h
write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/gstdint.h \
<$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h
{
# libsupc++
getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \
sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/'
getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \
c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/'
# includes
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
c_base_headers std_headers | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g'
# src
getvars $_PLATFORM/libstdc++-v3/src/Makefile \
libstdc___la_SOURCES | sed 's/^G_libstdc___la_SOURCES=/G_SRC_SOURCES=/'
getvars $_PLATFORM/libstdc++-v3/src/c++11/Makefile \
libc__11convenience_la_SOURCES | sed 's/^G_libc__11convenience_la_SOURCES=/G_CPP11_SOURCES=/'
getvars $_PLATFORM/libstdc++-v3/src/c++98/Makefile \
libc__98convenience_la_SOURCES | sed 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/'
getvars $_PLATFORM/libstdc++-v3/Makefile ATOMICITY_SRCDIR \
BASIC_FILE_CC CLOCALE_CC CCODECVT_CC CCOLLATE_CC \
CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC \
CPU_OPT_BITS_RANDOM
# includes
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
backward_headers c_base_headers_extra $_headers1 $_pb_headers | \
sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g'
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
bits_headers ext_headers $_headers2 | \
sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' -e 's#\${GNUHOSTDIST}/libstdc++-v3/config/##g'
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
$_pf_headers | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/profile/##g'
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
BASIC_FILE_H ALLOCATOR_H CSTDIO_H CLOCALE_H CMESSAGES_H CTIME_H
getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc
} | sanitise_includes \
| 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
for f in auto-host tm config; do
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/include/arch
_buildname="BUILD_"
_libcppsubdir=""
_extravars="TM_H ALL_OPT_FILES"
_hconfig_h=""
_extravars2="tm_file_list build_xm_include_list"
_extravars3="tm_p_include_list"
{
getvars gcc/Makefile \
${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \
${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY \
${_buildname}MD | \
sed -e 's#build/errors.o#build-errors.o#g' \
-e 's#build/print-rtl.o#build-print-rtl.o#g' \
-e 's#build/rtl.o#build-rtl.o#g' \
-e 's#build/varray.o#build-varray.o#g' \
-e 's#build/ggc-none.o#build-ggc-none.o#g' \
-e 's#build/##g'
getvars gcc/Makefile \
ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \
GCC_OBJS GCOV_OBJS GXX_OBJS GTM_H PROTO_OBJS ${_extravars1} \
INCLUDES md_file OBJC_OBJS OBJS out_file version \
BUILD_PREFIX RTL_H RTL_BASE_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \
GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \
GTFILES GTFILES_LANG_DIR_NAMES NOEXCEPTION_FLAGS \
NATIVE_SYSTEM_HEADER_DIR \
tm_defines host_xm_file host_xm_defines tm_p_file \
target_cpu_default ${_extravars} ${_extravars2} \
lang_specs_files ${_extravars3} \
common_out_file \
| sanitise_includes
getvars gcc/Makefile \
LIB2ADDEHDEP | sed 's/unwind.inc//'
getvars gcc/Makefile \
CXX_OBJS CXX_C_OBJS | sed 's/cp\///g'
getvars gcc/Makefile \
F77_OBJS | sed 's/f\///g'
getvars libcpp/Makefile \
libcpp_a_OBJS
getvars gcc/Makefile \
ENABLE_SHARED
echo G_SHLIB_LINK="$CC -shared"
echo G_SHLIB_MULTILIB=.
} | 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_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" ]
then
ex <<__EOF__ $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h
/configuration_arguments/ s/$//
ya
i
#ifdef _SOFT_FLOAT
.
pu
s/";$/ -with-float=soft";/
a
#else
#endif
.
. m +1
/configure_default_options/ s/{ NULL.*$//
a
#ifdef _SOFT_FLOAT
{ "float", "soft" },
#endif
{ NULL, NULL }
};
.
wq
__EOF__
fi
done
# keep identical
for f in all-tree.def; do
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/^.*external\/gpl3\/gcc\/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
fi
}
##### main #####
case "$1" in
# .mk and .h files for libgcc bootstrap (from host build)
libgcc*-bootstrap)
_OUTDIR="$_TOP/external/gpl3/gcc"
_OUTDIRBASE="external/gpl3/gcc"
get_libgcc gcc
get_libgcov gcc $_PLATFORM/libgcc/Makefile
get_crtstuff crtstuff
get_gcc_bootstrap gcc
exit 0
;;
libstdc++-bootstrap)
_OUTDIR="$_TOP/external/gpl3/gcc"
_OUTDIRBASE="external/gpl3/gcc"
get_libstdcxx_v3 libstdc++-v3 gcc
exit 0
;;
gcc*)
_OUTDIR="$_TOP/external/gpl3/gcc"
_OUTDIRBASE="external/gpl3/gcc"
get_gcc gcc
get_libgcc gcc
get_libgcov gcc $_PLATFORM/libgcc/Makefile
get_crtstuff crtstuff
get_gcc_libiberty gcc
get_libobjc libobjc
get_libstdcxx_v3 libstdc++-v3 gcc
get_libdecnumber libdecnumber
get_libgomp libgomp
get_libbacktrace libbacktrace
exit 0
;;
*)
echo invalid arguments;
exit 1
;;
esac

View File

@ -1,4 +1,4 @@
# $NetBSD: mknative.common,v 1.10 2013/10/20 16:00:20 skrll Exp $
# $NetBSD: mknative.common,v 1.11 2014/02/17 21:39:43 christos Exp $
#
# from: NetBSD: mknative,v 1.12 2003/03/05 06:17:17 mrg Exp
#
@ -45,14 +45,24 @@ EOF
esac
}
# usage: getlinks <config.status> <subdir>
#
getlinks()
{
_cs="$1"; shift
_dir="$1"; shift
echo -n G_CONFIGLINKS=
grep "^config_links=" $_cs | sed -e 's@config_links="\([^"]*\)"@\1@g' -e "s@\([^:]*\):\([^ ]*\)@\${GNUHOSTDIST}/${_dir}/\2 \1 @g"
}
# usage: write_c FILENAME
#
write_c()
{
echo '/* This file is automatically generated. DO NOT EDIT! */' >$_TOP/$1.tmp || \
bomb "cannot create $1"
grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
echo '$NetBSD: mknative.common,v 1.10 2013/10/20 16:00:20 skrll Exp $' | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
grep '$''NetBSD' $0 | sed 's,[ #$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
echo '$NetBSD: mknative.common,v 1.11 2014/02/17 21:39:43 christos Exp $' | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
echo '' >>$_TOP/$1.tmp
writefile $1
}
@ -63,8 +73,8 @@ write_mk()
{
echo '# This file is automatically generated. DO NOT EDIT!' >$_TOP/$1.tmp || \
bomb "cannot create $1"
grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
echo '$NetBSD: mknative.common,v 1.10 2013/10/20 16:00:20 skrll Exp $' | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
grep '$''NetBSD' $0 | sed 's,[ #$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
echo '$NetBSD: mknative.common,v 1.11 2014/02/17 21:39:43 christos Exp $' | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
echo '#' >>$_TOP/$1.tmp
writefile $1
}