Home | History | Annotate | Line # | Download | only in gdb
Makefile revision 1.19
      1 #	$NetBSD: Makefile,v 1.19 2011/09/26 02:36:19 christos Exp $
      2 
      3 .include <bsd.own.mk>
      4 
      5 MODULE=		gdb
      6 GNUHOSTDIST=    ${.CURDIR}/../../external/gpl3/gdb/dist
      7 
      8 FIND_ARGS=	\! \( -type d -name sim -prune \)
      9 
     10 CONFIGURE_ARGS=	--target=${MACHINE_GNU_PLATFORM} --disable-nls \
     11 		--program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-,"
     12 
     13 MAKE_ARGS=	MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q}
     14 
     15 ALL_TARGET=	all-gdb
     16 INSTALL_TARGET=	install-gdb
     17 
     18 .include "${.CURDIR}/../Makefile.gnuhost"
     19 
     20 .if ${HAVE_GCC} >= 45
     21 CCADDFLAGS=	--sysroot=${DESTDIR} -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/ -I${.OBJDIR}/.native/gcc/include
     22 .else
     23 CCADDFLAGS=	${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include -L${DESTDIR}/lib -L${DESTDIR}/usr/lib -B${DESTDIR}/usr/lib/
     24 .endif
     25 
     26 NEWCONFIGDIR?=	${.CURDIR}/../..
     27 MKNATIVE?=	${.CURDIR}/mknative-gdb
     28 
     29 # Some configure tests require running a test program, which is not
     30 # possible when cross-building.  Provide configure with "cached"
     31 # values in the environment.
     32 MKNATIVE_CONFIGURE_PRESET= \
     33 	ac_cv_prog_cc_cross=yes \
     34 	ac_cv_func_fork_works=yes \
     35 	ac_cv_func_strcoll_works=yes \
     36 	bash_cv_func_ctype_nonascii=yes \
     37 	bash_cv_func_sigsetjmp=present \
     38 	bash_cv_func_strcoll_broken=no \
     39 	bash_cv_must_reinstall_sighandlers=no
     40 
     41 # Recent versions of Solaris have ncurses, but they hide the lib in an
     42 # odd directory. Prevent configure from finding the ncurses headers,
     43 # Solaris curses is sufficient.
     44 .if ${BUILD_OSTYPE} == "SunOS"
     45 CONFIGURE_ENV+=	ac_cv_header_ncurses_h=no \
     46 		ac_cv_header_ncurses_ncurses_h=no \
     47 		ac_cv_header_ncurses_term_h=no
     48 .endif
     49 
     50 # Disable sim unless it's known to work (configure's default is to
     51 # enable sim if supported).
     52 CONFIGURE_ARGS_SIM=
     53 .if \
     54     ${MACHINE_CPU} != "mips" && \
     55     ${MACHINE_CPU} != "powerpc" && \
     56     ${MACHINE_CPU} != "powerpc64"
     57 CONFIGURE_ARGS_SIM+= --disable-sim
     58 .endif
     59 
     60 native-gdb: .native/.configure_done
     61 	@echo 'Extracting GDB configury for a native toolchain.'
     62 	MAKE=${MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \
     63 		${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM}
     64 
     65 .native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile
     66 	mkdir ${.OBJDIR}/.native 2>/dev/null || true
     67 	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
     68 		(cd ${.OBJDIR}/.native && ${CONFIGURE_ENV:NC*:NLD*} \
     69 			CC_FOR_BUILD=${HOST_CC:Q} \
     70 			CC=${CC:Q}' '${CCADDFLAGS:Q} \
     71 			CXX=${CXX:Q}' '${CCADDFLAGS:Q} \
     72 			CPP=${CPP:Q}' '-isystem' '${DESTDIR}/usr/include \
     73 			CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS=${LDADDFLAGS:Q} \
     74 			MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \
     75 			XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \
     76 			LIBS=-lintl \
     77 			${MKNATIVE_CONFIGURE_PRESET} \
     78 			${HOST_SH} ${GNUHOSTDIST}/configure \
     79 			--prefix=/usr \
     80 			--with-separate-debug-dir=/usr/libdata/debug \
     81 			${CONFIGURE_ARGS_SIM} \
     82 			--build=`${GNUHOSTDIST}/config.guess` \
     83 			--host=${MACHINE_GNU_PLATFORM} \
     84 			--target=${MACHINE_GNU_PLATFORM}) && \
     85 		(cd ${.OBJDIR}/.native && \
     86 			/usr/bin/env ${MKNATIVE_CONFIGURE_PRESET} \
     87 				${MAKE} configure-host) && \
     88 		(cd ${.OBJDIR}/.native/bfd && ${MAKE} bfd.h bfdver.h) && \
     89 		(cd ${.OBJDIR}/.native/gdb && ${MAKE} init.c version.c)
     90 	@touch $@
     91 
     92 clean: clean.native
     93 clean.native:
     94 	-rm -r -f .native
     95