2013-12-06 12:04:52 +01:00
|
|
|
# $NetBSD: Makefile,v 1.61 2013/11/28 12:08:57 mrg Exp $
|
2012-06-06 16:46:00 +02:00
|
|
|
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
|
|
|
GCC_LANGUAGES=c c++ objc
|
|
|
|
MODULE= gcc4
|
|
|
|
|
|
|
|
.if ${HAVE_GCC} == 45
|
|
|
|
GNUHOSTDIST= ${.CURDIR}/../../external/gpl3/gcc/dist
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64"
|
|
|
|
MULTILIB_ARGS= --enable-multilib
|
|
|
|
.else
|
|
|
|
MULTILIB_ARGS= --disable-multilib
|
|
|
|
.endif
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
.if ${MKSOFTFLOAT} != "no" && ${MACHINE_CPU} != "m68k"
|
2012-06-06 16:46:00 +02:00
|
|
|
SOFTFLOAT_ARGS= -with-float=soft
|
|
|
|
.endif
|
|
|
|
|
|
|
|
COMMON_CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} \
|
|
|
|
--enable-long-long \
|
|
|
|
--enable-threads \
|
|
|
|
--with-bugurl=http://www.NetBSD.org/Misc/send-pr.html \
|
2012-10-26 15:22:39 +02:00
|
|
|
--with-pkgversion="NetBSD nb1 20120916" \
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
--with-system-zlib \
|
|
|
|
--enable-__cxa_atexit
|
2013-04-24 18:57:59 +02:00
|
|
|
.if defined(__MINIX)
|
|
|
|
COMMON_CONFIGURE_ARGS+= \
|
|
|
|
--disable-libssp \
|
2013-08-26 18:31:54 +02:00
|
|
|
--enable-visibility \
|
2013-12-06 12:04:52 +01:00
|
|
|
--disable-threads
|
2013-04-24 18:57:59 +02:00
|
|
|
|
2013-08-26 18:31:54 +02:00
|
|
|
CONFIGURE_ENV+= gcc_cv_ld_hidden=yes
|
|
|
|
|
2013-04-24 18:57:59 +02:00
|
|
|
.if ${HOST_OSTYPE:C/\-.*//} == "Minix"
|
|
|
|
CONFIGURE_ENV+= LDFLAGS=-lm
|
|
|
|
.endif # ${HOST_OSTYPE:C/\-.*//} == "Minix"
|
2013-08-26 18:31:54 +02:00
|
|
|
|
2013-04-24 18:57:59 +02:00
|
|
|
.endif # defined(__MINIX)
|
|
|
|
|
2012-06-06 16:46:00 +02:00
|
|
|
.if defined(GCC_CONFIG_ARCH.${MACHINE_ARCH})
|
|
|
|
COMMON_CONFIGURE_ARGS+= --with-arch=${GCC_CONFIG_ARCH.${MACHINE_ARCH}}
|
|
|
|
.endif
|
|
|
|
.if defined(GCC_CONFIG_TUNE.${MACHINE_ARCH})
|
|
|
|
COMMON_CONFIGURE_ARGS+= --with-tune=${GCC_CONFIG_TUNE.${MACHINE_ARCH}}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
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} \
|
|
|
|
--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
--enable-languages="${GCC_LANGUAGES}"
|
2012-06-06 16:46:00 +02:00
|
|
|
|
|
|
|
GCC_CPPFLAGS= -DNETBSD_TOOLS -DTARGET_SYSTEM_ROOT=0 \
|
|
|
|
-DTARGET_SYSTEM_ROOT_RELOCATABLE
|
|
|
|
|
|
|
|
MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} \
|
|
|
|
LIBGCC= LIBGCC1= LIBGCC1_TEST= LIBGCC2= INSTALL_LIBGCC= \
|
|
|
|
EXTRA_PARTS= CPPFLAGS=${GCC_CPPFLAGS:Q} \
|
|
|
|
AR=${HOST_AR:Q} RANLIB=${HOST_RANLIB:Q}
|
|
|
|
|
|
|
|
CONFIGURE_ENV+= gcc_cv_libc_provides_ssp=yes \
|
|
|
|
gcc_cv_as_sparc_gotdata_op=no
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
ALL_TARGET= all-gcc
|
|
|
|
INSTALL_TARGET= install-gcc
|
|
|
|
|
|
|
|
.include "${.CURDIR}/../Makefile.gmakehost"
|
|
|
|
BUILD_MAKE=${TOOL_GMAKE}
|
|
|
|
|
|
|
|
#
|
|
|
|
# mknative-gcc specific stuff
|
|
|
|
#
|
|
|
|
MKNATIVE_CONFIG_TARGET_LIBS= \
|
|
|
|
configure-target-libstdc++-v3 \
|
|
|
|
configure-target-libobjc
|
|
|
|
|
|
|
|
.if ${HAVE_GCC} == 45
|
|
|
|
MKNATIVE_TARGET= gcc45
|
|
|
|
MKNATIVE_CONFIG_TARGET_LIBS+= \
|
|
|
|
configure-target-libgomp
|
|
|
|
.else
|
|
|
|
MKNATIVE_TARGET= gcc4
|
|
|
|
.endif
|
|
|
|
|
|
|
|
BINENV= /usr/bin/env -i
|
|
|
|
|
2012-06-06 16:46:00 +02:00
|
|
|
MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*} \
|
|
|
|
CC_FOR_BUILD=${HOST_CC:Q} \
|
|
|
|
CC=${CC:Q}' '${CCADDFLAGS:Q} \
|
|
|
|
CXX=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
|
|
|
CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
|
|
|
|
CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
|
|
|
|
AS=${AS:Q} AWK=${TOOL_AWK:Q} LD=${LD:Q} \
|
|
|
|
MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
|
|
|
|
NM=${NM:Q} OBJDUMP=${OBJDUMP:Q} \
|
|
|
|
XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
|
|
|
|
LIBS=-lintl \
|
|
|
|
ac_cv_prog_cc_cross=yes \
|
|
|
|
ac_cv_func_strcoll_works=yes \
|
|
|
|
ac_cv_func_elf_getshstrndx=no \
|
|
|
|
gcc_cv_func_printf_ptr=yes \
|
|
|
|
gcc_cv_libc_provides_ssp=yes \
|
|
|
|
gdb_cv_printf_has_long_double=yes \
|
|
|
|
gdb_cv_printf_has_long_long=yes \
|
|
|
|
gdb_cv_scanf_has_long_double=yes \
|
|
|
|
gcc_cv_as_sparc_gotdata_op=no
|
|
|
|
|
|
|
|
.if ${HAVE_GCC} < 45
|
|
|
|
GCCSRCDIR=${.CURDIR}/../../gnu/dist/gcc4
|
|
|
|
.else
|
|
|
|
GCCSRCDIR=${.CURDIR}/../../external/gpl3/gcc/dist
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CXXADDFLAGS= --sysroot=${DESTDIR}
|
|
|
|
CCADDFLAGS= --sysroot=${DESTDIR} -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/ -I${.OBJDIR}/.native/gcc/include
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
# NEWCONFIGDIR can be set to a read-write location of the source tree
|
|
|
|
# in case the version being used is not.
|
2012-06-06 16:46:00 +02:00
|
|
|
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} \
|
2013-12-06 12:04:52 +01:00
|
|
|
${.OBJDIR}/build ${NEWCONFIGDIR} ${NETBSDSRCDIR} \
|
|
|
|
${MACHINE_GNU_PLATFORM} ${DESTDIR}
|
2012-06-06 16:46:00 +02:00
|
|
|
|
|
|
|
native-gcc: .native/.configure_done
|
|
|
|
@echo 'Extracting GNU GCC configury for a native toolchain.'
|
|
|
|
@MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
|
2013-12-06 12:04:52 +01:00
|
|
|
${.OBJDIR}/.native ${NEWCONFIGDIR} ${NETBSDSRCDIR} \
|
|
|
|
${MACHINE_GNU_PLATFORM} ${DESTDIR}
|
2012-06-06 16:46:00 +02:00
|
|
|
|
|
|
|
NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS}
|
|
|
|
.if ${HAVE_GCC} >= 45
|
2013-12-06 12:04:52 +01:00
|
|
|
MPC= ${NETBSDSRCDIR}/external/lgpl3/mpc
|
|
|
|
MPFR= ${NETBSDSRCDIR}/external/lgpl3/mpfr
|
|
|
|
GMP= ${NETBSDSRCDIR}/external/lgpl3/gmp
|
|
|
|
MPCOBJ!= cd ${MPC}/lib/libmpc && ${PRINTOBJDIR}
|
|
|
|
MPFROBJ!= cd ${MPFR}/lib/libmpfr && ${PRINTOBJDIR}
|
|
|
|
GMPOBJ!= cd ${GMP}/lib/libgmp && ${PRINTOBJDIR}
|
|
|
|
|
2012-06-06 16:46:00 +02:00
|
|
|
NATIVE_CONFIGURE_ARGS+= \
|
2013-12-06 12:04:52 +01:00
|
|
|
--with-mpc-lib=${MPCOBJ} \
|
|
|
|
--with-mpfr-lib=${MPFROBJ} \
|
|
|
|
--with-gmp-lib=${GMPOBJ} \
|
|
|
|
--with-mpc-include=${MPC}/dist/src \
|
|
|
|
--with-mpfr-include=${MPFR}/dist \
|
|
|
|
--with-gmp-include=${GMP}/lib/libgmp/arch/${MACHINE_ARCH}
|
2012-06-06 16:46:00 +02:00
|
|
|
|
|
|
|
. if ${MACHINE_ARCH} != "vax"
|
|
|
|
NATIVE_CONFIGURE_ARGS+= --enable-tls
|
|
|
|
. endif
|
|
|
|
.endif
|
|
|
|
NATIVE_CONFIGURE_ARGS+= \
|
|
|
|
--disable-multilib \
|
|
|
|
--disable-symvers \
|
|
|
|
--disable-libstdcxx-pch \
|
|
|
|
--build=`${GCCSRCDIR}/config.guess` \
|
|
|
|
--host=${MACHINE_GNU_PLATFORM}
|
|
|
|
|
|
|
|
.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
|
|
|
|
mkdir .native 2>/dev/null || true
|
|
|
|
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
|
|
|
(cd .native && ${MKNATIVE_ENV} \
|
|
|
|
${HOST_SH} ${GNUHOSTDIST}/configure \
|
|
|
|
${NATIVE_CONFIGURE_ARGS}) && \
|
|
|
|
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} all-build-libiberty)
|
|
|
|
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)
|
|
|
|
# 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/' \
|
|
|
|
-e 's/\(maybe-all-target-libgcc:\) all-target-libgcc/\1/' \
|
|
|
|
< Makefile.config > Makefile)
|
|
|
|
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 && 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; \
|
|
|
|
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} \
|
|
|
|
${_lib} \
|
|
|
|
ALL_GCC_C= ALL_GCC_CXX= \
|
|
|
|
CC_FOR_TARGET=${CC:Q}' '${CCADDFLAGS:Q} \
|
|
|
|
CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
|
|
|
RAW_CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
|
|
|
CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
|
|
|
|
ac_cv_prog_cc_cross=yes) && \
|
|
|
|
true
|
|
|
|
.endfor
|
|
|
|
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
|
|
|
(cd .native/${MACHINE_GNU_PLATFORM}/libstdc++-v3/include && \
|
|
|
|
${MKNATIVE_ENV} ${BUILD_MAKE} \
|
|
|
|
CC_FOR_TARGET=${CC:Q}' '${CCADDFLAGS:Q} \
|
|
|
|
CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
|
|
|
CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
|
|
|
|
all-local) && \
|
|
|
|
true
|
|
|
|
.if 0
|
|
|
|
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
|
|
|
(cd .native/${MACHINE_GNU_PLATFORM}/libiberty && \
|
|
|
|
${MKNATIVE_ENV} ${BUILD_MAKE} needed-list)
|
|
|
|
.endif
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
clean: clean.native
|
|
|
|
clean.native:
|
|
|
|
-rm -r -f .native
|