git: ecf01a8ebc44 - main - Makefile: Support universe-toolchain on non-FreeBSD
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 23 Aug 2023 17:01:27 UTC
The branch main has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=ecf01a8ebc443d1b33c7b61a22f28145f41c25a9
commit ecf01a8ebc443d1b33c7b61a22f28145f41c25a9
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-08-23 17:00:16 +0000
Commit: Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-08-23 17:00:16 +0000
Makefile: Support universe-toolchain on non-FreeBSD
We currently pass MACHINE and MACHINE_ARCH as TARGET and TARGET_ARCH
respectively for universe-toolchain, but on non-FreeBSD these may not
have values that we understand (e.g. on Linux it will be x86_64 rather
than amd64) for TARGET/TARGET_ARCH (note that we do support them for
MACHINE/MACHINE_ARCH). Since the choice is a bit arbitrary and merely
determines what LLVM's default triple will be, use amd64 on non-FreeBSD
as a known-good default.
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D41545
---
Makefile | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 4b8d7c850bd6..b36e27e7f294 100644
--- a/Makefile
+++ b/Makefile
@@ -582,6 +582,17 @@ MAKE_PARAMS_${arch}?= CROSS_TOOLCHAIN=${TOOLCHAIN_${arch}}
UNIVERSE_TARGET?= buildworld
KERNSRCDIR?= ${.CURDIR}/sys
+.if ${.MAKE.OS} == "FreeBSD"
+UNIVERSE_TOOLCHAIN_TARGET?= ${MACHINE}
+UNIVERSE_TOOLCHAIN_TARGET_ARCH?= ${MACHINE_ARCH}
+.else
+# MACHINE/MACHINE_ARCH may not follow the same naming as us (e.g. x86_64 vs
+# amd64) on non-FreeBSD. Rather than attempt to sanitise it, arbitrarily use
+# amd64 as the default universe toolchain target.
+UNIVERSE_TOOLCHAIN_TARGET?= amd64
+UNIVERSE_TOOLCHAIN_TARGET_ARCH?= amd64
+.endif
+
targets: .PHONY
@echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
.for target in ${TARGETS}
@@ -613,7 +624,8 @@ universe-toolchain: .PHONY universe_prologue
@echo "--------------------------------------------------------------"
${_+_}@cd ${.CURDIR}; \
env PATH=${PATH:Q} ${SUB_MAKE} ${JFLAG} kernel-toolchain \
- TARGET=${MACHINE} TARGET_ARCH=${MACHINE_ARCH} \
+ TARGET=${UNIVERSE_TOOLCHAIN_TARGET} \
+ TARGET_ARCH=${UNIVERSE_TOOLCHAIN_TARGET_ARCH} \
OBJTOP="${HOST_OBJTOP}" \
WITHOUT_SYSTEM_COMPILER=yes \
WITHOUT_SYSTEM_LINKER=yes \