xref: /netbsd-src/tools/binutils/Makefile (revision 230b95665bbd3a9d1a53658a36b1053f8382a519)
1#	$NetBSD: Makefile,v 1.24 2014/02/15 13:34:28 tsutsui 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
19build/gas/m68k-parse.c: ${GNUHOSTDIST}/gas/m68k-parse.c
20	@mkdir build 2>/dev/null || true
21	@mkdir build/gas 2>/dev/null || true
22	cat ${GNUHOSTDIST}/gas/m68k-parse.c > ${.TARGET}
23
24.configure_done: build/gas/m68k-parse.c
25
26MAKE_ARGS=	MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q}
27
28ALL_TARGET=	all-binutils all-gas all-ld
29INSTALL_TARGET=	install-binutils install-gas install-ld
30.if ${MKCROSSGPROF:Uno} != "no"
31ALL_TARGET+=	all-gprof
32INSTALL_TARGET+=install-gprof
33.endif
34
35.include "${.CURDIR}/../Makefile.gnuhost"
36
37CCADDFLAGS=	-I${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
38
39# Force avoiding possibly non-executable install-sh.
40CONFIGURE_ENV+= ac_cv_path_mkdir="${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install -d"
41
42NEWCONFIGDIR?=	${.CURDIR}/../..
43MKNATIVE?=	${.CURDIR}/mknative-binutils
44
45native-binutils: .native/.configure_done
46	@echo 'Extracting GNU binutils configury for a native toolchain.'
47	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} binutils \
48		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
49
50.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
51	mkdir .native 2>/dev/null || true
52	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
53		(cd .native && ${CONFIGURE_ENV:NC*:NLD*} \
54			CC_FOR_BUILD=${HOST_CC:Q} \
55			CC=${CC:Q}' '${CCADDFLAGS:Q} \
56			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
57			CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
58			CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
59			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
60			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
61			LIBS=-lintl \
62			ac_cv_prog_cc_cross=yes \
63			ac_cv_func_strcoll_works=yes \
64			${HOST_SH} ${GNUHOSTDIST}/configure \
65			--build=`${GNUHOSTDIST}/config.guess` \
66			--host=${MACHINE_GNU_PLATFORM} \
67			--target=${MACHINE_GNU_PLATFORM} \
68			${BRANDING} \
69		)
70	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
71		(cd .native && ${MAKE} configure-host)
72	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
73		(cd .native/bfd && ${MAKE} bfd.h bfdver.h)
74	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
75		(cd .native/ld && ${MAKE} ldemul-list.h)
76	@touch $@
77
78clean: clean.native
79clean.native:
80	-rm -r -f .native
81