Makefile revision 1.8
11.8Suwe#	$NetBSD: Makefile,v 1.8 2006/11/24 02:09:01 uwe Exp $
21.1Scl
31.1Scl.include <bsd.own.mk>
41.1Scl
51.2SnathanwMODULE=		gdb6
61.1Scl
71.1SclFIND_ARGS=	\! \( -type d -name sim -prune \)
81.1Scl
91.1SclCONFIGURE_ARGS=	--target=${MACHINE_GNU_PLATFORM} --disable-nls \
101.1Scl		--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-,"
111.1Scl
121.1SclMAKE_ARGS=	MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q}
131.1Scl
141.1SclALL_TARGET=	all-gdb
151.1SclINSTALL_TARGET=	install-gdb
161.1Scl
171.1Scl.include "${.CURDIR}/../Makefile.gnuhost"
181.1Scl
191.6SuweCCADDFLAGS=	-isystem ${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
201.2Snathanw
211.2SnathanwNEWCONFIGDIR?=	${.CURDIR}/../..
221.2SnathanwMKNATIVE?=	${.CURDIR}/mknative-gdb
231.2Snathanw
241.7Suwe# Some configure tests require running a test program, which is not
251.7Suwe# possible when cross-building.  Provide configure with "cached"
261.7Suwe# values in the environment.
271.7SuweMKNATIVE_CONFIGURE_PRESET= \
281.7Suwe	ac_cv_prog_cc_cross=yes \
291.7Suwe	ac_cv_func_fork_works=yes \
301.7Suwe	ac_cv_func_strcoll_works=yes \
311.7Suwe	bash_cv_func_ctype_nonascii=yes \
321.7Suwe	bash_cv_func_sigsetjmp=present \
331.7Suwe	bash_cv_func_strcoll_broken=no \
341.7Suwe	bash_cv_must_reinstall_sighandlers=no
351.7Suwe
361.8Suwe# Disable sim unless it's known to work (configure's default is to
371.8Suwe# enable sim if supported).
381.8SuweCONFIGURE_ARGS_SIM=
391.8Suwe.if \
401.8Suwe    ${MACHINE_CPU} != "mips" || \
411.8Suwe    ${MACHINE_CPU} != "powerpc" || \
421.8Suwe    ${MACHINE_CPU} != "powerpc64"
431.8SuweCONFIGURE_ARGS_SIM+= --disable-sim
441.8Suwe.endif
451.8Suwe
461.7Suwe
471.2Snathanwnative-gdb: .native/.configure_done
481.2Snathanw	@echo 'Extracting GDB configury for a native toolchain.'
491.2Snathanw	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \
501.2Snathanw		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
511.2Snathanw
521.2Snathanw.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
531.3Snathanw	mkdir ${.OBJDIR}/.native 2>/dev/null || true
541.2Snathanw	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
551.3Snathanw		(cd ${.OBJDIR}/.native && ${CONFIGURE_ENV:NC*:NLD*} \
561.2Snathanw			CC_FOR_BUILD=${HOST_CC:Q} \
571.2Snathanw			CC=${CC:Q}' '${CCADDFLAGS:Q} \
581.2Snathanw			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
591.6Suwe			CPP=${CPP:Q}' '-isystem' '${DESTDIR}/usr/include \
601.2Snathanw			CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
611.2Snathanw			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
621.2Snathanw			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
631.2Snathanw			LIBS=-lintl \
641.7Suwe			${MKNATIVE_CONFIGURE_PRESET} \
651.2Snathanw			${HOST_SH} ${GNUHOSTDIST}/configure \
661.4Snathanw			--prefix=/usr \
671.5Slukem			--with-separate-debug-dir=/usr/libdata/debug \
681.8Suwe			${CONFIGURE_ARGS_SIM} \
691.2Snathanw			--build=`${GNUHOSTDIST}/config.guess` \
701.2Snathanw			--host=${MACHINE_GNU_PLATFORM} \
711.2Snathanw			--target=${MACHINE_GNU_PLATFORM}) && \
721.7Suwe		(cd ${.OBJDIR}/.native && \
731.7Suwe			/usr/bin/env ${MKNATIVE_CONFIGURE_PRESET} \
741.7Suwe				${MAKE} configure-host) && \
751.3Snathanw		(cd ${.OBJDIR}/.native/bfd && ${MAKE} bfd.h bfdver.h) && \
761.3Snathanw		(cd ${.OBJDIR}/.native/gdb && ${MAKE} init.c version.c)
771.2Snathanw	@touch $@
781.2Snathanw
791.2Snathanwclean: clean.native
801.2Snathanwclean.native:
811.2Snathanw	-rm -r -f .native
82