Makefile revision 1.19
11.19Schristos#	$NetBSD: Makefile,v 1.19 2011/09/26 02:36:19 christos Exp $
21.1Scl
31.1Scl.include <bsd.own.mk>
41.1Scl
51.19SchristosMODULE=		gdb
61.19SchristosGNUHOSTDIST=    ${.CURDIR}/../../external/gpl3/gdb/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.1Scl.include "${.CURDIR}/../Makefile.gnuhost"
191.1Scl
201.19Schristos.if ${HAVE_GCC} >= 45
211.19SchristosCCADDFLAGS=	--sysroot=${DESTDIR} -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/ -I${.OBJDIR}/.native/gcc/include
221.19Schristos.else
231.19SchristosCCADDFLAGS=	${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
241.19Schristos.endif
251.2Snathanw
261.2SnathanwNEWCONFIGDIR?=	${.CURDIR}/../..
271.2SnathanwMKNATIVE?=	${.CURDIR}/mknative-gdb
281.2Snathanw
291.7Suwe# Some configure tests require running a test program, which is not
301.7Suwe# possible when cross-building.  Provide configure with "cached"
311.7Suwe# values in the environment.
321.7SuweMKNATIVE_CONFIGURE_PRESET= \
331.7Suwe	ac_cv_prog_cc_cross=yes \
341.7Suwe	ac_cv_func_fork_works=yes \
351.7Suwe	ac_cv_func_strcoll_works=yes \
361.7Suwe	bash_cv_func_ctype_nonascii=yes \
371.7Suwe	bash_cv_func_sigsetjmp=present \
381.7Suwe	bash_cv_func_strcoll_broken=no \
391.7Suwe	bash_cv_must_reinstall_sighandlers=no
401.7Suwe
411.17Shans# Recent versions of Solaris have ncurses, but they hide the lib in an
421.17Shans# odd directory. Prevent configure from finding the ncurses headers,
431.17Shans# Solaris curses is sufficient.
441.17Shans.if ${BUILD_OSTYPE} == "SunOS"
451.17ShansCONFIGURE_ENV+=	ac_cv_header_ncurses_h=no \
461.17Shans		ac_cv_header_ncurses_ncurses_h=no \
471.17Shans		ac_cv_header_ncurses_term_h=no
481.17Shans.endif
491.17Shans
501.8Suwe# Disable sim unless it's known to work (configure's default is to
511.8Suwe# enable sim if supported).
521.8SuweCONFIGURE_ARGS_SIM=
531.8Suwe.if \
541.11Smrg    ${MACHINE_CPU} != "mips" && \
551.9Sskrll    ${MACHINE_CPU} != "powerpc" && \
561.8Suwe    ${MACHINE_CPU} != "powerpc64"
571.8SuweCONFIGURE_ARGS_SIM+= --disable-sim
581.8Suwe.endif
591.8Suwe
601.2Snathanwnative-gdb: .native/.configure_done
611.2Snathanw	@echo 'Extracting GDB configury for a native toolchain.'
621.2Snathanw	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \
631.2Snathanw		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
641.2Snathanw
651.2Snathanw.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
661.3Snathanw	mkdir ${.OBJDIR}/.native 2>/dev/null || true
671.2Snathanw	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
681.3Snathanw		(cd ${.OBJDIR}/.native && ${CONFIGURE_ENV:NC*:NLD*} \
691.2Snathanw			CC_FOR_BUILD=${HOST_CC:Q} \
701.2Snathanw			CC=${CC:Q}' '${CCADDFLAGS:Q} \
711.2Snathanw			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
721.6Suwe			CPP=${CPP:Q}' '-isystem' '${DESTDIR}/usr/include \
731.18Snjoly			CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS=${LDADDFLAGS:Q} \
741.2Snathanw			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
751.2Snathanw			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
761.2Snathanw			LIBS=-lintl \
771.7Suwe			${MKNATIVE_CONFIGURE_PRESET} \
781.2Snathanw			${HOST_SH} ${GNUHOSTDIST}/configure \
791.4Snathanw			--prefix=/usr \
801.5Slukem			--with-separate-debug-dir=/usr/libdata/debug \
811.8Suwe			${CONFIGURE_ARGS_SIM} \
821.2Snathanw			--build=`${GNUHOSTDIST}/config.guess` \
831.2Snathanw			--host=${MACHINE_GNU_PLATFORM} \
841.2Snathanw			--target=${MACHINE_GNU_PLATFORM}) && \
851.7Suwe		(cd ${.OBJDIR}/.native && \
861.7Suwe			/usr/bin/env ${MKNATIVE_CONFIGURE_PRESET} \
871.7Suwe				${MAKE} configure-host) && \
881.3Snathanw		(cd ${.OBJDIR}/.native/bfd && ${MAKE} bfd.h bfdver.h) && \
891.3Snathanw		(cd ${.OBJDIR}/.native/gdb && ${MAKE} init.c version.c)
901.2Snathanw	@touch $@
911.2Snathanw
921.2Snathanwclean: clean.native
931.2Snathanwclean.native:
941.2Snathanw	-rm -r -f .native
95