diff --git a/share/mk/local.meta.sys.env.mk b/share/mk/local.meta.sys.env.mk index 6b692d13fedf..6d0d493f1047 100644 --- a/share/mk/local.meta.sys.env.mk +++ b/share/mk/local.meta.sys.env.mk @@ -1,95 +1,102 @@ # $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 .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 .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 .if make(showconfig) # this does not need/want filemon UPDATE_DEPENDFILE= NO .endif + +.if ${MK_DIRDEPS_BUILD} == "yes" +.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 +.endif diff --git a/share/mk/local.sys.mk b/share/mk/local.sys.mk index abcbf396c6b4..148499483c8b 100644 --- a/share/mk/local.sys.mk +++ b/share/mk/local.sys.mk @@ -1,124 +1,119 @@ # $FreeBSD$ .if !target(_${_this}_) _${_this}_: .NOTMAIN .if ${MK_DIRDEPS_BUILD} == "yes" || ${MK_META_MODE} == "yes" # Not in the below list as it may make sense for non-meta mode # eventually. meta.sys.mk (DIRDEPS_BUILD) also already adds these in. .if ${MK_DIRDEPS_BUILD} == "no" && ${MK_META_MODE} == "yes" MAKE_PRINT_VAR_ON_ERROR += \ .ERROR_TARGET \ .ERROR_META_FILE \ .MAKE.LEVEL \ MAKEFILE \ .MAKE.MODE .endif _ERROR_CMD_EXEC= ${sed -n '/^CMD/s,^CMD \(.*\),\1;,p' ${.ERROR_META_FILE}:L:sh} _ERROR_CMD= ${!empty(.ERROR_META_FILE):?${_ERROR_CMD_EXEC}:.PHONY} MAKE_PRINT_VAR_ON_ERROR+= \ _ERROR_CMD \ .CURDIR \ .MAKE \ .OBJDIR \ .TARGETS \ CPUTYPE \ DESTDIR \ LD_LIBRARY_PATH \ MACHINE \ MACHINE_ARCH \ MACHINE_CPUARCH \ MAKEOBJDIRPREFIX \ MAKESYSPATH \ MAKE_VERSION \ PATH \ SRCTOP \ OBJTOP \ ${MAKE_PRINT_VAR_ON_ERROR_XTRAS} # Meta mode may rebuild targets that then fail. The next build won't detect # the meta mode change. Not all targets have a 'rm ${.TARGET}' in them # so force it. .DELETE_ON_ERROR: .if ${.MAKE.LEVEL} > 0 MAKE_PRINT_VAR_ON_ERROR += .MAKE.MAKEFILES .PATH .endif .endif .if !empty(.OBJDIR) OBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP} .endif .if !empty(LIBDIR) _PREMK_LIBDIR:= ${LIBDIR} .endif .include "src.sys.mk" .-include .if make(*-jobs) && empty(JOB_MAX) # provide a reasonable? default for JOB_MAX based on ncpu JOB_MAX_FACTOR?= 1.33 NPROC?= ${(type nproc || true) 2> /dev/null:L:sh:M/*:[1]} NPROC:= ${NPROC} .if !empty(NPROC) ncpu!= ${NPROC} .elif ${.MAKE.OS:NDarwin:NFreeBSD} == "" ncpu!= sysctl -n hw.ncpu .endif .if ${ncpu:U0} > 1 .if ${JOB_MAX_FACTOR} == 1 JOB_MAX:= ${ncpu} .else jm!= echo ${ncpu} \* ${JOB_MAX_FACTOR} | bc JOB_MAX:= ${jm:R} .endif .endif .endif -.if ${MK_DIRDEPS_BUILD} == "yes" -.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 -.endif +# this will be set via local.meta.sys.env.mk if appropriate MK_host_egacy?= no .if ${.MAKE.MODE:Mmeta*} != "" # we can afford to use cookies to prevent some targets # re-running needlessly but only when using filemon. # Targets that should support the meta mode cookie handling should just be # added to META_TARGETS. If bsd.sys.mk cannot be included then ${META_DEPS} # should be added as a target dependency as well. Otherwise the target # is added to in bsd.sys.mk since it comes last. .if ${.MAKE.MODE:Mnofilemon} == "" # Prepend .OBJDIR if not already there. _META_COOKIE_COND= "${.TARGET:M${.OBJDIR}/*}" == "" _META_COOKIE_DEFAULT= ${${_META_COOKIE_COND}:?${.OBJDIR}/${.TARGET}:${.TARGET}} # Use the default if COOKIE.${.TARGET} is not defined. META_COOKIE= ${COOKIE.${.TARGET}:U${_META_COOKIE_DEFAULT}} META_COOKIE_RM= @rm -f ${META_COOKIE} META_COOKIE_TOUCH= @touch ${META_COOKIE} CLEANFILES+= ${META_TARGETS} _meta_dep_before: .USEBEFORE .NOTMAIN ${META_COOKIE_RM} _meta_dep_after: .USE .NOTMAIN ${META_COOKIE_TOUCH} # Attach this to a target to allow it to benefit from meta mode's # not rerunning a command if it doesn't need to be considering its # metafile/filemon-tracked dependencies. META_DEPS= _meta_dep_before _meta_dep_after .META .endif .else # some targets need to be .PHONY - but not in meta mode META_NOPHONY= .PHONY .endif META_NOPHONY?= META_COOKIE_RM?= META_COOKIE_TOUCH?= META_DEPS+= ${META_NOPHONY} .endif