Makefile revision 1.7
1#	$NetBSD: Makefile,v 1.7 2006/11/24 01:48:57 uwe Exp $
2
3.include <bsd.own.mk>
4
5MODULE=		gdb6
6
7FIND_ARGS=	\! \( -type d -name sim -prune \)
8
9CONFIGURE_ARGS=	--target=${MACHINE_GNU_PLATFORM} --disable-nls \
10		--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-,"
11
12MAKE_ARGS=	MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q}
13
14ALL_TARGET=	all-gdb
15INSTALL_TARGET=	install-gdb
16
17.include "${.CURDIR}/../Makefile.gnuhost"
18
19CCADDFLAGS=	-isystem ${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
20
21NEWCONFIGDIR?=	${.CURDIR}/../..
22MKNATIVE?=	${.CURDIR}/mknative-gdb
23
24# Some configure tests require running a test program, which is not
25# possible when cross-building.  Provide configure with "cached"
26# values in the environment.
27MKNATIVE_CONFIGURE_PRESET= \
28	ac_cv_prog_cc_cross=yes \
29	ac_cv_func_fork_works=yes \
30	ac_cv_func_strcoll_works=yes \
31	bash_cv_func_ctype_nonascii=yes \
32	bash_cv_func_sigsetjmp=present \
33	bash_cv_func_strcoll_broken=no \
34	bash_cv_must_reinstall_sighandlers=no
35
36
37native-gdb: .native/.configure_done
38	@echo 'Extracting GDB configury for a native toolchain.'
39	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \
40		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
41
42.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
43	mkdir ${.OBJDIR}/.native 2>/dev/null || true
44	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
45		(cd ${.OBJDIR}/.native && ${CONFIGURE_ENV:NC*:NLD*} \
46			CC_FOR_BUILD=${HOST_CC:Q} \
47			CC=${CC:Q}' '${CCADDFLAGS:Q} \
48			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
49			CPP=${CPP:Q}' '-isystem' '${DESTDIR}/usr/include \
50			CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
51			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
52			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
53			LIBS=-lintl \
54			${MKNATIVE_CONFIGURE_PRESET} \
55			${HOST_SH} ${GNUHOSTDIST}/configure \
56			--prefix=/usr \
57			--with-separate-debug-dir=/usr/libdata/debug \
58			--build=`${GNUHOSTDIST}/config.guess` \
59			--host=${MACHINE_GNU_PLATFORM} \
60			--target=${MACHINE_GNU_PLATFORM}) && \
61		(cd ${.OBJDIR}/.native && \
62			/usr/bin/env ${MKNATIVE_CONFIGURE_PRESET} \
63				${MAKE} configure-host) && \
64		(cd ${.OBJDIR}/.native/bfd && ${MAKE} bfd.h bfdver.h) && \
65		(cd ${.OBJDIR}/.native/gdb && ${MAKE} init.c version.c)
66	@touch $@
67
68clean: clean.native
69clean.native:
70	-rm -r -f .native
71