NetBSD/tools/gcc/Makefile
drochner 109044809a Force use of __cxa_atexit by a configure command line argument
(for booth the tool build and mknative). gcc's "config.gcc" sets
it if the target is netbsd[2-9], but since the target is w/o version
number in our builds, it has no effect. Found by Nick Hudson,
patch approved by mrg.
2007-09-20 12:26:51 +00:00

124 lines
4.5 KiB
Makefile

# $NetBSD: Makefile,v 1.27 2007/09/20 12:26:51 drochner Exp $
.include <bsd.own.mk>
GCC_LANGUAGES=c c++ objc
MODULE= gcc4
MKNATIVE_TARGET= gcc4
MKNATIVE_CONFIG_TARGET_LIBS=
BINENV= /usr/bin/env -i
VAX_CONFIGURE_ARGS=
CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} --disable-nls \
--enable-long-long \
--disable-multilib \
--enable-threads \
${VAX_CONFIGURE_ARGS} \
--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
--enable-languages="${GCC_LANGUAGES}" \
--enable-__cxa_atexit
MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} \
LIBGCC= LIBGCC1= LIBGCC1_TEST= LIBGCC2= INSTALL_LIBGCC= \
EXTRA_PARTS= CPPFLAGS=-DNETBSD_TOOLS \
AR=${HOST_AR:Q} RANLIB=${HOST_RANLIB:Q}
CONFIGURE_ENV+= gcc_cv_libc_provides_ssp=yes
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} LD=${LD:Q} NM=${NM:Q} OBJDUMP=${OBJDUMP:Q} \
MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
LIBS=-lintl \
ac_cv_prog_cc_cross=yes \
ac_cv_func_strcoll_works=yes \
gcc_cv_func_printf_ptr=yes \
gdb_cv_printf_has_long_double=yes \
gdb_cv_printf_has_long_long=yes \
gdb_cv_scanf_has_long_double=yes
ALL_TARGET= all-gcc
INSTALL_TARGET= install-gcc
.include "${.CURDIR}/../Makefile.gmakehost"
BUILD_MAKE=${TOOL_GMAKE}
CXXADDFLAGS= ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++
CCADDFLAGS= ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
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${MODULE} \
${.OBJDIR}/build ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
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} ${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 \
--enable-long-long \
--disable-multilib \
--enable-threads \
--disable-symvers \
${VAX_CONFIGURE_ARGS} \
--build=`${.CURDIR}/../../gnu/dist/${MODULE}/config.guess` \
--host=${MACHINE_GNU_PLATFORM} \
--target=${MACHINE_GNU_PLATFORM} \
--enable-__cxa_atexit) && \
(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)
# edit Makefile so that maybe-all-gcc does not depend on all-gcc any more.
(cd .native && mv Makefile Makefile.config && \
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)
.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 \
${MKNATIVE_CONFIG_TARGET_LIBS} configure-target-libobjc \
configure-target-libstdc++-v3 \
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
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
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
(cd .native/${MACHINE_GNU_PLATFORM}/libiberty && \
${MKNATIVE_ENV} ${BUILD_MAKE} needed-list)
@touch $@
clean: clean.native
clean.native:
-rm -r -f .native