freebsd-nq/share/mk/bsd.endian.mk
Warner Losh 81ec547fbd bsd.endian.mk: Allow for the cross building case
We need to include bsd.endian.mk from bsd.compiler.mk to enable
compressed symbols only on FreeBSD little endian targets.

However, since we include bsd.compiler.mk from Makefile.inc1 and from
the build tools makefiles, it has to work on Linux and osx. Make the
error condition only when we're building natively (so that we are
forced to add a new architecture to the list).

Otherwise, define bogus, poisoned values and leave TARGET_ENDIANNESS
undefined.  Since we don't actually use TARGET_ENDIANNESS for anything
in the cross building phase, these values are a failsafe agianst their
use. The one place in the build phase that detects endian is
appropriately protected.

Sponsored by:		Netflix
Reviewed by:		jrtc27
Differential Revision:	https://reviews.freebsd.org/D33742
2022-01-04 16:17:17 -07:00

31 lines
1.1 KiB
Makefile

# $FreeBSD$
.if ${MACHINE_CPUARCH} == "aarch64" || \
${MACHINE_CPUARCH} == "arm" || \
${MACHINE_ARCH} == "amd64" || \
${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "powerpc64le" || \
${MACHINE_CPUARCH} == "riscv"
TARGET_ENDIANNESS= 1234
CAP_MKDB_ENDIAN= -l
LOCALEDEF_ENDIAN= -l
.elif ${MACHINE_ARCH} == "powerpc" || \
${MACHINE_ARCH} == "powerpc64" || \
${MACHINE_ARCH} == "powerpcspe"
TARGET_ENDIANNESS= 4321
CAP_MKDB_ENDIAN= -b
LOCALEDEF_ENDIAN= -b
.elif ${.MAKE.OS} == "FreeBSD"
.error "Don't know the endian of this architecture"
.else
#
# During bootstrapping on !FreeBSD OSes, we need to define some value. Short of
# having an exhaustive list for all variants of Linux and MacOS we simply do not
# set TARGET_ENDIANNESS and poison the other variables. They should be unused
# during the bootstrap phases (apart from one place that's adequately protected
# in bsd.compiler.mk) where we're building the bootstrap tools.
#
CAP_MKDB_ENDIAN= -B # Poisoned value, invalid flags for both cap_mkdb
LOCALEDEF_ENDIAN= -B # and localedef.
.endif