Makefile revision 1.28
11.28Schristos#	$NetBSD: Makefile,v 1.28 2016/10/12 18:43:40 christos Exp $
21.1Scl
31.1Scl.include <bsd.own.mk>
41.1Scl
51.19SchristosMODULE=		gdb
61.27SchristosGNUHOSTDIST=    ${.CURDIR}/../../external/gpl3/${EXTERNAL_GDB_SUBDIR}/dist
71.1Scl
81.1SclFIND_ARGS=	\! \( -type d -name sim -prune \)
91.1Scl
101.1SclCONFIGURE_ARGS=	--target=${MACHINE_GNU_PLATFORM} --disable-nls \
111.1Scl		--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-,"
121.1Scl
131.1SclMAKE_ARGS=	MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q}
141.1Scl
151.1SclALL_TARGET=	all-gdb
161.1SclINSTALL_TARGET=	install-gdb
171.1Scl
181.22Sbouyer.include "${.CURDIR}/../Makefile.gmakehost"
191.1Scl
201.19SchristosCCADDFLAGS=	--sysroot=${DESTDIR} -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/ -I${.OBJDIR}/.native/gcc/include
211.28SchristosCXXADDFLAGS+= -D__STDC_FORMAT_MACROS
221.28SchristosCXXADDFLAGS+= -D__STDC_LIMIT_MACROS
231.28SchristosCXXADDFLAGS+= -D__STDC_CONSTANT_MACROS
241.2Snathanw
251.2SnathanwNEWCONFIGDIR?=	${.CURDIR}/../..
261.2SnathanwMKNATIVE?=	${.CURDIR}/mknative-gdb
271.2Snathanw
281.7Suwe# Some configure tests require running a test program, which is not
291.7Suwe# possible when cross-building.  Provide configure with "cached"
301.7Suwe# values in the environment.
311.7SuweMKNATIVE_CONFIGURE_PRESET= \
321.7Suwe	ac_cv_prog_cc_cross=yes \
331.7Suwe	ac_cv_func_fork_works=yes \
341.7Suwe	ac_cv_func_strcoll_works=yes \
351.7Suwe	bash_cv_func_ctype_nonascii=yes \
361.7Suwe	bash_cv_func_sigsetjmp=present \
371.7Suwe	bash_cv_func_strcoll_broken=no \
381.7Suwe	bash_cv_must_reinstall_sighandlers=no
391.7Suwe
401.17Shans# Recent versions of Solaris have ncurses, but they hide the lib in an
411.17Shans# odd directory. Prevent configure from finding the ncurses headers,
421.17Shans# Solaris curses is sufficient.
431.17Shans.if ${BUILD_OSTYPE} == "SunOS"
441.17ShansCONFIGURE_ENV+=	ac_cv_header_ncurses_h=no \
451.17Shans		ac_cv_header_ncurses_ncurses_h=no \
461.17Shans		ac_cv_header_ncurses_term_h=no
471.17Shans.endif
481.17Shans
491.8Suwe# Disable sim unless it's known to work (configure's default is to
501.8Suwe# enable sim if supported).
511.8SuweCONFIGURE_ARGS_SIM=
521.8Suwe.if \
531.9Sskrll    ${MACHINE_CPU} != "powerpc" && \
541.8Suwe    ${MACHINE_CPU} != "powerpc64"
551.8SuweCONFIGURE_ARGS_SIM+= --disable-sim
561.8Suwe.endif
571.8Suwe
581.2Snathanwnative-gdb: .native/.configure_done
591.2Snathanw	@echo 'Extracting GDB configury for a native toolchain.'
601.2Snathanw	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \
611.2Snathanw		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
621.2Snathanw
631.2Snathanw.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
641.3Snathanw	mkdir ${.OBJDIR}/.native 2>/dev/null || true
651.2Snathanw	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
661.3Snathanw		(cd ${.OBJDIR}/.native && ${CONFIGURE_ENV:NC*:NLD*} \
671.2Snathanw			CC_FOR_BUILD=${HOST_CC:Q} \
681.2Snathanw			CC=${CC:Q}' '${CCADDFLAGS:Q} \
691.2Snathanw			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
701.6Suwe			CPP=${CPP:Q}' '-isystem' '${DESTDIR}/usr/include \
711.28Schristos			CFLAGS= CPPFLAGS= CXXFLAGS=${CXXADDFLAGS:Q} \
721.28Schristos			LDFLAGS=${LDADDFLAGS:Q} \
731.2Snathanw			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
741.2Snathanw			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
751.2Snathanw			LIBS=-lintl \
761.7Suwe			${MKNATIVE_CONFIGURE_PRESET} \
771.2Snathanw			${HOST_SH} ${GNUHOSTDIST}/configure \
781.4Snathanw			--prefix=/usr \
791.5Slukem			--with-separate-debug-dir=/usr/libdata/debug \
801.8Suwe			${CONFIGURE_ARGS_SIM} \
811.2Snathanw			--build=`${GNUHOSTDIST}/config.guess` \
821.2Snathanw			--host=${MACHINE_GNU_PLATFORM} \
831.2Snathanw			--target=${MACHINE_GNU_PLATFORM}) && \
841.7Suwe		(cd ${.OBJDIR}/.native && \
851.7Suwe			/usr/bin/env ${MKNATIVE_CONFIGURE_PRESET} \
861.7Suwe				${MAKE} configure-host) && \
871.3Snathanw		(cd ${.OBJDIR}/.native/bfd && ${MAKE} bfd.h bfdver.h) && \
881.3Snathanw		(cd ${.OBJDIR}/.native/gdb && ${MAKE} init.c version.c)
891.2Snathanw	@touch $@
901.2Snathanw
911.2Snathanwclean: clean.native
921.2Snathanwclean.native:
931.2Snathanw	-rm -r -f .native
94