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 19.if !defined(__MINIX) 20build/gas/m68k-parse.c: ${GNUHOSTDIST}/gas/m68k-parse.c 21.else 22# MINIX: LSC: Make sure we trigger the fetch rule 23build/gas/m68k-parse.c: ${GNUHOSTDIST:H}/.gitignore .WAIT ${GNUHOSTDIST}/gas/m68k-parse.c 24.endif # !defined(__MINIX) 25 @mkdir build 2>/dev/null || true 26 @mkdir build/gas 2>/dev/null || true 27 cat ${GNUHOSTDIST}/gas/m68k-parse.c > ${.TARGET} 28 29.configure_done: build/gas/m68k-parse.c 30 31MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} 32 33ALL_TARGET= all-binutils all-gas all-ld 34INSTALL_TARGET= install-binutils install-gas install-ld 35.if ${MKCROSSGPROF:Uno} != "no" 36ALL_TARGET+= all-gprof 37INSTALL_TARGET+=install-gprof 38.endif 39 40.if defined(__MINIX) 41ALL_TARGET+= all-gold 42INSTALL_TARGET+=install-gold 43 44CONFIGURE_ARGS+= \ 45 --enable-lto \ 46 --enable-plugins 47# LSC: Here we use the MK variable, as we have to select the right default 48# linker. Problem is, when Gold is not seen, USE_BITCODE is forced to 49# "no". 50.if ${MKBITCODE:Uno} == "yes" 51CONFIGURE_ARGS+= \ 52 --enable-ld=yes \ 53 --enable-gold=default 54.else 55CONFIGURE_ARGS+= \ 56 --enable-ld=default \ 57 --enable-gold=yes 58.endif # ${MKBITCODE:Uno} == "yes" 59.endif # defined(__MINIX) 60.include "${.CURDIR}/../Makefile.gnuhost" 61 62CCADDFLAGS= -I${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/ 63 64# Force avoiding possibly non-executable install-sh. 65CONFIGURE_ENV+= ac_cv_path_mkdir="${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install -d" 66 67NEWCONFIGDIR?= ${.CURDIR}/../.. 68MKNATIVE?= ${.CURDIR}/mknative-binutils 69 70native-binutils: .native/.configure_done 71 @echo 'Extracting GNU binutils configury for a native toolchain.' 72 MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} binutils \ 73 ${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} 74 75.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile 76 mkdir .native 2>/dev/null || true 77 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 78 (cd .native && ${CONFIGURE_ENV:NC*:NLD*} \ 79 CC_FOR_BUILD=${HOST_CC:Q} \ 80 CC=${CC:Q}' '${CCADDFLAGS:Q} \ 81 CXX=${CXX:Q}' '${CCADDFLAGS:Q} \ 82 CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \ 83 CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \ 84 MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \ 85 XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \ 86 LIBS=-lintl \ 87 ac_cv_prog_cc_cross=yes \ 88 ac_cv_func_strcoll_works=yes \ 89 ${HOST_SH} ${GNUHOSTDIST}/configure \ 90 --build=`${GNUHOSTDIST}/config.guess` \ 91 --host=${MACHINE_GNU_PLATFORM} \ 92 --target=${MACHINE_GNU_PLATFORM} \ 93 ${BRANDING} \ 94 ) 95 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 96 (cd .native && ${MAKE} configure-host) 97 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 98 (cd .native/bfd && ${MAKE} bfd.h bfdver.h) 99 PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 100 (cd .native/ld && ${MAKE} ldemul-list.h) 101 @touch $@ 102 103clean: clean.native 104clean.native: 105 -rm -r -f .native 106