initial port to HAVE_GCC = 45. mknative-gcc parts are from me

and are largely untested, most of the rest is from chuq.
This commit is contained in:
mrg 2011-06-21 04:11:12 +00:00
parent 3a3b951b93
commit 2d7ccc14fc
3 changed files with 101 additions and 83 deletions

View File

@ -1,10 +1,15 @@
# $NetBSD: Makefile,v 1.36 2011/06/10 16:31:18 matt Exp $
# $NetBSD: Makefile,v 1.37 2011/06/21 04:11:12 mrg Exp $
.include <bsd.own.mk>
GCC_LANGUAGES=c c++ objc
MODULE= gcc4
.if ${HAVE_GCC} == 45
MKNATIVE_TARGET= gcc45
GNUHOSTDIST= ${.CURDIR}/../../external/gpl3/gcc/dist
.else
MKNATIVE_TARGET= gcc4
.endif
MKNATIVE_CONFIG_TARGET_LIBS=
BINENV= /usr/bin/env -i
@ -23,6 +28,8 @@ SOFTFLOAT_ARGS= -with-float=soft
COMMON_CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} \
--enable-long-long \
--enable-threads \
--with-bugurl=http://www.NetBSD.org/Misc/send-pr.html \
--with-pkgversion="NetBSD nb1 20110620" \
${VAX_CONFIGURE_ARGS} \
--enable-__cxa_atexit
.if defined(GCC_CONFIG_ARCH.${MACHINE_ARCH})
@ -32,7 +39,14 @@ COMMON_CONFIGURE_ARGS+= --with-arch=${GCC_CONFIG_ARCH.${MACHINE_ARCH}}
COMMON_CONFIGURE_ARGS+= --with-tune=${GCC_CONFIG_TUNE.${MACHINE_ARCH}}
.endif
CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS} \
CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
.if ${HAVE_GCC} >= 45
CONFIGURE_ARGS+= \
--with-mpc=${TOOLDIR} \
--with-mpfr=${TOOLDIR} \
--with-gmp=${TOOLDIR}
.endif
CONFIGURE_ARGS+= \
--disable-nls \
${MULTILIB_ARGS} \
${SOFTFLOAT_ARGS} \
@ -74,6 +88,16 @@ INSTALL_TARGET= install-gcc
.include "${.CURDIR}/../Makefile.gmakehost"
BUILD_MAKE=${TOOL_GMAKE}
#
# mknative-gcc specific stuff
#
.if ${HAVE_GCC} >= 45
GCCSRCDIR=${.CURDIR}/../../gnu/dist/gcc4
.else
GCCSRCDIR=${.CURDIR}/../../external/gpl3/gcc/dist
.endif
CXXADDFLAGS= ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++
CCADDFLAGS= ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
@ -90,10 +114,17 @@ native-gcc: .native/.configure_done
@MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS} \
NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
.if ${HAVE_GCC} >= 45
NATIVE_CONFIGURE_ARGS+= \
--with-mpc=${DESTDIR}/usr \
--with-mpfr=${DESTDIR}/usr \
--with-gmp=${DESTDIR}/usr
.endif
NATIVE_CONFIGURE_ARGS+= \
--disable-multilib \
--disable-symvers \
--build=`${.CURDIR}/../../gnu/dist/${MODULE}/config.guess` \
--build=`${GCCSRCDIR}/config.guess` \
--host=${MACHINE_GNU_PLATFORM}
.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
@ -103,7 +134,6 @@ NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS} \
${HOST_SH} ${GNUHOSTDIST}/configure \
${NATIVE_CONFIGURE_ARGS}) && \
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} all-build-libiberty)
.if ${HAVE_GCC} == 4
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-gcc configure-libcpp) && \
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libiberty)
@ -112,11 +142,6 @@ NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS} \
${TOOL_SED} -e 's/\(maybe-all-gcc:\) all-gcc/\1/' \
< Makefile.config > Makefile) && \
(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h)
.else
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} all-libiberty) && \
(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} tree-check.h config.h)
.endif
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
(cd .native && touch gcc/cc1obj gcc/cc1plus gcc/f771 gcc/libgcc.a gcc/libgcc_s.so && \
${MKNATIVE_ENV} ${BUILD_MAKE} configure-target-libiberty \

View File

@ -1,4 +1,4 @@
$NetBSD: README.mknative,v 1.7 2009/09/08 07:08:03 skrll Exp $
$NetBSD: README.mknative,v 1.8 2011/06/21 04:11:12 mrg Exp $
This file describes how to bootstrap the native toolchain on a new NetBSD
platform (and how to update the new toolchain files, if needed). These
@ -36,10 +36,11 @@ work.
5. In src/gnu/lib/libgcc4, do "nbmake-MACHINE obj includes".
6. In src/gnu/lib/crtstuff4 do "nbmake-MACHINE depend all install"
6. If the platform sets USE_COMPILERCRTSTUFF=yes, then in src/gnu/lib/crtstuff4
do "nbmake-MACHINE dependall install"
7. In each of src/lib/csu, src/gnu/lib/libgcc4, src/lib/libdes, and src/lib,
do "nbmake-MACHINE all install".
7. In each of src/lib/csu, src/gnu/lib/libgcc4, and src/lib,
do "nbmake-MACHINE dependall install".
Optionally, all of the following may be set in the environment to reduce
the amount of code needed to build at this step. Basically, it must be

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $NetBSD: mknative-gcc,v 1.45 2009/12/17 15:48:13 uebayasi Exp $
# $NetBSD: mknative-gcc,v 1.46 2011/06/21 04:11:12 mrg Exp $
#
# Shell script for generating all the constants needed for a native
# platform build of src/gnu/dist/gcc.
@ -16,25 +16,29 @@ _GNU_DIST=`cd ${_VPATH}; pwd`
. $_TOP/tools/gcc/mknative.common
# default to GCC 4.1 for now
_OUTDIR="$_TOP/gnu"
_OUTDIRBASE="gnu"
##### gnu/lib/crtstuff #####
get_crtstuff () {
_subdir="$1"
mkdir -p $_TOP/gnu/lib/$_subdir/arch
mkdir -p $_OUTDIR/lib/$_subdir/arch
getvars gcc/Makefile \
INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS \
tm_defines xm_file xm_defines \
| write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH.mk
| write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH.mk
}
##### gnu/lib/libg2c #####
get_libg2c () {
mkdir -p $_TOP/gnu/lib/libg2c3/arch/$MACHINE_ARCH
mkdir -p $_OUTDIR/lib/libg2c3/arch/$MACHINE_ARCH
write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h
write_c gnu/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 \
@ -45,7 +49,7 @@ get_libg2c () {
ALL_CFLAGS OBJS | sed 's,=,+=,'
getvars $_PLATFORM/libf2c/libU77/Makefile \
ALL_CFLAGS OBJS | sed 's,=,+=,'
} | write_mk gnu/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk
} | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk
}
##### gnu/lib/libgcc #####
@ -337,7 +341,7 @@ get_libgcc_new () {
# List of generated files.
_machine_arch_subdir=gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH/$_abi
_machine_arch_subdir=$_OUTDIRBASE/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH/$_abi
libgcc_db_funcs=${_machine_arch_subdir}/funcs
libgcc_db_tmplsrcs=${_machine_arch_subdir}/tmplsrcs
@ -360,14 +364,10 @@ get_libgcc_new () {
get_libgcc () {
_subdir="$1"
mkdir -p $_TOP/gnu/lib/lib$_subdir/arch
mkdir -p $_OUTDIR/lib/lib$_subdir/arch
case "$_subdir" in
gcc3)
_extravars="USE_COLLECT2 LIB2FUNCS_1 LIB2FUNCS_2 xm_file"
_archsubdir=""
;;
gcc4)
gcc4|gcc)
_extravars="COLLECT2 UNWIND_H xm_include_list"
_archsubdir=""
;;
@ -387,7 +387,7 @@ get_libgcc () {
SHLIB_MAPFILES SHLIB_NM_FLAGS \
EXTRA_HEADERS xm_defines \
tm_defines ${_extravars}
} | write_mk gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk
} | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk
# Generate new style files.
if [ -n "${MKNATIVE_LIBGCC_NEW}" ]; then
@ -400,14 +400,14 @@ get_libgcc () {
get_libgcov () {
_subdir="$1"
mkdir -p $_TOP/gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH
mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH
{
getvars gcc/Makefile \
LIBGCOV
} | write_mk gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk
} | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk
write_c gnu/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
}
@ -416,33 +416,32 @@ get_libgcov () {
get_gcc_libiberty () {
_subdir="$1"
mkdir -p $_TOP/gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH
case "$_subdir" in
gcc4)
_libibertydir="usr.bin/$_subdir/libiberty"
;;
gcc)
_libibertydir="$_subdir/lib/libiberty"
;;
esac
mkdir -p $_OUTDIR/$_libibertydir/arch/$MACHINE_ARCH
getvars libiberty/Makefile \
ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
| write_mk gnu/usr.bin/$_subdir/libiberty/defs.mk
| write_mk $_OUTDIRBASE/$_libibertydir/defs.mk
write_c gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH/config.h \
write_c $_OUTDIRBASE/$_libibertydir/arch/$MACHINE_ARCH/config.h \
<$_TMPDIR/libiberty/config.h
}
##### gnu/lib/libobjc #####
get_libobjc () {
case "$1" in
*4)
_subdir="$1/arch/$MACHINE_ARCH"
_options="ALL_OPT_FILES"
_unwind="UNWIND_H"
;;
*)
_subdir="$1"
_options=""
_unwind=""
;;
esac
_subdir="$1/arch/$MACHINE_ARCH"
_options="ALL_OPT_FILES"
_unwind="UNWIND_H"
mkdir -p $_TOP/gnu/lib/$_subdir
mkdir -p $_OUTDIR/lib/$_subdir
{
if [ -n "$_options" ]; then
@ -454,9 +453,9 @@ get_libobjc () {
if [ -n "$_unwind" ]; then
getvars gcc/Makefile $_unwind
fi
} | write_mk gnu/lib/$_subdir/defs.mk
} | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk
write_c gnu/lib/$_subdir/config.h \
write_c $_OUTDIRBASE/lib/$_subdir/config.h \
<$_TMPDIR/$_PLATFORM/libobjc/config.h
}
@ -464,32 +463,25 @@ get_libobjc () {
get_libstdcxx_v3 () {
_subdir="$1"
mkdir -p $_TOP/gnu/lib/$_subdir/arch/$MACHINE_ARCH
mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH
case ${_subdir} in
*4)
*)
_src_CC_files="atomicity_file CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC CLOCALE_CC BASIC_FILE_CC"
_headers1="host_headers debug_headers tr1_headers c_compatibility_headers_extra"
_headers2="thread_host_headers host_headers_extra"
_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"
_unwind="UNWIND_H"
;;
*)
_src_CC_files=""
_headers1="target_headers"
_headers2="thread_target_headers target_headers_extra"
_build_headers="c++config.h gthr-default.h gthr-posix.h gthr-single.h gthr.h"
_unwind=""
;;
esac
# build files
for h in $_build_headers; do
write_c gnu/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 gnu/lib/$_subdir/arch/$MACHINE_ARCH/config.h \
write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \
<$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h
{
@ -519,17 +511,17 @@ get_libstdcxx_v3 () {
if [ -n "$_unwind" ]; then
getvars gcc/Makefile $_unwind
fi
} | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk
} | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk
}
##### gnu/usr.bin/gcc3 #####
get_gcc () {
_subdir="$1"
mkdir -p $_TOP/gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH
mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH
case ${_subdir} in
gcc4)
mkdir -p $_TOP/gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH
mkdir -p $_OUTDIR/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH
_buildname="BUILD_"
_libcppsubdir=""
_extravars="TM_H ALL_OPT_FILES"
@ -587,28 +579,25 @@ get_gcc () {
getvars gcc/Makefile \
ENABLE_SHARED
case ${_subdir} in
gcc4)
gcc4 | gcc)
echo G_SHLIB_LINK="$CC -shared"
echo G_SHLIB_MULTILIB=.
;;
gcc3)
getvars gcc/Makefile \
SHLIB_LINK SHLIB_MULTILIB
;;
esac
} | write_mk gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk
} | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk
case "$_subdir" in
gcc3)
hfiles='auto-host configargs cs-hconfig gencheck hconfig gthr-default'
;;
gcc4)
write_c gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h
hfiles='auto-host configargs gencheck gthr-default tm bconfig config multilib'
write_c $_OUTDIRBASE/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h
hfiles='auto-host gencheck configargs gthr-default tm bconfig config multilib'
;;
gcc)
write_c $_OUTDIRBASE/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h
hfiles='auto-host configargs gthr-default tm bconfig config multilib'
;;
esac
for f in $hfiles; do
write_c gnu/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
}
@ -640,16 +629,19 @@ gcc4)
exit 0
;;
gcc3)
get_gcc gcc3
get_libg2c
get_libgcc gcc3
get_crtstuff crtstuff3
get_gcc_libiberty gcc3
get_libobjc libobjc3
gcc45)
_OUTDIR="$_TOP/external/gpl3/gcc"
_OUTDIRBASE="external/gpl3/gcc"
get_gcc gcc
get_libgcc gcc
get_libgcov gcc
get_crtstuff crtstuff
get_gcc_libiberty gcc
get_libobjc libobjc
get_libstdcxx_v3 libstdc++-v3
exit 0
;;
*) echo invalid arguments; exit 1;;
esac