Extract some of local.meta.sys.mk to local.meta.sys.env.mk

Latest meta.sys.mk follows sys.mk in including local.meta.sys.env.mk
and local.meta.sys.mk late, but we have things we need done early
so move them to local.meta.sys.env.mk
This commit is contained in:
Simon J. Gerraty 2023-04-22 15:07:53 -07:00
parent 16161b4839
commit cf20b1f81c
3 changed files with 91 additions and 89 deletions

View File

@ -0,0 +1,90 @@
# $FreeBSD$
# local configuration specific to meta mode
# before we process TARGET_SPEC
# we assume that MK_DIRDEPS_BUILD=yes
.if !defined(HOST_TARGET) || !defined(HOST_MACHINE)
# we need HOST_TARGET etc below.
.include <host-target.mk>
.export HOST_TARGET
.endif
# from src/Makefile (for universe)
TARGET_ARCHES_arm?= 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 <site.meta.sys.env.mk>
.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
.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}
# 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
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 ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL} == 0
.MAIN: dirdeps
.if make(all)
.error DIRDEPS_BUILD: Please run '${MAKE}' instead of '${MAKE} all'.
.endif
.endif
.endif
# 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}
.undef .MAKE.DEPENDFILE
META_MODE+= missing-meta=yes
.if empty(META_MODE:Mnofilemon)
META_MODE+= missing-filemon=yes
.endif

View File

@ -6,43 +6,8 @@
# we need this until there is an alternative
MK_INSTALL_AS_USER= yes
.if !defined(HOST_TARGET) || !defined(HOST_MACHINE)
# we need HOST_TARGET etc below.
.include <host-target.mk>
.export HOST_TARGET
.endif
# from src/Makefile (for universe)
TARGET_ARCHES_arm?= 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 <site.meta.sys.mk>
.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
.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}
# to be consistent with src/Makefile just concatenate with '.'s
TARGET_OBJ_SPEC:= ${TARGET_SPEC:S;,;.;g}
OBJTOP:= ${OBJROOT}${TARGET_OBJ_SPEC}
@ -53,33 +18,6 @@ OBJTOP:= ${OBJROOT}${TARGET_OBJ_SPEC}
.endif
.endif
HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
.if ${OBJTOP} == ${HOST_OBJTOP} || ${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 ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL} == 0
.MAIN: dirdeps
.if make(all)
.error DIRDEPS_BUILD: Please run '${MAKE}' instead of '${MAKE} all'.
.endif
.endif
.endif
# we want to end up with a singe stage tree for all machines
.if ${MK_STAGING} == "yes"
@ -130,25 +68,9 @@ LDFLAGS_LAST+= -L${STAGE_LIBDIR}
.-include "local.toolchain.mk"
# 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}
.undef .MAKE.DEPENDFILE
.include "sys.dependfile.mk"
.if ${.MAKE.LEVEL} > 0 && ${MACHINE} == "host" && ${.MAKE.DEPENDFILE:E} != "host"
# we can use this but should not update it.
UPDATE_DEPENDFILE= NO
.endif
# Don't require filemon for makeman.
.if make(showconfig)
UPDATE_DEPENDFILE= NO
UPDATE_DEPENDFILE?= NO
.endif
# define the list of places that contain files we are responsible for
@ -232,11 +154,6 @@ CFLAGS+= ${CROSS_TARGET_FLAGS}
ACFLAGS+= ${CROSS_TARGET_FLAGS}
.endif
META_MODE+= missing-meta=yes
.if empty(META_MODE:Mnofilemon)
META_MODE+= missing-filemon=yes
.endif
.if ${MK_DIRDEPS_BUILD} == "yes"
# we set these here, rather than local.gendirdeps.mk
# so we can ensure any DEP_* values that might be used in

View File

@ -50,8 +50,3 @@ ECHO_TRACE?= true
.include "src.sys.env.mk"
.-include <site.sys.env.mk>
# 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