Makefile revision 1.17
1#	$NetBSD: Makefile,v 1.17 2010/05/08 23:18:44 hans 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=     ${CPPFLAG_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# Recent versions of Solaris have ncurses, but they hide the lib in an
37# odd directory. Prevent configure from finding the ncurses headers,
38# Solaris curses is sufficient.
39.if ${BUILD_OSTYPE} == "SunOS"
40CONFIGURE_ENV+=	ac_cv_header_ncurses_h=no \
41		ac_cv_header_ncurses_ncurses_h=no \
42		ac_cv_header_ncurses_term_h=no
43.endif
44
45# Disable sim unless it's known to work (configure's default is to
46# enable sim if supported).
47CONFIGURE_ARGS_SIM=
48.if \
49    ${MACHINE_CPU} != "mips" && \
50    ${MACHINE_CPU} != "powerpc" && \
51    ${MACHINE_CPU} != "powerpc64"
52CONFIGURE_ARGS_SIM+= --disable-sim
53.endif
54
55native-gdb: .native/.configure_done
56	@echo 'Extracting GDB configury for a native toolchain.'
57	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \
58		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
59
60.native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
61	mkdir ${.OBJDIR}/.native 2>/dev/null || true
62	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
63		(cd ${.OBJDIR}/.native && ${CONFIGURE_ENV:NC*:NLD*} \
64			CC_FOR_BUILD=${HOST_CC:Q} \
65			CC=${CC:Q}' '${CCADDFLAGS:Q} \
66			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
67			CPP=${CPP:Q}' '-isystem' '${DESTDIR}/usr/include \
68			CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
69			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
70			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
71			LIBS=-lintl \
72			${MKNATIVE_CONFIGURE_PRESET} \
73			${HOST_SH} ${GNUHOSTDIST}/configure \
74			--prefix=/usr \
75			--with-separate-debug-dir=/usr/libdata/debug \
76			${CONFIGURE_ARGS_SIM} \
77			--build=`${GNUHOSTDIST}/config.guess` \
78			--host=${MACHINE_GNU_PLATFORM} \
79			--target=${MACHINE_GNU_PLATFORM}) && \
80		(cd ${.OBJDIR}/.native && \
81			/usr/bin/env ${MKNATIVE_CONFIGURE_PRESET} \
82				${MAKE} configure-host) && \
83		(cd ${.OBJDIR}/.native/bfd && ${MAKE} bfd.h bfdver.h) && \
84		(cd ${.OBJDIR}/.native/gdb && ${MAKE} init.c version.c)
85	@touch $@
86
87clean: clean.native
88clean.native:
89	-rm -r -f .native
90