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
This commit is contained in:
Baptiste Daroussin 2014-10-09 09:04:01 +00:00
parent eba15cf463
commit 3dce4cb5de

View File

@ -299,6 +299,10 @@ HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
WMAKEENV+= MK_CTF=no WMAKEENV+= MK_CTF=no
.endif .endif
.if defined(CROSS_TOOLCHAIN)
LOCALBASE?= /usr/local
.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
.endif
.if defined(CROSS_TOOLCHAIN_PREFIX) .if defined(CROSS_TOOLCHAIN_PREFIX)
CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
@ -343,10 +347,14 @@ TARGET_ABI= gnueabihf
TARGET_ABI= gnueabi TARGET_ABI= gnueabi
.endif .endif
.endif .endif
.if ${X_COMPILER_TYPE} == gcc
XFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
.else
TARGET_ABI?= unknown TARGET_ABI?= unknown
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
XFLAGS+= -target ${TARGET_TRIPLE} XFLAGS+= -target ${TARGET_TRIPLE}
.endif .endif
.endif
WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}