11.41Srillig# $NetBSD: Makefile,v 1.42 2025/09/24 14:23:01 rillig Exp $ 21.1Smrg 31.28Schristos.include <bsd.hostinit.mk> 41.1Smrg 51.4SmrgMODULE= binutils 61.1Smrg 71.25SchristosGNUHOSTDIST= ${.CURDIR}/../../external/gpl3/${EXTERNAL_BINUTILS_SUBDIR}/dist 81.13Sskrll 91.14SskrllBRANDING?= \ 101.18Sskrll --with-pkgversion="NetBSD Binutils nb1" \ 111.19Sjoerg --with-bugurl="http://www.NetBSD.org/support/send-pr.html" \ 121.19Sjoerg --with-lib-path="=/usr/lib" --with-sysroot 131.14Sskrll 141.37SchristosBASE_CONFIGURE_ARGS= \ 151.37Schristos --target=${MACHINE_GNU_PLATFORM} \ 161.37Schristos --enable-initfini-array=yes \ 171.37Schristos --enable-default-execstack=no \ 181.37Schristos ${BRANDING} 191.37Schristos 201.37SchristosCONFIGURE_ARGS= --disable-nls --disable-werror \ 211.39Schristos --with-zstd=no \ 221.14Sskrll --program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \ 231.37Schristos ${BASE_CONFIGURE_ARGS} 241.1Smrg 251.4SmrgMAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} 261.1Smrg 271.1SmrgALL_TARGET= all-binutils all-gas all-ld 281.1SmrgINSTALL_TARGET= install-binutils install-gas install-ld 291.11Ssimonb.if ${MKCROSSGPROF:Uno} != "no" 301.11SsimonbALL_TARGET+= all-gprof 311.11SsimonbINSTALL_TARGET+=install-gprof 321.11Ssimonb.endif 331.1Smrg 341.42Srillig.include "${.CURDIR}/../Makefile.gnuhost" 351.1Smrg 361.31SchristosCCADDFLAGS= -I${GNUHOSTDIST}/include -I${DESTDIR}/usr/include 371.31SchristosCCADDFLAGS+= -B${DESTDIR}/usr/lib/ 381.33SchristosCCADDFLAGS+= ${HOST_CPPFLAGS} 391.26SmrgLDADDFLAGS= -L${DESTDIR}/lib -L${DESTDIR}/usr/lib 401.1Smrg 411.22Smrg# Force avoiding possibly non-executable install-sh. 421.22SmrgCONFIGURE_ENV+= ac_cv_path_mkdir="${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install -d" 431.22Smrg 441.1SmrgNEWCONFIGDIR?= ${.CURDIR}/../.. 451.38Srin.if ${EXTERNAL_BINUTILS_SUBDIR} == "binutils.old" 461.38SrinMKNATIVE= ${.CURDIR}/mknative-binutils.old 471.38Srin.endif 481.4SmrgMKNATIVE?= ${.CURDIR}/mknative-binutils 491.1Smrg 501.1Smrgnative-binutils: .native/.configure_done 511.1Smrg @echo 'Extracting GNU binutils configury for a native toolchain.' 521.42Srillig MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} binutils \ 531.1Smrg ${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} 541.1Smrg 551.1Smrg.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile 561.4Smrg mkdir .native 2>/dev/null || true 571.4Smrg PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 581.1Smrg (cd .native && ${CONFIGURE_ENV:NC*:NLD*} \ 591.1Smrg CC_FOR_BUILD=${HOST_CC:Q} \ 601.1Smrg CC=${CC:Q}' '${CCADDFLAGS:Q} \ 611.1Smrg CXX=${CXX:Q}' '${CCADDFLAGS:Q} \ 621.1Smrg CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \ 631.26Smrg CFLAGS= CPPFLAGS= CXXFLAGS= \ 641.26Smrg LDFLAGS=${LDADDFLAGS:Q} \ 651.1Smrg MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \ 661.1Smrg XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \ 671.1Smrg LIBS=-lintl \ 681.1Smrg ac_cv_prog_cc_cross=yes \ 691.1Smrg ac_cv_func_strcoll_works=yes \ 701.3Slukem ${HOST_SH} ${GNUHOSTDIST}/configure \ 711.7Smrg --build=`${GNUHOSTDIST}/config.guess` \ 721.1Smrg --host=${MACHINE_GNU_PLATFORM} \ 731.37Schristos ${BASE_CONFIGURE_ARGS} \ 741.14Sskrll ) 751.12Suebayasi PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 761.12Suebayasi (cd .native && ${MAKE} configure-host) 771.12Suebayasi PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 781.12Suebayasi (cd .native/bfd && ${MAKE} bfd.h bfdver.h) 791.12Suebayasi PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 801.10Sskrll (cd .native/ld && ${MAKE} ldemul-list.h) 811.1Smrg @touch $@ 821.1Smrg 831.40SchristosCLEANFILES+= PREV_BINUTILS 841.40Schristos 851.40Schristos.if !defined(PREV_BINUTILS) 861.40Schristos. if exists(PREV_BINUTILS) 871.40SchristosPREV_BINUTILS!= cat PREV_BINUTILS 881.40Schristos. else 891.40SchristosPREV_BINUTILS= 901.40Schristos. endif 911.40Schristos.endif 921.40Schristos 931.40SchristosCLEANFILES+= PREV_BINUTILS 941.40Schristos 951.40Schristos# Include the local NetBSD BINUTILS version so that bumps to it trigger rebuilds. 961.40SchristosNETBSD_BINUTILS_VERSION_NOSPACE=nb1 # just to keep it the same with gcc 971.40Schristos 981.40Schristosrealall realdepend: .MAKE 991.40Schristos.if !empty(PREV_BINUTILS) && "${PREV_BINUTILS}" != "${EXTERNAL_BINUTILS_SUBDIR}-${HAVE_BINUTILS}-${NETBSD_BINUTILS_VERSION_NOSPACE}" 1001.40Schristos @echo "*** WARNING: BINUTILS has changed version?" 1011.40Schristos @echo "*** PREV_BINUTILS '${PREV_BINUTILS}'" 1021.40Schristos @echo "*** NETBSD_BINUTILS_VERSION_NOSPACE '${NETBSD_BINUTILS_VERSION_NOSPACE}'" 1031.40Schristos @echo "*** != EXTERNAL_BINUTILS_SUBDIR-HAVE_BINUTILS-NETBSD_BINUTILS_VERSION_NOSPACE:" 1041.40Schristos @echo "*** != '${EXTERNAL_BINUTILS_SUBDIR}-${HAVE_BINUTILS}-${NETBSD_BINUTILS_VERSION_NOSPACE}'" 1051.40Schristos @echo "*** Cleaning mis-matched tools/binutils" 1061.40Schristos rm -f PREV_BINUTILS 1071.40Schristos (cd ${.CURDIR} && ${MAKE} cleandir) 1081.40Schristos.endif 1091.40Schristos echo ${EXTERNAL_BINUTILS_SUBDIR}-${HAVE_BINUTILS}-${NETBSD_BINUTILS_VERSION_NOSPACE} >PREV_BINUTILS 1101.40Schristos 1111.1Smrgclean: clean.native 1121.1Smrgclean.native: 1131.1Smrg -rm -r -f .native 1141.40Schristos 115