mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
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
This commit is contained in:
parent
f2b3bf5c4d
commit
da1ef2d619
8
Makefile
8
Makefile
|
@ -530,14 +530,10 @@ worlds: .PHONY
|
||||||
# powerpcspe excluded from main list until clang fixed
|
# powerpcspe excluded from main list until clang fixed
|
||||||
EXTRA_ARCHES_powerpc= powerpcspe
|
EXTRA_ARCHES_powerpc= powerpcspe
|
||||||
.endif
|
.endif
|
||||||
TARGETS?=amd64 arm arm64 i386 powerpc riscv
|
TARGETS?= ${TARGET_MACHINE_LIST}
|
||||||
_UNIVERSE_TARGETS= ${TARGETS}
|
_UNIVERSE_TARGETS= ${TARGETS}
|
||||||
TARGET_ARCHES_arm?= armv6 armv7
|
|
||||||
TARGET_ARCHES_arm64?= aarch64
|
|
||||||
TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpc64le ${EXTRA_ARCHES_powerpc}
|
|
||||||
TARGET_ARCHES_riscv?= riscv64
|
|
||||||
.for target in ${TARGETS}
|
.for target in ${TARGETS}
|
||||||
TARGET_ARCHES_${target}?= ${target}
|
TARGET_ARCHES_${target}= ${MACHINE_ARCH_LIST_${target}}
|
||||||
.endfor
|
.endfor
|
||||||
|
|
||||||
.if defined(USE_GCC_TOOLCHAINS)
|
.if defined(USE_GCC_TOOLCHAINS)
|
||||||
|
|
|
@ -12,41 +12,17 @@ TARGET_SPEC_VARS?= MACHINE MACHINE_ARCH
|
||||||
${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
|
${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
|
||||||
${.MAKE.DEPENDFILE_PREFIX}
|
${.MAKE.DEPENDFILE_PREFIX}
|
||||||
|
|
||||||
# before we process TARGET_SPEC
|
|
||||||
# we assume that MK_DIRDEPS_BUILD=yes
|
|
||||||
|
|
||||||
# from src/Makefile (for universe)
|
|
||||||
# would be nice to have this sort of info in sys.machine.mk
|
|
||||||
TARGET_ARCHES_arm?= armv6 armv7
|
|
||||||
TARGET_ARCHES_arm64?= aarch64
|
|
||||||
TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpc64le powerpcspe
|
|
||||||
TARGET_ARCHES_riscv?= riscv64
|
|
||||||
|
|
||||||
# some corner cases
|
# some corner cases
|
||||||
BOOT_MACHINE_DIR.amd64 = boot/i386
|
BOOT_MACHINE_DIR.amd64 = boot/i386
|
||||||
MACHINE_ARCH.host = ${_HOST_ARCH}
|
|
||||||
|
|
||||||
# the list of machines we support
|
|
||||||
ALL_MACHINE_LIST?= amd64 arm arm64 i386 powerpc riscv
|
|
||||||
|
|
||||||
.-include <site.sys.dirdeps.env.mk>
|
.-include <site.sys.dirdeps.env.mk>
|
||||||
|
|
||||||
|
ALL_MACHINE_LIST?= ${TARGET_MACHINE_LIST}
|
||||||
|
|
||||||
.for m in ${ALL_MACHINE_LIST:O:u}
|
.for m in ${ALL_MACHINE_LIST:O:u}
|
||||||
MACHINE_ARCH_LIST.$m?= ${TARGET_ARCHES_${m}:U$m}
|
|
||||||
MACHINE_ARCH.$m?= ${MACHINE_ARCH_LIST.$m:[1]}
|
|
||||||
BOOT_MACHINE_DIR.$m ?= boot/$m
|
BOOT_MACHINE_DIR.$m ?= boot/$m
|
||||||
.endfor
|
.endfor
|
||||||
|
|
||||||
.if empty(MACHINE_ARCH)
|
|
||||||
.if !empty(TARGET_ARCH)
|
|
||||||
MACHINE_ARCH= ${TARGET_ARCH}
|
|
||||||
.else
|
|
||||||
MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}}
|
|
||||||
.endif
|
|
||||||
.endif
|
|
||||||
MACHINE_ARCH?= ${MACHINE_ARCH.${MACHINE}}
|
|
||||||
MACHINE_ARCH:= ${MACHINE_ARCH}
|
|
||||||
|
|
||||||
HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
|
HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
|
||||||
|
|
||||||
.if ${REQUESTED_MACHINE:U${MACHINE}} == "host"
|
.if ${REQUESTED_MACHINE:U${MACHINE}} == "host"
|
||||||
|
@ -58,7 +34,7 @@ TARGET_MACHINE= host
|
||||||
.endif
|
.endif
|
||||||
.if ${MACHINE} == "host"
|
.if ${MACHINE} == "host"
|
||||||
OBJTOP := ${HOST_OBJTOP}
|
OBJTOP := ${HOST_OBJTOP}
|
||||||
MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}}
|
MACHINE_ARCH= ${MACHINE_ARCH_${MACHINE}}
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,3 +56,5 @@ ECHO_TRACE?= true
|
||||||
.include <host-target.mk>
|
.include <host-target.mk>
|
||||||
.export HOST_TARGET
|
.export HOST_TARGET
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
.include <sys.machine.mk>
|
||||||
|
|
23
share/mk/sys.machine.mk
Normal file
23
share/mk/sys.machine.mk
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
.-include <local.sys.machine.mk>
|
||||||
|
|
||||||
|
PSEUDO_MACHINE_LIST?= common host
|
||||||
|
TARGET_MACHINE_LIST?= amd64 arm arm64 i386 powerpc riscv
|
||||||
|
|
||||||
|
MACHINE_ARCH_host?= ${_HOST_ARCH}
|
||||||
|
|
||||||
|
MACHINE_ARCH_LIST_arm?= armv6 armv7
|
||||||
|
MACHINE_ARCH_LIST_arm64?= aarch64
|
||||||
|
MACHINE_ARCH_LIST_powerpc?= powerpc powerpc64 powerpc64le ${EXTRA_ARCHES_powerpc}
|
||||||
|
MACHINE_ARCH_LIST_riscv?= riscv64
|
||||||
|
|
||||||
|
.for m in ${TARGET_MACHINE_LIST}
|
||||||
|
MACHINE_ARCH_LIST_$m?= $m
|
||||||
|
MACHINE_ARCH_$m?= ${MACHINE_ARCH_LIST_$m:[1]}
|
||||||
|
# for backwards comatability
|
||||||
|
MACHINE_ARCH.$m?= ${MACHINE_ARCH_$m}
|
||||||
|
.endfor
|
||||||
|
|
||||||
|
.if empty(MACHINE_ARCH)
|
||||||
|
MACHINE_ARCH:= ${MACHINE_ARCH_${MACHINE}}
|
||||||
|
.endif
|
Loading…
Reference in a new issue