1 1.56 rin # $NetBSD: Makefile,v 1.56 2024/08/31 10:43:43 rin 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.50 christos --with-zstd=no \ 14 1.50 christos --with-mpfr=${TOOLDIR} \ 15 1.50 christos --with-mpc=${TOOLDIR} \ 16 1.50 christos --with-gmp=${TOOLDIR} 17 1.1 cl 18 1.47 rin .if ${MACHINE} == "ia64" 19 1.47 rin CONFIGURE_ARGS+=--enable-obsolete 20 1.47 rin .endif 21 1.47 rin 22 1.51 rin # XXX 23 1.51 rin # Unfortunately, our in-tree makeinfo(1) (latest GPLv2 release) is 24 1.51 rin # too old to generate *.info. Use external tool from pkgsrc. 25 1.51 rin EXTERN_MAKEINFO?= /usr/pkg/bin/makeinfo 26 1.51 rin MAKEINFOFLAGS?= --no-split 27 1.51 rin 28 1.51 rin MAKE_ARGS= MACHINE= 29 1.1 cl 30 1.1 cl ALL_TARGET= all-gdb 31 1.1 cl INSTALL_TARGET= install-gdb 32 1.1 cl 33 1.30 mrg .include "${GDBDIR}/Makefile.gdb_arch" 34 1.30 mrg #GDB_MACHINE_ARCH= ${MACHINE_ARCH:C/e?armv[4-7]h?f?/arm/} 35 1.30 mrg 36 1.22 bouyer .include "${.CURDIR}/../Makefile.gmakehost" 37 1.32 christos BUILD_MAKE=${TOOL_GMAKE} 38 1.32 christos 39 1.32 christos BINENV= /usr/bin/env -i 40 1.32 christos 41 1.43 christos .include "${.CURDIR}/../gcc/lgpl3.mk" 42 1.32 christos 43 1.34 christos MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*:Nam_cv_func_iconv*} \ 44 1.32 christos CC_FOR_BUILD=${HOST_CC:Q} \ 45 1.33 christos CXX_FOR_BUILD=${HOST_CXX:Q} \ 46 1.33 christos CFLAGS_FOR_BUILD="-I${TOOLDIR}/include" \ 47 1.32 christos CC=${CC:Q}' '${CCADDFLAGS:Q} \ 48 1.33 christos CXX=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \ 49 1.33 christos CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \ 50 1.48 rin CFLAGS= CPPFLAGS= \ 51 1.52 christos CXXFLAGS= LDFLAGS='-L${GMPOBJ} -L${MPFROBJ} -L${MPCOBJ}'\ 52 1.33 christos AS=${AS:Q} AWK=${TOOL_AWK:Q} LD=${LD:Q} \ 53 1.32 christos MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \ 54 1.33 christos NM=${NM:Q} OBJDUMP=${OBJDUMP:Q} \ 55 1.32 christos XGETTEXT=${TOOLDIR}/bin/${_TOOL_PREFIX}xgettext \ 56 1.32 christos LIBS=-lintl \ 57 1.51 rin MAKEINFO=${EXTERN_MAKEINFO} \ 58 1.51 rin MAKEINFOFLAGS=${MAKEINFOFLAGS} \ 59 1.32 christos ${MKNATIVE_CONFIGURE_PRESET} 60 1.32 christos 61 1.32 christos MKENV_BUILD_MAKE=${MKNATIVE_ENV} ${BUILD_MAKE} 62 1.1 cl 63 1.48 rin CCADDFLAGS+= --sysroot=${DESTDIR} -B${DESTDIR}/usr/lib/ \ 64 1.48 rin -I${.OBJDIR}/.native/include \ 65 1.48 rin -I${.OBJDIR}/.native/gcc/include 66 1.29 christos LDADDFLAGS+= -L${DESTDIR}/lib -L${DESTDIR}/usr/lib 67 1.28 christos CXXADDFLAGS+= -D__STDC_FORMAT_MACROS 68 1.28 christos CXXADDFLAGS+= -D__STDC_LIMIT_MACROS 69 1.28 christos CXXADDFLAGS+= -D__STDC_CONSTANT_MACROS 70 1.29 christos HOST_CXXFLAGS+= ${CXXADDFLAGS} 71 1.46 christos # Since we are using gmake -e the environment overwrites CPPFLAGS 72 1.46 christos # so we overwrite it again here! (see Makefile.gnuhost) 73 1.46 christos HOST_CPPFLAGS+= -I${TOOLDIR}/include 74 1.2 nathanw 75 1.2 nathanw NEWCONFIGDIR?= ${.CURDIR}/../.. 76 1.2 nathanw MKNATIVE?= ${.CURDIR}/mknative-gdb 77 1.2 nathanw 78 1.7 uwe # Some configure tests require running a test program, which is not 79 1.7 uwe # possible when cross-building. Provide configure with "cached" 80 1.7 uwe # values in the environment. 81 1.7 uwe MKNATIVE_CONFIGURE_PRESET= \ 82 1.7 uwe ac_cv_prog_cc_cross=yes \ 83 1.7 uwe ac_cv_func_fork_works=yes \ 84 1.41 skrll ac_cv_func_sigprocmask=yes \ 85 1.7 uwe ac_cv_func_strcoll_works=yes \ 86 1.38 christos ac_cv_func_XML_StopParser=yes \ 87 1.38 christos ac_cv_libexpat=yes \ 88 1.7 uwe bash_cv_func_ctype_nonascii=yes \ 89 1.7 uwe bash_cv_func_sigsetjmp=present \ 90 1.7 uwe bash_cv_func_strcoll_broken=no \ 91 1.49 rin bash_cv_must_reinstall_sighandlers=no \ 92 1.49 rin gl_cv_func_rename_slash_dst_works=yes \ 93 1.49 rin gl_cv_func_rename_slash_src_works=yes \ 94 1.49 rin gl_cv_func_rename_link_works=yes \ 95 1.49 rin gl_cv_func_rename_dest_works=yes 96 1.7 uwe 97 1.34 christos CONFIGURE_ENV+= am_cv_func_iconv=no 98 1.31 jmcneill 99 1.17 hans # Recent versions of Solaris have ncurses, but they hide the lib in an 100 1.17 hans # odd directory. Prevent configure from finding the ncurses headers, 101 1.17 hans # Solaris curses is sufficient. 102 1.17 hans .if ${BUILD_OSTYPE} == "SunOS" 103 1.17 hans CONFIGURE_ENV+= ac_cv_header_ncurses_h=no \ 104 1.17 hans ac_cv_header_ncurses_ncurses_h=no \ 105 1.17 hans ac_cv_header_ncurses_term_h=no 106 1.17 hans .endif 107 1.17 hans 108 1.8 uwe # Disable sim unless it's known to work (configure's default is to 109 1.8 uwe # enable sim if supported). 110 1.8 uwe CONFIGURE_ARGS_SIM= 111 1.54 christos #.if \ 112 1.54 christos # ${MACHINE_CPU} != "powerpc" && \ 113 1.54 christos # ${MACHINE_CPU} != "powerpc64" 114 1.8 uwe CONFIGURE_ARGS_SIM+= --disable-sim 115 1.54 christos #.endif 116 1.8 uwe 117 1.39 christos CONFIGURE_ARGS_GDBSERVER= 118 1.55 rin .if ${MKGDBSERVER} != "no" 119 1.39 christos CONFIGURE_ARGS_GDBSERVER+= --enable-gdbserver 120 1.39 christos .endif 121 1.39 christos 122 1.43 christos 123 1.2 nathanw native-gdb: .native/.configure_done 124 1.2 nathanw @echo 'Extracting GDB configury for a native toolchain.' 125 1.32 christos MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \ 126 1.30 mrg ${.OBJDIR}/.native ${NEWCONFIGDIR} ${MACHINE_GNU_PLATFORM} \ 127 1.30 mrg ${GDB_MACHINE_ARCH} 128 1.2 nathanw 129 1.2 nathanw .native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile 130 1.45 christos mkdir -p ${.OBJDIR}/.native/include 131 1.45 christos # we need to make a copy because ${GMPINC} has a config.h 132 1.45 christos cp -p ${GMPINC}/gmp.h ${.OBJDIR}/.native/include 133 1.53 christos # copy the rest because using --with-foo=${TOOLDIR} breaks with 134 1.53 christos # static linking because it picks the tools version of the libraries 135 1.53 christos cp -p ${MPFRINC}/mpfr.h ${.OBJDIR}/.native/include 136 1.53 christos cp -p ${MPFRINC}/mpf2mpfr.h ${.OBJDIR}/.native/include 137 1.53 christos cp -p ${MPCINC}/mpc.h ${.OBJDIR}/.native/include 138 1.2 nathanw PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 139 1.32 christos (cd ${.OBJDIR}/.native && \ 140 1.32 christos ${MKNATIVE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure \ 141 1.4 nathanw --prefix=/usr \ 142 1.5 lukem --with-separate-debug-dir=/usr/libdata/debug \ 143 1.50 christos --with-zstd=no \ 144 1.8 uwe ${CONFIGURE_ARGS_SIM} \ 145 1.39 christos ${CONFIGURE_ARGS_GDBSERVER} \ 146 1.2 nathanw --build=`${GNUHOSTDIST}/config.guess` \ 147 1.2 nathanw --host=${MACHINE_GNU_PLATFORM} \ 148 1.32 christos --target=${MACHINE_GNU_PLATFORM}) 149 1.32 christos PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ 150 1.7 uwe (cd ${.OBJDIR}/.native && \ 151 1.32 christos ${MKENV_BUILD_MAKE} configure-host) && \ 152 1.32 christos (cd ${.OBJDIR}/.native/bfd && \ 153 1.32 christos ${MKENV_BUILD_MAKE} bfd.h bfdver.h) && \ 154 1.32 christos (cd ${.OBJDIR}/.native/gdb && \ 155 1.42 christos ${MKENV_BUILD_MAKE} xml-builtin.c init.c version.c) && \ 156 1.42 christos (cd ${.OBJDIR}/.native/libbacktrace && \ 157 1.42 christos ${MKENV_BUILD_MAKE} backtrace-supported.h) && \ 158 1.40 christos (if [ -d ${.OBJDIR}/.native/gdbserver ]; then \ 159 1.40 christos cd ${.OBJDIR}/.native/gdbserver && \ 160 1.51 rin ${MKENV_BUILD_MAKE} version-generated.cc; fi) && \ 161 1.51 rin (cd ${.OBJDIR}/.native/gdb/doc && \ 162 1.56 rin ${MKENV_BUILD_MAKE} NetBSD_DISABLED_info) 163 1.2 nathanw @touch $@ 164 1.2 nathanw 165 1.2 nathanw clean: clean.native 166 1.2 nathanw clean.native: 167 1.2 nathanw -rm -r -f .native 168