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
This commit is contained in:
Warner Losh 2022-01-04 16:17:17 -07:00
parent b4dda138e8
commit 81ec547fbd

View File

@ -15,6 +15,16 @@ LOCALEDEF_ENDIAN= -l
TARGET_ENDIANNESS= 4321
CAP_MKDB_ENDIAN= -b
LOCALEDEF_ENDIAN= -b
.else
.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