Makefile revision 1.13
1#	$NetBSD: Makefile,v 1.13 2009/12/14 14:13:16 christos 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
14.NOTPARALLEL:	# XXX otherwise fails with itable.c / interp.c build
15ALL_TARGET=	all-gdb
16INSTALL_TARGET=	install-gdb
17
18.include "${.CURDIR}/../Makefile.gnuhost"
19
20CCADDFLAGS=     ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
21
22NEWCONFIGDIR?=	${.CURDIR}/../..
23MKNATIVE?=	${.CURDIR}/mknative-gdb
24
25# Some configure tests require running a test program, which is not
26# possible when cross-building.  Provide configure with "cached"
27# values in the environment.
28MKNATIVE_CONFIGURE_PRESET= \
29	ac_cv_prog_cc_cross=yes \
30	ac_cv_func_fork_works=yes \
31	ac_cv_func_strcoll_works=yes \
32	bash_cv_func_ctype_nonascii=yes \
33	bash_cv_func_sigsetjmp=present \
34	bash_cv_func_strcoll_broken=no \
35	bash_cv_must_reinstall_sighandlers=no
36
37# Disable sim unless it's known to work (configure's default is to
38# enable sim if supported).
39CONFIGURE_ARGS_SIM=
40.if \
41    ${MACHINE_CPU} != "mips" && \
42    ${MACHINE_CPU} != "powerpc" && \
43    ${MACHINE_CPU} != "powerpc64"
44CONFIGURE_ARGS_SIM+= --disable-sim
45.endif
46
47native-gdb: .native/.configure_done
48	@echo 'Extracting GDB configury for a native toolchain.'
49	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \
50		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
51
52.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
53	mkdir ${.OBJDIR}/.native 2>/dev/null || true
54	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
55		(cd ${.OBJDIR}/.native && ${CONFIGURE_ENV:NC*:NLD*} \
56			CC_FOR_BUILD=${HOST_CC:Q} \
57			CC=${CC:Q}' '${CCADDFLAGS:Q} \
58			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
59			CPP=${CPP:Q}' '-isystem' '${DESTDIR}/usr/include \
60			CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
61			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
62			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
63			LIBS=-lintl \
64			${MKNATIVE_CONFIGURE_PRESET} \
65			${HOST_SH} ${GNUHOSTDIST}/configure \
66			--prefix=/usr \
67			--with-separate-debug-dir=/usr/libdata/debug \
68			${CONFIGURE_ARGS_SIM} \
69			--build=`${GNUHOSTDIST}/config.guess` \
70			--host=${MACHINE_GNU_PLATFORM} \
71			--target=${MACHINE_GNU_PLATFORM}) && \
72		(cd ${.OBJDIR}/.native && \
73			/usr/bin/env ${MKNATIVE_CONFIGURE_PRESET} \
74				${MAKE} configure-host) && \
75		(cd ${.OBJDIR}/.native/bfd && ${MAKE} bfd.h bfdver.h) && \
76		(cd ${.OBJDIR}/.native/gdb && ${MAKE} init.c version.c)
77	@touch $@
78
79clean: clean.native
80clean.native:
81	-rm -r -f .native
82