diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile index 63ec5358a666..e12a2503145d 100644 --- a/tools/gcc/Makefile +++ b/tools/gcc/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.107 2023/07/31 01:48:37 mrg Exp $ +# $NetBSD: Makefile,v 1.108 2023/08/09 18:57:04 christos Exp $ .include @@ -171,22 +171,7 @@ native-gcc: .native/.configure_done ${MACHINE_GNU_PLATFORM} ${GCC_MACHINE_ARCH} ${DESTDIR} ${TOOLDIR} NATIVE_CONFIGURE_ARGS= ${COMMON_CONFIGURE_ARGS} -MPC= ${NETBSDSRCDIR}/external/lgpl3/mpc -MPFR= ${NETBSDSRCDIR}/external/lgpl3/mpfr -GMP= ${NETBSDSRCDIR}/external/lgpl3/gmp -MPCOBJ!= cd ${MPC}/lib/libmpc && ${PRINTOBJDIR} -MPFROBJ!= cd ${MPFR}/lib/libmpfr && ${PRINTOBJDIR} -GMPOBJ!= cd ${GMP}/lib/libgmp && ${PRINTOBJDIR} - -.include "../../external/lgpl3/gmp/Makefile.arch" - -NATIVE_CONFIGURE_ARGS+= \ - --with-mpc-lib=${MPCOBJ} \ - --with-mpfr-lib=${MPFROBJ} \ - --with-gmp-lib=${GMPOBJ} \ - --with-mpc-include=${MPC}/dist/src \ - --with-mpfr-include=${MPFR}/dist/src \ - --with-gmp-include=${GMP}/lib/libgmp/arch/${GMP_MACHINE_ARCH} +.include "lgpl3.mk" .if ${MACHINE_ARCH} != "vax" NATIVE_CONFIGURE_ARGS+= --enable-tls diff --git a/tools/gcc/lgpl3.mk b/tools/gcc/lgpl3.mk new file mode 100644 index 000000000000..d64051148e33 --- /dev/null +++ b/tools/gcc/lgpl3.mk @@ -0,0 +1,24 @@ +# $NetBSD: lgpl3.mk,v 1.1 2023/08/09 18:57:04 christos Exp $ +# configuration for native build to find lgpl3 libraries +# +.include "../../external/lgpl3/gmp/Makefile.arch" + +MPC= ${NETBSDSRCDIR}/external/lgpl3/mpc +MPFR= ${NETBSDSRCDIR}/external/lgpl3/mpfr +GMP= ${NETBSDSRCDIR}/external/lgpl3/gmp + +MPCOBJ!= cd ${MPC}/lib/libmpc && ${PRINTOBJDIR} +MPFROBJ!= cd ${MPFR}/lib/libmpfr && ${PRINTOBJDIR} +GMPOBJ!= cd ${GMP}/lib/libgmp && ${PRINTOBJDIR} + +MPCINC= ${MPC}/dist/src +MPFRINC= ${MPFR}/dist/src +GMPINC= ${GMP}/lib/libgmp/arch/${GMP_MACHINE_ARCH} + +NATIVE_CONFIGURE_ARGS+= \ + --with-mpc-lib=${MPCOBJ} \ + --with-mpfr-lib=${MPFROBJ} \ + --with-gmp-lib=${GMPOBJ} \ + --with-mpc-include=${MPCINC} \ + --with-mpfr-include=${MPFRINC} \ + --with-gmp-include=${GMPINC} diff --git a/tools/gdb/Makefile b/tools/gdb/Makefile index 1bdbc5095977..fff3ccb0bbc3 100644 --- a/tools/gdb/Makefile +++ b/tools/gdb/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.42 2023/07/31 17:09:59 christos Exp $ +# $NetBSD: Makefile,v 1.43 2023/08/09 18:57:04 christos Exp $ .include @@ -25,6 +25,7 @@ BUILD_MAKE=${TOOL_GMAKE} BINENV= /usr/bin/env -i +.include "${.CURDIR}/../gcc/lgpl3.mk" MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*:Nam_cv_func_iconv*} \ CC_FOR_BUILD=${HOST_CC:Q} \ @@ -33,7 +34,8 @@ MKNATIVE_ENV= ${BINENV} ${CONFIGURE_ENV:NC*:NLD*:Nam_cv_func_iconv*} \ CC=${CC:Q}' '${CCADDFLAGS:Q} \ CXX=${CXX:Q}' '${CCADDFLAGS:Q}' '${CXXADDFLAGS:Q} \ CPP=${CPP:Q}' '-I${DESTDIR}/usr/include \ - CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \ + CFLAGS= CPPFLAGS=-I${.OBJDIR}/.native/include \ + CXXFLAGS= LDFLAGS=-L${GMPOBJ} \ AS=${AS:Q} AWK=${TOOL_AWK:Q} LD=${LD:Q} \ MSGFMT=${TOOLDIR}/bin/${_TOOL_PREFIX}msgfmt \ NM=${NM:Q} OBJDUMP=${OBJDUMP:Q} \ @@ -94,6 +96,7 @@ CONFIGURE_ARGS_GDBSERVER= CONFIGURE_ARGS_GDBSERVER+= --enable-gdbserver .endif + native-gdb: .native/.configure_done @echo 'Extracting GDB configury for a native toolchain.' MAKE=${BUILD_MAKE:Q} ${HOST_SH} ${MKNATIVE} gdb \ @@ -101,13 +104,14 @@ native-gdb: .native/.configure_done ${GDB_MACHINE_ARCH} .native/.configure_done: ${_GNU_CFGSRC} ${.CURDIR}/Makefile - mkdir ${.OBJDIR}/.native 2>/dev/null || true + mkdir -p ${.OBJDIR}/.native/include + # we need to make a copy because ${GMPINC} has a config.h + cp -p ${GMPINC}/gmp.h ${.OBJDIR}/.native/include PATH=${TOOLDIR}/bin:$$PATH; export PATH; \ (cd ${.OBJDIR}/.native && \ ${MKNATIVE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure \ --prefix=/usr \ --with-separate-debug-dir=/usr/libdata/debug \ - --with-libgmp-prefix=${TOOLDIR} \ ${CONFIGURE_ARGS_SIM} \ ${CONFIGURE_ARGS_GDBSERVER} \ --build=`${GNUHOSTDIST}/config.guess` \