Makefile revision 1.5
1#	$NetBSD: Makefile,v 1.5 2003/12/01 09:37:09 mrg Exp $
2
3.include <bsd.own.mk>
4
5.if ${HAVE_BINUTILS214} == "yes"
6MODULE=		binutils
7.else
8MODULE=		toolchain
9.endif
10
11CONFIGURE_ARGS=	--target=${MACHINE_GNU_PLATFORM} --disable-nls \
12		--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-,"
13
14MAKE_ARGS=	MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q}
15
16ALL_TARGET=	all-binutils all-gas all-ld
17INSTALL_TARGET=	install-binutils install-gas install-ld
18
19.include "${.CURDIR}/../Makefile.gnuhost"
20
21CCADDFLAGS=	-I${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
22
23NEWCONFIGDIR?=	${.CURDIR}/../..
24MKNATIVE?=	${.CURDIR}/mknative-binutils
25
26native-binutils: .native/.configure_done
27	@echo 'Extracting GNU binutils configury for a native toolchain.'
28	@MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} binutils \
29		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
30
31.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
32	mkdir .native 2>/dev/null || true
33	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
34		(cd .native && ${CONFIGURE_ENV:NC*:NLD*} \
35			CC_FOR_BUILD=${HOST_CC:Q} \
36			CC=${CC:Q}' '${CCADDFLAGS:Q} \
37			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
38			CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
39			CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
40			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
41			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
42			LIBS=-lintl \
43			ac_cv_prog_cc_cross=yes \
44			ac_cv_func_strcoll_works=yes \
45			${HOST_SH} ${GNUHOSTDIST}/configure \
46			--build=`${.CURDIR}/../../gnu/dist/toolchain/config.guess` \
47			--host=${MACHINE_GNU_PLATFORM} \
48			--target=${MACHINE_GNU_PLATFORM}) && \
49		(cd .native && ${MAKE} configure-host) && \
50		(cd .native/bfd && ${MAKE} bfd.h) && \
51		(cd .native/ld && ${MAKE} ldemul-list.h) && \
52		(cd .native && \
53			${MAKE} configure-target-libiberty \
54			CC_FOR_TARGET=${CC:Q}' '${CCADDFLAGS:Q} \
55			CXX_FOR_TARGET=${CXX:Q}' '${CCADDFLAGS:Q} \
56			CPP=${CPP:Q}' '-I${DESTDIR}/usr/include) && \
57		(cd .native/${MACHINE_GNU_PLATFORM}/libiberty && \
58			${MAKE} needed-list)
59	@touch $@
60
61clean: clean.native
62clean.native:
63	-rm -r -f .native
64