2009-03-27 22:19:49 +03:00
|
|
|
# $NetBSD: Makefile,v 1.31 2009/03/27 19:19:49 drochner Exp $
|
2003-07-25 20:26:51 +04:00
|
|
|
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
GCC_LANGUAGES=c c++ objc
|
|
|
|
MODULE= gcc4
|
|
|
|
MKNATIVE_TARGET= gcc4
|
|
|
|
MKNATIVE_CONFIG_TARGET_LIBS=
|
|
|
|
BINENV= /usr/bin/env -i
|
2003-07-25 20:26:51 +04:00
|
|
|
|
2006-07-01 09:59:18 +04:00
|
|
|
VAX_CONFIGURE_ARGS=
|
|
|
|
|
2008-10-11 09:03:43 +04:00
|
|
|
.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64"
|
|
|
|
MULTILIB_ARGS= --enable-multilib
|
|
|
|
.else
|
|
|
|
MULTILIB_ARGS= --disable-multilib
|
|
|
|
.endif
|
|
|
|
|
2009-03-27 22:19:49 +03:00
|
|
|
COMMON_CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} \
|
|
|
|
--enable-long-long \
|
|
|
|
--enable-threads \
|
|
|
|
${VAX_CONFIGURE_ARGS} \
|
|
|
|
--enable-__cxa_atexit
|
|
|
|
.if defined(GCC_CONFIG_ARCH.${MACHINE_ARCH})
|
|
|
|
COMMON_CONFIGURE_ARGS+= --with-arch=${GCC_CONFIG_ARCH.${MACHINE_ARCH}}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS} \
|
|
|
|
--disable-nls \
|
2008-10-11 09:03:43 +04:00
|
|
|
${MULTILIB_ARGS} \
|
2003-07-25 20:26:51 +04:00
|
|
|
--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
|
2009-03-27 22:19:49 +03:00
|
|
|
--enable-languages="${GCC_LANGUAGES}"
|
2003-07-25 20:26:51 +04:00
|
|
|
|
|
|
|
MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} \
|
2003-10-10 05:18:54 +04:00
|
|
|
LIBGCC= LIBGCC1= LIBGCC1_TEST= LIBGCC2= INSTALL_LIBGCC= \
|
2006-05-12 22:01:13 +04:00
|
|
|
EXTRA_PARTS= CPPFLAGS=-DNETBSD_TOOLS \
|
|
|
|
AR=${HOST_AR:Q} RANLIB=${HOST_RANLIB:Q}
|
2003-07-25 20:26:51 +04:00
|
|
|
|
2007-06-07 18:36:27 +04:00
|
|
|
CONFIGURE_ENV+= gcc_cv_libc_provides_ssp=yes
|
2007-06-07 12:58:58 +04:00
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*} \
|
|
|
|
CC_FOR_BUILD=${HOST_CC:Q} \
|
|
|
|
CC=${CC:Q}' '${CCADDFLAGS:Q} \
|
2006-06-24 09:29:03 +04:00
|
|
|
CXX=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
2006-05-12 06:12:37 +04:00
|
|
|
CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
|
|
|
|
CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
|
2008-10-20 02:05:19 +04:00
|
|
|
AS=${AS:Q} AWK=${TOOL_AWK:Q} LD=${LD:Q} \
|
2006-05-12 06:12:37 +04:00
|
|
|
MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
|
2008-10-20 02:05:19 +04:00
|
|
|
NM=${NM:Q} OBJDUMP=${OBJDUMP:Q} \
|
2006-05-12 06:12:37 +04:00
|
|
|
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 \
|
2008-10-11 09:03:43 +04:00
|
|
|
gcc_cv_libc_provides_ssp=yes \
|
2006-05-12 06:12:37 +04:00
|
|
|
gdb_cv_printf_has_long_double=yes \
|
|
|
|
gdb_cv_printf_has_long_long=yes \
|
|
|
|
gdb_cv_scanf_has_long_double=yes
|
|
|
|
|
2003-07-25 20:26:51 +04:00
|
|
|
ALL_TARGET= all-gcc
|
|
|
|
INSTALL_TARGET= install-gcc
|
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
.include "${.CURDIR}/../Makefile.gmakehost"
|
|
|
|
BUILD_MAKE=${TOOL_GMAKE}
|
2003-07-25 20:26:51 +04:00
|
|
|
|
2006-06-24 09:29:03 +04:00
|
|
|
CXXADDFLAGS= ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++
|
2006-05-12 06:12:37 +04:00
|
|
|
CCADDFLAGS= ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
|
2003-07-25 20:26:51 +04:00
|
|
|
|
|
|
|
NEWCONFIGDIR?= ${.CURDIR}/../..
|
|
|
|
MKNATIVE?= ${.CURDIR}/mknative-gcc
|
|
|
|
|
|
|
|
bootstrap-libgcc: .configure_done
|
|
|
|
@echo 'Creating files needed for libgcc by a native bootstrap build.'
|
2006-05-12 06:12:37 +04:00
|
|
|
@MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} lib${MODULE} \
|
2003-07-25 20:26:51 +04:00
|
|
|
${.OBJDIR}/build ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
|
|
|
|
|
|
|
|
native-gcc: .native/.configure_done
|
|
|
|
@echo 'Extracting GNU GCC configury for a native toolchain.'
|
2006-05-12 06:12:37 +04:00
|
|
|
@MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} ${MKNATIVE_TARGET} \
|
2003-07-25 20:26:51 +04:00
|
|
|
${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
|
|
|
|
|
2009-03-27 22:19:49 +03:00
|
|
|
NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS} \
|
|
|
|
--disable-multilib \
|
|
|
|
--disable-symvers \
|
|
|
|
--build=`${.CURDIR}/../../gnu/dist/${MODULE}/config.guess` \
|
|
|
|
--host=${MACHINE_GNU_PLATFORM}
|
|
|
|
|
2003-07-25 20:26:51 +04:00
|
|
|
.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
|
2003-11-27 03:56:20 +03:00
|
|
|
mkdir .native 2>/dev/null || true
|
|
|
|
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
2006-05-12 06:12:37 +04:00
|
|
|
(cd .native && ${MKNATIVE_ENV} \
|
2003-10-26 10:25:33 +03:00
|
|
|
${HOST_SH} ${GNUHOSTDIST}/configure \
|
2009-03-27 22:19:49 +03:00
|
|
|
${NATIVE_CONFIGURE_ARGS}) && \
|
2006-06-02 23:44:20 +04:00
|
|
|
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} all-build-libiberty)
|
2006-05-12 06:12:37 +04:00
|
|
|
.if ${HAVE_GCC} == 4
|
2006-05-17 07:26:37 +04:00
|
|
|
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
2006-06-02 23:44:20 +04:00
|
|
|
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-gcc configure-libcpp) && \
|
2006-05-17 07:26:37 +04:00
|
|
|
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} configure-libiberty)
|
|
|
|
# edit Makefile so that maybe-all-gcc does not depend on all-gcc any more.
|
2006-05-12 06:12:37 +04:00
|
|
|
(cd .native && mv Makefile Makefile.config && \
|
2008-10-26 02:15:28 +04:00
|
|
|
${TOOL_SED} -e 's/\(maybe-all-gcc:\) all-gcc/\1/' \
|
|
|
|
< Makefile.config > Makefile) && \
|
2008-10-11 09:03:43 +04:00
|
|
|
(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h)
|
2006-06-02 23:44:20 +04:00
|
|
|
.else
|
|
|
|
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
2006-06-24 09:29:03 +04:00
|
|
|
(cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE} all-libiberty) && \
|
|
|
|
(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} tree-check.h config.h)
|
2006-05-12 06:12:37 +04:00
|
|
|
.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 \
|
2003-07-25 20:26:51 +04:00
|
|
|
configure-target-libstdc++-v3 \
|
|
|
|
ALL_GCC_C= ALL_GCC_CXX= \
|
|
|
|
CC_FOR_TARGET=${CC:Q}' '${CCADDFLAGS:Q} \
|
2006-06-24 09:29:03 +04:00
|
|
|
CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
2006-08-24 00:45:24 +04:00
|
|
|
RAW_CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \
|
2006-06-24 09:29:03 +04:00
|
|
|
CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
|
|
|
|
ac_cv_prog_cc_cross=yes) && \
|
2006-05-12 06:12:37 +04:00
|
|
|
true
|
|
|
|
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
2003-07-25 20:26:51 +04:00
|
|
|
(cd .native/${MACHINE_GNU_PLATFORM}/libstdc++-v3/include && \
|
2006-06-24 09:29:03 +04:00
|
|
|
${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) && \
|
2006-05-12 06:12:37 +04:00
|
|
|
true
|
|
|
|
PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
|
2003-07-25 20:26:51 +04:00
|
|
|
(cd .native/${MACHINE_GNU_PLATFORM}/libiberty && \
|
2006-05-12 06:12:37 +04:00
|
|
|
${MKNATIVE_ENV} ${BUILD_MAKE} needed-list)
|
2003-07-25 20:26:51 +04:00
|
|
|
@touch $@
|
|
|
|
|
|
|
|
clean: clean.native
|
|
|
|
clean.native:
|
|
|
|
-rm -r -f .native
|