Makefile revision 1.18
11.18Snjoly#	$NetBSD: Makefile,v 1.18 2010/12/24 13:12:09 njoly 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.18SnjolyCCADDFLAGS=     ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include -B${DESTDIR}/usr/lib/
201.18SnjolyLDADDFLAGS=	-L${DESTDIR}/lib -L${DESTDIR}/usr/lib -Wl,-rpath-link,${DESTDIR}/usr/lib
211.2Snathanw
221.2SnathanwNEWCONFIGDIR?=	${.CURDIR}/../..
231.2SnathanwMKNATIVE?=	${.CURDIR}/mknative-gdb
241.2Snathanw
251.7Suwe# Some configure tests require running a test program, which is not
261.7Suwe# possible when cross-building.  Provide configure with "cached"
271.7Suwe# values in the environment.
281.7SuweMKNATIVE_CONFIGURE_PRESET= \
291.7Suwe	ac_cv_prog_cc_cross=yes \
301.7Suwe	ac_cv_func_fork_works=yes \
311.7Suwe	ac_cv_func_strcoll_works=yes \
321.7Suwe	bash_cv_func_ctype_nonascii=yes \
331.7Suwe	bash_cv_func_sigsetjmp=present \
341.7Suwe	bash_cv_func_strcoll_broken=no \
351.7Suwe	bash_cv_must_reinstall_sighandlers=no
361.7Suwe
371.17Shans# Recent versions of Solaris have ncurses, but they hide the lib in an
381.17Shans# odd directory. Prevent configure from finding the ncurses headers,
391.17Shans# Solaris curses is sufficient.
401.17Shans.if ${BUILD_OSTYPE} == "SunOS"
411.17ShansCONFIGURE_ENV+=	ac_cv_header_ncurses_h=no \
421.17Shans		ac_cv_header_ncurses_ncurses_h=no \
431.17Shans		ac_cv_header_ncurses_term_h=no
441.17Shans.endif
451.17Shans
461.8Suwe# Disable sim unless it's known to work (configure's default is to
471.8Suwe# enable sim if supported).
481.8SuweCONFIGURE_ARGS_SIM=
491.8Suwe.if \
501.11Smrg    ${MACHINE_CPU} != "mips" && \
511.9Sskrll    ${MACHINE_CPU} != "powerpc" && \
521.8Suwe    ${MACHINE_CPU} != "powerpc64"
531.8SuweCONFIGURE_ARGS_SIM+= --disable-sim
541.8Suwe.endif
551.8Suwe
561.2Snathanwnative-gdb: .native/.configure_done
571.2Snathanw	@echo 'Extracting GDB configury for a native toolchain.'
581.2Snathanw	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \
591.2Snathanw		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
601.2Snathanw
611.2Snathanw.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
621.3Snathanw	mkdir ${.OBJDIR}/.native 2>/dev/null || true
631.2Snathanw	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
641.3Snathanw		(cd ${.OBJDIR}/.native && ${CONFIGURE_ENV:NC*:NLD*} \
651.2Snathanw			CC_FOR_BUILD=${HOST_CC:Q} \
661.2Snathanw			CC=${CC:Q}' '${CCADDFLAGS:Q} \
671.2Snathanw			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
681.6Suwe			CPP=${CPP:Q}' '-isystem' '${DESTDIR}/usr/include \
691.18Snjoly			CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS=${LDADDFLAGS:Q} \
701.2Snathanw			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
711.2Snathanw			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
721.2Snathanw			LIBS=-lintl \
731.7Suwe			${MKNATIVE_CONFIGURE_PRESET} \
741.2Snathanw			${HOST_SH} ${GNUHOSTDIST}/configure \
751.4Snathanw			--prefix=/usr \
761.5Slukem			--with-separate-debug-dir=/usr/libdata/debug \
771.8Suwe			${CONFIGURE_ARGS_SIM} \
781.2Snathanw			--build=`${GNUHOSTDIST}/config.guess` \
791.2Snathanw			--host=${MACHINE_GNU_PLATFORM} \
801.2Snathanw			--target=${MACHINE_GNU_PLATFORM}) && \
811.7Suwe		(cd ${.OBJDIR}/.native && \
821.7Suwe			/usr/bin/env ${MKNATIVE_CONFIGURE_PRESET} \
831.7Suwe				${MAKE} configure-host) && \
841.3Snathanw		(cd ${.OBJDIR}/.native/bfd && ${MAKE} bfd.h bfdver.h) && \
851.3Snathanw		(cd ${.OBJDIR}/.native/gdb && ${MAKE} init.c version.c)
861.2Snathanw	@touch $@
871.2Snathanw
881.2Snathanwclean: clean.native
891.2Snathanwclean.native:
901.2Snathanw	-rm -r -f .native
91