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
This commit is contained in:
Jessica Clarke 2023-08-23 18:00:16 +01:00
parent 62f243acea
commit ecf01a8ebc
1 changed files with 13 additions and 1 deletions

View File

@ -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 \