From 3dce4cb5deaa8b6bbe549fea3ffa5af34e4c960b Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Thu, 9 Oct 2014 09:04:01 +0000 Subject: [PATCH] Add CROSS_TOOLCHAIN macro select pre seeded external toolchain configuration files The goal is to provide pre seeded toolchain configurations withing the ports tree to allow the use of an external toolchain in a simple way: make CROSS_TOOLCHAIN=powerpc64-gcc TARGET=powerpc TARGET_ARCH=powerpc64 buildworld This will look for the external toolchain definition in /usr/local/share/mk/powerpc64-gcc.mk While here add the notion of X_COMPILER_TYPE to the external toolchain framework to allow to deal with differences between gcc and clang in regards of cross building --- Makefile.inc1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index c87fa015663c..4e299ae3e597 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -299,6 +299,10 @@ HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT WMAKEENV+= MK_CTF=no .endif +.if defined(CROSS_TOOLCHAIN) +LOCALBASE?= /usr/local +.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" +.endif .if defined(CROSS_TOOLCHAIN_PREFIX) CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} @@ -343,10 +347,14 @@ TARGET_ABI= gnueabihf TARGET_ABI= gnueabi .endif .endif +.if ${X_COMPILER_TYPE} == gcc +XFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib +.else TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 XFLAGS+= -target ${TARGET_TRIPLE} .endif +.endif WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}