1 1.46 christos # $NetBSD: Makefile,v 1.46 2023/08/15 19:56:07 christos Exp $ 2 1.1 cl 3 1.36 christos .include <bsd.hostinit.mk> 4 1.1 cl 5 1.19 christos MODULE= gdb 6 1.30 mrg GDBDIR= ${.CURDIR}/../../external/gpl3/${EXTERNAL_GDB_SUBDIR} 7 1.30 mrg GNUHOSTDIST= ${GDBDIR}/dist 8 1.1 cl 9 1.1 cl FIND_ARGS= \! \( -type d -name sim -prune \) 10 1.1 cl 11 1.1 cl CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} --disable-nls \ 12 1.37 christos --program-transform-name="s,^,${MACHINE_GNU_PLATFORM}-," \ 13 1.45 christos --without-mpfr --with-libgmp-prefix=${TOOLDIR} 14 1.1 cl 15 1.1 cl MAKE_ARGS= MACHINE= MAKEINFO=${TOOL_MAKEINFO:Q} 16 1.1 cl 17 1.1 cl ALL_TARGET= all-gdb 18 1.1 cl INSTALL_TARGET= install-gdb 19 1.1 cl 20 1.30 mrg .include "${GDBDIR}/Makefile.gdb_arch" 21 1.30 mrg #GDB_MACHINE_ARCH= ${MACHINE_ARCH:C/e?armv[4-7]h?f?/arm/} 22 1.30 mrg 23 1.22 bouyer .include "${.CURDIR}/../Makefile.gmakehost" 24 1.32 christos BUILD_MAKE=${TOOL_GMAKE} 25 1.32 christos 26 1.32 christos BINENV= /usr/bin/env -i 27 1.32 christos 28 1.43 christos .include "${.CURDIR}/../gcc/lgpl3.mk" 29 1.32 christos 30 1.34 christos MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*:Nam_cv_func_iconv*} \ 31 1.32 christos CC_FOR_BUILD=${HOST_CC:Q} \ 32 1.33 christos CXX_FOR_BUILD=${HOST_CXX:Q} \ 33 1.33 christos CFLAGS_FOR_BUILD="-I${TOOLDIR}/include" \ 34 1.32 christos CC=${CC:Q}' '${CCADDFLAGS:Q} \ 35 1.33 christos CXX=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \ 36 1.33 christos CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \ 37 1.43 christos CFLAGS= CPPFLAGS=-I${.OBJDIR}/.native/include \ 38 1.43 christos CXXFLAGS= LDFLAGS=-L${GMPOBJ} \ 39 1.33 christos AS=${AS:Q} AWK=${TOOL_AWK:Q} LD=${LD:Q} \ 40 1.32 christos MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \ 41 1.33 christos NM=${NM:Q} OBJDUMP=${OBJDUMP:Q} \ 42 1.32 christos XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \ 43 1.32 christos LIBS=-lintl \ 44 1.32 christos ${MKNATIVE_CONFIGURE_PRESET} 45 1.32 christos 46 1.32 christos MKENV_BUILD_MAKE=${MKNATIVE_ENV} ${BUILD_MAKE} 47 1.1 cl 48 1.45 christos CCADDFLAGS+= --sysroot=${DESTDIR} -B${DESTDIR}/usr/lib/ -I${.OBJDIR}/.native/gcc/include 49 1.29 christos LDADDFLAGS+= -L${DESTDIR}/lib -L${DESTDIR}/usr/lib 50 1.28 christos CXXADDFLAGS+= -D__STDC_FORMAT_MACROS 51 1.28 christos CXXADDFLAGS+= -D__STDC_LIMIT_MACROS 52 1.28 christos CXXADDFLAGS+= -D__STDC_CONSTANT_MACROS 53 1.29 christos HOST_CXXFLAGS+= ${CXXADDFLAGS} 54 1.46 christos # Since we are using gmake -e the environment overwrites CPPFLAGS 55 1.46 christos # so we overwrite it again here! (see Makefile.gnuhost) 56 1.46 christos HOST_CPPFLAGS+= -I${TOOLDIR}/include 57 1.2 nathanw 58 1.2 nathanw NEWCONFIGDIR?= ${.CURDIR}/../.. 59 1.2 nathanw MKNATIVE?= ${.CURDIR}/mknative-gdb 60 1.2 nathanw 61 1.7 uwe # Some configure tests require running a test program, which is not 62 1.7 uwe # possible when cross-building. Provide configure with "cached" 63 1.7 uwe # values in the environment. 64 1.7 uwe MKNATIVE_CONFIGURE_PRESET= \ 65 1.7 uwe ac_cv_prog_cc_cross=yes \ 66 1.7 uwe ac_cv_func_fork_works=yes \ 67 1.41 skrll ac_cv_func_sigprocmask=yes \ 68 1.7 uwe ac_cv_func_strcoll_works=yes \ 69 1.38 christos ac_cv_func_XML_StopParser=yes \ 70 1.38 christos ac_cv_libexpat=yes \ 71 1.7 uwe bash_cv_func_ctype_nonascii=yes \ 72 1.7 uwe bash_cv_func_sigsetjmp=present \ 73 1.7 uwe bash_cv_func_strcoll_broken=no \ 74 1.7 uwe bash_cv_must_reinstall_sighandlers=no 75 1.7 uwe 76 1.34 christos CONFIGURE_ENV+= am_cv_func_iconv=no 77 1.31 jmcneill 78 1.17 hans # Recent versions of Solaris have ncurses, but they hide the lib in an 79 1.17 hans # odd directory. Prevent configure from finding the ncurses headers, 80 1.17 hans # Solaris curses is sufficient. 81 1.17 hans .if ${BUILD_OSTYPE} == "SunOS" 82 1.17 hans CONFIGURE_ENV+= ac_cv_header_ncurses_h=no \ 83 1.17 hans ac_cv_header_ncurses_ncurses_h=no \ 84 1.17 hans ac_cv_header_ncurses_term_h=no 85 1.17 hans .endif 86 1.17 hans 87 1.8 uwe # Disable sim unless it's known to work (configure's default is to 88 1.8 uwe # enable sim if supported). 89 1.8 uwe CONFIGURE_ARGS_SIM= 90 1.8 uwe .if \ 91 1.9 skrll ${MACHINE_CPU} != "powerpc" && \ 92 1.8 uwe ${MACHINE_CPU} != "powerpc64" 93 1.8 uwe CONFIGURE_ARGS_SIM+= --disable-sim 94 1.8 uwe .endif 95 1.8 uwe 96 1.39 christos CONFIGURE_ARGS_GDBSERVER= 97 1.39 christos .if \ 98 1.39 christos ${MACHINE_CPU} == "x86_64" 99 1.39 christos CONFIGURE_ARGS_GDBSERVER+= --enable-gdbserver 100 1.39 christos .endif 101 1.39 christos 102 1.43 christos 103 1.2 nathanw native-gdb: .native/.configure_done 104 1.2 nathanw @echo 'Extracting GDB configury for a native toolchain.' 105 1.32 christos MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \ 106 1.30 mrg ${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} \ 107 1.30 mrg ${GDB_MACHINE_ARCH} 108 1.2 nathanw 109 1.2 nathanw .native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile 110 1.45 christos mkdir -p ${.OBJDIR}/.native/include 111 1.45 christos # we need to make a copy because ${GMPINC} has a config.h 112 1.45 christos cp -p ${GMPINC}/gmp.h ${.OBJDIR}/.native/include 113 1.2 nathanw PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 114 1.32 christos (cd ${.OBJDIR}/.native && \ 115 1.32 christos ${MKNATIVE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure \ 116 1.4 nathanw --prefix=/usr \ 117 1.5 lukem --with-separate-debug-dir=/usr/libdata/debug \ 118 1.8 uwe ${CONFIGURE_ARGS_SIM} \ 119 1.39 christos ${CONFIGURE_ARGS_GDBSERVER} \ 120 1.2 nathanw --build=`${GNUHOSTDIST}/config.guess` \ 121 1.2 nathanw --host=${MACHINE_GNU_PLATFORM} \ 122 1.32 christos --target=${MACHINE_GNU_PLATFORM}) 123 1.32 christos PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 124 1.7 uwe (cd ${.OBJDIR}/.native && \ 125 1.32 christos ${MKENV_BUILD_MAKE} configure-host) && \ 126 1.32 christos (cd ${.OBJDIR}/.native/bfd && \ 127 1.32 christos ${MKENV_BUILD_MAKE} bfd.h bfdver.h) && \ 128 1.32 christos (cd ${.OBJDIR}/.native/gdb && \ 129 1.42 christos ${MKENV_BUILD_MAKE} xml-builtin.c init.c version.c) && \ 130 1.42 christos (cd ${.OBJDIR}/.native/libbacktrace && \ 131 1.42 christos ${MKENV_BUILD_MAKE} backtrace-supported.h) && \ 132 1.40 christos (if [ -d ${.OBJDIR}/.native/gdbserver ]; then \ 133 1.40 christos cd ${.OBJDIR}/.native/gdbserver && \ 134 1.40 christos ${MKENV_BUILD_MAKE} version-generated.cc; fi) 135 1.2 nathanw @touch $@ 136 1.2 nathanw 137 1.2 nathanw clean: clean.native 138 1.2 nathanw clean.native: 139 1.2 nathanw -rm -r -f .native 140