Makefile revision 1.30
11.30Smrg#	$NetBSD: Makefile,v 1.30 2016/10/16 04:37:42 mrg Exp $
21.1Scl
31.1Scl.include <bsd.own.mk>
41.1Scl
51.19SchristosMODULE=		gdb
61.30SmrgGDBDIR=		${.CURDIR}/../../external/gpl3/${EXTERNAL_GDB_SUBDIR}
71.30SmrgGNUHOSTDIST=    ${GDBDIR}/dist
81.1Scl
91.1SclFIND_ARGS=	\! \( -type d -name sim -prune \)
101.1Scl
111.1SclCONFIGURE_ARGS=	--target=${MACHINE_GNU_PLATFORM} --disable-nls \
121.1Scl		--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-,"
131.1Scl
141.1SclMAKE_ARGS=	MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q}
151.1Scl
161.1SclALL_TARGET=	all-gdb
171.1SclINSTALL_TARGET=	install-gdb
181.1Scl
191.30Smrg.include "${GDBDIR}/Makefile.gdb_arch"
201.30Smrg#GDB_MACHINE_ARCH=       ${MACHINE_ARCH:C/e?armv[4-7]h?f?/arm/}
211.30Smrg
221.22Sbouyer.include "${.CURDIR}/../Makefile.gmakehost"
231.1Scl
241.29SchristosCCADDFLAGS+= --sysroot=${DESTDIR} -B${DESTDIR}/usr/lib/ -I${.OBJDIR}/.native/gcc/include
251.29SchristosLDADDFLAGS+= -L${DESTDIR}/lib -L${DESTDIR}/usr/lib
261.28SchristosCXXADDFLAGS+= -D__STDC_FORMAT_MACROS
271.28SchristosCXXADDFLAGS+= -D__STDC_LIMIT_MACROS
281.28SchristosCXXADDFLAGS+= -D__STDC_CONSTANT_MACROS
291.29SchristosHOST_CXXFLAGS+= ${CXXADDFLAGS}
301.2Snathanw
311.2SnathanwNEWCONFIGDIR?=	${.CURDIR}/../..
321.2SnathanwMKNATIVE?=	${.CURDIR}/mknative-gdb
331.2Snathanw
341.7Suwe# Some configure tests require running a test program, which is not
351.7Suwe# possible when cross-building.  Provide configure with "cached"
361.7Suwe# values in the environment.
371.7SuweMKNATIVE_CONFIGURE_PRESET= \
381.7Suwe	ac_cv_prog_cc_cross=yes \
391.7Suwe	ac_cv_func_fork_works=yes \
401.7Suwe	ac_cv_func_strcoll_works=yes \
411.7Suwe	bash_cv_func_ctype_nonascii=yes \
421.7Suwe	bash_cv_func_sigsetjmp=present \
431.7Suwe	bash_cv_func_strcoll_broken=no \
441.7Suwe	bash_cv_must_reinstall_sighandlers=no
451.7Suwe
461.17Shans# Recent versions of Solaris have ncurses, but they hide the lib in an
471.17Shans# odd directory. Prevent configure from finding the ncurses headers,
481.17Shans# Solaris curses is sufficient.
491.17Shans.if ${BUILD_OSTYPE} == "SunOS"
501.17ShansCONFIGURE_ENV+=	ac_cv_header_ncurses_h=no \
511.17Shans		ac_cv_header_ncurses_ncurses_h=no \
521.17Shans		ac_cv_header_ncurses_term_h=no
531.17Shans.endif
541.17Shans
551.8Suwe# Disable sim unless it's known to work (configure's default is to
561.8Suwe# enable sim if supported).
571.8SuweCONFIGURE_ARGS_SIM=
581.8Suwe.if \
591.9Sskrll    ${MACHINE_CPU} != "powerpc" && \
601.8Suwe    ${MACHINE_CPU} != "powerpc64"
611.8SuweCONFIGURE_ARGS_SIM+= --disable-sim
621.8Suwe.endif
631.8Suwe
641.2Snathanwnative-gdb: .native/.configure_done
651.2Snathanw	@echo 'Extracting GDB configury for a native toolchain.'
661.2Snathanw	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \
671.30Smrg		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} \
681.30Smrg		${GDB_MACHINE_ARCH}
691.2Snathanw
701.2Snathanw.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
711.3Snathanw	mkdir ${.OBJDIR}/.native 2>/dev/null || true
721.2Snathanw	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
731.3Snathanw		(cd ${.OBJDIR}/.native && ${CONFIGURE_ENV:NC*:NLD*} \
741.2Snathanw			CC_FOR_BUILD=${HOST_CC:Q} \
751.2Snathanw			CC=${CC:Q}' '${CCADDFLAGS:Q} \
761.2Snathanw			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
771.6Suwe			CPP=${CPP:Q}' '-isystem' '${DESTDIR}/usr/include \
781.28Schristos			CFLAGS= CPPFLAGS= CXXFLAGS=${CXXADDFLAGS:Q} \
791.28Schristos			LDFLAGS=${LDADDFLAGS:Q} \
801.2Snathanw			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
811.2Snathanw			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
821.2Snathanw			LIBS=-lintl \
831.7Suwe			${MKNATIVE_CONFIGURE_PRESET} \
841.2Snathanw			${HOST_SH} ${GNUHOSTDIST}/configure \
851.4Snathanw			--prefix=/usr \
861.5Slukem			--with-separate-debug-dir=/usr/libdata/debug \
871.8Suwe			${CONFIGURE_ARGS_SIM} \
881.2Snathanw			--build=`${GNUHOSTDIST}/config.guess` \
891.2Snathanw			--host=${MACHINE_GNU_PLATFORM} \
901.2Snathanw			--target=${MACHINE_GNU_PLATFORM}) && \
911.7Suwe		(cd ${.OBJDIR}/.native && \
921.7Suwe			/usr/bin/env ${MKNATIVE_CONFIGURE_PRESET} \
931.7Suwe				${MAKE} configure-host) && \
941.3Snathanw		(cd ${.OBJDIR}/.native/bfd && ${MAKE} bfd.h bfdver.h) && \
951.3Snathanw		(cd ${.OBJDIR}/.native/gdb && ${MAKE} init.c version.c)
961.2Snathanw	@touch $@
971.2Snathanw
981.2Snathanwclean: clean.native
991.2Snathanwclean.native:
1001.2Snathanw	-rm -r -f .native
101