xref: /minix/tools/binutils/Makefile (revision 83133719)
1#	$NetBSD: Makefile,v 1.22 2012/04/15 08:37:32 mrg Exp $
2
3.include <bsd.own.mk>
4
5MODULE=		binutils
6
7GNUHOSTDIST=	${.CURDIR}/../../external/gpl3/binutils/dist
8
9BRANDING?=	\
10	--with-pkgversion="NetBSD Binutils nb1" \
11	--with-bugurl="http://www.NetBSD.org/support/send-pr.html" \
12	--with-lib-path="=/usr/lib" --with-sysroot
13
14CONFIGURE_ARGS=	--target=${MACHINE_GNU_PLATFORM} --disable-nls \
15		--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
16		--disable-werror \
17		${BRANDING}
18
19MAKE_ARGS=	MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q}
20
21ALL_TARGET=	all-binutils all-gas all-ld
22INSTALL_TARGET=	install-binutils install-gas install-ld
23.if ${MKCROSSGPROF:Uno} != "no"
24ALL_TARGET+=	all-gprof
25INSTALL_TARGET+=install-gprof
26.endif
27
28.if defined(__MINIX)
29ALL_TARGET+=	all-gold
30INSTALL_TARGET+=install-gold
31
32CONFIGURE_ARGS+=	\
33	--enable-lto \
34	--enable-plugins
35# LSC: Here we use the MK variable, as we have to select the right default
36#      linker. Problem is, when Gold is not seen, USE_BITCODE is forced to
37#      "no".
38.if ${MKBITCODE:Uno} == "yes"
39CONFIGURE_ARGS+= \
40	--enable-ld=yes \
41	--enable-gold=default
42.else
43CONFIGURE_ARGS+= \
44	--enable-ld=default \
45	--enable-gold=yes
46.endif # ${MKBITCODE:Uno} == "yes"
47.endif # defined(__MINIX)
48.include "${.CURDIR}/../Makefile.gnuhost"
49
50CCADDFLAGS=	-I${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
51
52# Force avoiding possibly non-executable install-sh.
53CONFIGURE_ENV+= ac_cv_path_mkdir="${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install -d"
54
55NEWCONFIGDIR?=	${.CURDIR}/../..
56MKNATIVE?=	${.CURDIR}/mknative-binutils
57
58native-binutils: .native/.configure_done
59	@echo 'Extracting GNU binutils configury for a native toolchain.'
60	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} binutils \
61		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
62
63.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
64	mkdir .native 2>/dev/null || true
65	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
66		(cd .native && ${CONFIGURE_ENV:NC*:NLD*} \
67			CC_FOR_BUILD=${HOST_CC:Q} \
68			CC=${CC:Q}' '${CCADDFLAGS:Q} \
69			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
70			CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
71			CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
72			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
73			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
74			LIBS=-lintl \
75			ac_cv_prog_cc_cross=yes \
76			ac_cv_func_strcoll_works=yes \
77			${HOST_SH} ${GNUHOSTDIST}/configure \
78			--build=`${GNUHOSTDIST}/config.guess` \
79			--host=${MACHINE_GNU_PLATFORM} \
80			--target=${MACHINE_GNU_PLATFORM} \
81			${BRANDING} \
82		)
83	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
84		(cd .native && ${MAKE} configure-host)
85	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
86		(cd .native/bfd && ${MAKE} bfd.h bfdver.h)
87	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
88		(cd .native/ld && ${MAKE} ldemul-list.h)
89	@touch $@
90
91clean: clean.native
92clean.native:
93	-rm -r -f .native
94