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