Home | History | Annotate | Line # | Download | only in binutils
      1  1.43  christos #	$NetBSD: Makefile,v 1.43 2026/03/07 19:06:51 christos Exp $
      2   1.1       mrg 
      3  1.28  christos .include <bsd.hostinit.mk>
      4   1.1       mrg 
      5   1.4       mrg MODULE=		binutils
      6   1.1       mrg 
      7  1.25  christos GNUHOSTDIST=	${.CURDIR}/../../external/gpl3/${EXTERNAL_BINUTILS_SUBDIR}/dist
      8  1.13     skrll 
      9  1.14     skrll BRANDING?=	\
     10  1.18     skrll 	--with-pkgversion="NetBSD Binutils nb1" \
     11  1.19     joerg 	--with-bugurl="http://www.NetBSD.org/support/send-pr.html" \
     12  1.19     joerg 	--with-lib-path="=/usr/lib" --with-sysroot
     13  1.14     skrll 
     14  1.37  christos BASE_CONFIGURE_ARGS= \
     15  1.37  christos 	--target=${MACHINE_GNU_PLATFORM} \
     16  1.37  christos 	--enable-initfini-array=yes \
     17  1.37  christos 	--enable-default-execstack=no \
     18  1.43  christos 	--with-debuginfod=no \
     19  1.37  christos 	${BRANDING}
     20  1.37  christos 
     21  1.37  christos CONFIGURE_ARGS=	--disable-nls --disable-werror \
     22  1.39  christos 		--with-zstd=no \
     23  1.14     skrll 		--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \
     24  1.37  christos 		${BASE_CONFIGURE_ARGS}
     25   1.1       mrg 
     26   1.4       mrg MAKE_ARGS=	MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q}
     27   1.1       mrg 
     28   1.1       mrg ALL_TARGET=	all-binutils all-gas all-ld
     29   1.1       mrg INSTALL_TARGET=	install-binutils install-gas install-ld
     30  1.11    simonb .if ${MKCROSSGPROF:Uno} != "no"
     31  1.11    simonb ALL_TARGET+=	all-gprof
     32  1.11    simonb INSTALL_TARGET+=install-gprof
     33  1.11    simonb .endif
     34   1.1       mrg 
     35  1.42    rillig .include "${.CURDIR}/../Makefile.gnuhost"
     36   1.1       mrg 
     37  1.31  christos CCADDFLAGS=	-I${GNUHOSTDIST}/include  -I${DESTDIR}/usr/include
     38  1.31  christos CCADDFLAGS+=	-B${DESTDIR}/usr/lib/
     39  1.33  christos CCADDFLAGS+=	${HOST_CPPFLAGS}
     40  1.26       mrg LDADDFLAGS=	-L${DESTDIR}/lib -L${DESTDIR}/usr/lib
     41   1.1       mrg 
     42  1.22       mrg # Force avoiding possibly non-executable install-sh.
     43  1.22       mrg CONFIGURE_ENV+= ac_cv_path_mkdir="${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install -d"
     44  1.22       mrg 
     45   1.1       mrg NEWCONFIGDIR?=	${.CURDIR}/../..
     46  1.38       rin .if ${EXTERNAL_BINUTILS_SUBDIR} == "binutils.old"
     47  1.38       rin MKNATIVE=	${.CURDIR}/mknative-binutils.old
     48  1.38       rin .endif
     49   1.4       mrg MKNATIVE?=	${.CURDIR}/mknative-binutils
     50   1.1       mrg 
     51   1.1       mrg native-binutils: .native/.configure_done
     52   1.1       mrg 	@echo 'Extracting GNU binutils configury for a native toolchain.'
     53  1.42    rillig 	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} binutils \
     54   1.1       mrg 		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
     55   1.1       mrg 
     56   1.1       mrg .native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
     57   1.4       mrg 	mkdir .native 2>/dev/null || true
     58   1.4       mrg 	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
     59   1.1       mrg 		(cd .native && ${CONFIGURE_ENV:NC*:NLD*} \
     60   1.1       mrg 			CC_FOR_BUILD=${HOST_CC:Q} \
     61   1.1       mrg 			CC=${CC:Q}' '${CCADDFLAGS:Q} \
     62   1.1       mrg 			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
     63   1.1       mrg 			CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \
     64  1.26       mrg 			CFLAGS= CPPFLAGS= CXXFLAGS= \
     65  1.26       mrg 			LDFLAGS=${LDADDFLAGS:Q} \
     66   1.1       mrg 			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
     67   1.1       mrg 			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
     68   1.1       mrg 			LIBS=-lintl \
     69   1.1       mrg 			ac_cv_prog_cc_cross=yes \
     70   1.1       mrg 			ac_cv_func_strcoll_works=yes \
     71   1.3     lukem 			${HOST_SH} ${GNUHOSTDIST}/configure \
     72   1.7       mrg 			--build=`${GNUHOSTDIST}/config.guess` \
     73   1.1       mrg 			--host=${MACHINE_GNU_PLATFORM} \
     74  1.37  christos 			${BASE_CONFIGURE_ARGS} \
     75  1.14     skrll 		)
     76  1.12  uebayasi 	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
     77  1.12  uebayasi 		(cd .native && ${MAKE} configure-host)
     78  1.12  uebayasi 	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
     79  1.12  uebayasi 		(cd .native/bfd && ${MAKE} bfd.h bfdver.h)
     80  1.12  uebayasi 	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
     81  1.10     skrll 		(cd .native/ld && ${MAKE} ldemul-list.h)
     82   1.1       mrg 	@touch $@
     83   1.1       mrg 
     84  1.40  christos CLEANFILES+=	PREV_BINUTILS
     85  1.40  christos 
     86  1.40  christos .if !defined(PREV_BINUTILS)
     87  1.40  christos .  if exists(PREV_BINUTILS)
     88  1.40  christos PREV_BINUTILS!=	cat PREV_BINUTILS
     89  1.40  christos .  else
     90  1.40  christos PREV_BINUTILS=
     91  1.40  christos .  endif
     92  1.40  christos .endif
     93  1.40  christos 
     94  1.40  christos CLEANFILES+=	PREV_BINUTILS
     95  1.40  christos 
     96  1.40  christos # Include the local NetBSD BINUTILS version so that bumps to it trigger rebuilds.
     97  1.40  christos NETBSD_BINUTILS_VERSION_NOSPACE=nb1	# just to keep it the same with gcc
     98  1.40  christos 
     99  1.40  christos realall realdepend: .MAKE
    100  1.40  christos .if !empty(PREV_BINUTILS) && "${PREV_BINUTILS}" != "${EXTERNAL_BINUTILS_SUBDIR}-${HAVE_BINUTILS}-${NETBSD_BINUTILS_VERSION_NOSPACE}"
    101  1.40  christos 	@echo "*** WARNING: BINUTILS has changed version?"
    102  1.40  christos 	@echo "*** PREV_BINUTILS '${PREV_BINUTILS}'"
    103  1.40  christos 	@echo "*** NETBSD_BINUTILS_VERSION_NOSPACE '${NETBSD_BINUTILS_VERSION_NOSPACE}'"
    104  1.40  christos 	@echo "***     !=  EXTERNAL_BINUTILS_SUBDIR-HAVE_BINUTILS-NETBSD_BINUTILS_VERSION_NOSPACE:"
    105  1.40  christos 	@echo "***     !=  '${EXTERNAL_BINUTILS_SUBDIR}-${HAVE_BINUTILS}-${NETBSD_BINUTILS_VERSION_NOSPACE}'"
    106  1.40  christos 	@echo "*** Cleaning mis-matched tools/binutils"
    107  1.40  christos 	rm -f PREV_BINUTILS
    108  1.40  christos 	(cd ${.CURDIR} && ${MAKE} cleandir)
    109  1.40  christos .endif
    110  1.40  christos 	echo ${EXTERNAL_BINUTILS_SUBDIR}-${HAVE_BINUTILS}-${NETBSD_BINUTILS_VERSION_NOSPACE} >PREV_BINUTILS
    111  1.40  christos 
    112   1.1       mrg clean: clean.native
    113   1.1       mrg clean.native:
    114   1.1       mrg 	-rm -r -f .native
    115  1.40  christos 
    116