freebsd-src/share/mk/local.sys.dirdeps.env.mk
Simon J. Gerraty da1ef2d619 Move MACHINE/MACHINE_ARCH handling to sys.machine.mk
Rather than define the TARGETS and TARGET_ARCHES in src/Makefile
put them in sys.machine.mk so they can also be leveraged by
non-top-level builds.

We have TARGET_MACHINE_LIST as the list of MACHINES we build for.

For each MACHINE we have a MACHINE_ARCH_LIST_${MACHINE}
and the first entry of each list is used as default for
MACHINE_ARCH_${MACHINE}

We can now remove a bunch of MACHINE_ARCH.* handling from
local.sys.dirdeps*mk

Reviewed by:	imp
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D40083
2023-05-13 08:15:49 -07:00

57 lines
1.4 KiB
Makefile

# For universe we want to potentially
# build for multiple MACHINE_ARCH per MACHINE
# so we need more than MACHINE in TARGET_SPEC
TARGET_SPEC_VARS?= MACHINE MACHINE_ARCH
# this is sufficient for most of the tree.
.MAKE.DEPENDFILE_DEFAULT = ${.MAKE.DEPENDFILE_PREFIX}
# but if we have a machine qualified file it should be used in preference
.MAKE.DEPENDFILE_PREFERENCE = \
${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
${.MAKE.DEPENDFILE_PREFIX}
# some corner cases
BOOT_MACHINE_DIR.amd64 = boot/i386
.-include <site.sys.dirdeps.env.mk>
ALL_MACHINE_LIST?= ${TARGET_MACHINE_LIST}
.for m in ${ALL_MACHINE_LIST:O:u}
BOOT_MACHINE_DIR.$m ?= boot/$m
.endfor
HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
.if ${REQUESTED_MACHINE:U${MACHINE}} == "host"
MACHINE= host
.if ${TARGET_MACHINE:Uno} == ${HOST_TARGET}
# not what we want
TARGET_MACHINE= host
.endif
.endif
.if ${MACHINE} == "host"
OBJTOP := ${HOST_OBJTOP}
MACHINE_ARCH= ${MACHINE_ARCH_${MACHINE}}
.endif
.if ${.MAKE.LEVEL} == 0 || empty(PYTHON)
PYTHON ?= /usr/local/bin/python
.export PYTHON
# _SKIP_BUILD is not 100% as it requires wrapping all 'all:' targets to avoid
# building in MAKELEVEL0. Just prohibit 'all' entirely in this case to avoid
# problems.
.if make(all)
.error DIRDEPS_BUILD: Please run '${MAKE}' instead of '${MAKE} all'.
.endif
.endif
.if ${.MAKE.OS} != "FreeBSD" || ${_HOST_OSREL:R} < ${OS_REVISION:R}
# a pseudo option to indicate we need libegacy for host
MK_host_egacy= yes
.endif