diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -530,14 +530,10 @@ # powerpcspe excluded from main list until clang fixed EXTRA_ARCHES_powerpc= powerpcspe .endif -TARGETS?=amd64 arm arm64 i386 powerpc riscv +TARGETS?= ${TARGET_MACHINE_LIST} _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} -TARGET_ARCHES_${target}?= ${target} +TARGET_ARCHES_${target}= ${MACHINE_ARCH_LIST_${target}} .endfor .if defined(USE_GCC_TOOLCHAINS) diff --git a/share/mk/local.sys.dirdeps.env.mk b/share/mk/local.sys.dirdeps.env.mk --- a/share/mk/local.sys.dirdeps.env.mk +++ b/share/mk/local.sys.dirdeps.env.mk @@ -12,41 +12,17 @@ ${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \ ${.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 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 -.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]} +ALL_MACHINE_LIST?= ${TARGET_MACHINE_LIST} + +.for m in ${TARGET_MACHINE_LIST:O:u} BOOT_MACHINE_DIR.$m ?= boot/$m .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} .if ${REQUESTED_MACHINE:U${MACHINE}} == "host" @@ -58,7 +34,7 @@ .endif .if ${MACHINE} == "host" OBJTOP := ${HOST_OBJTOP} -MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}} +MACHINE_ARCH= ${MACHINE_ARCH_${MACHINE}} .endif diff --git a/share/mk/local.sys.env.mk b/share/mk/local.sys.env.mk --- a/share/mk/local.sys.env.mk +++ b/share/mk/local.sys.env.mk @@ -56,3 +56,5 @@ .include .export HOST_TARGET .endif + +.include diff --git a/share/mk/sys.machine.mk b/share/mk/sys.machine.mk new file mode 100644 --- /dev/null +++ b/share/mk/sys.machine.mk @@ -0,0 +1,23 @@ + +.-include + +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