diff options
Diffstat (limited to 'mk/meta.sys.mk')
-rw-r--r-- | mk/meta.sys.mk | 105 |
1 files changed, 20 insertions, 85 deletions
diff --git a/mk/meta.sys.mk b/mk/meta.sys.mk index 1fc58a226cb1..ba213dd49da4 100644 --- a/mk/meta.sys.mk +++ b/mk/meta.sys.mk @@ -1,7 +1,7 @@ -# $Id: meta.sys.mk,v 1.46 2023/04/18 18:43:00 sjg Exp $ +# $Id: meta.sys.mk,v 1.51 2023/05/11 20:05:32 sjg Exp $ # -# @(#) Copyright (c) 2010-2021, Simon J. Gerraty +# @(#) Copyright (c) 2010-2023, Simon J. Gerraty # # This file is provided in the hope that it will # be of use. There is absolutely NO WARRANTY. @@ -17,56 +17,21 @@ # include this if you want to enable meta mode # for maximum benefit, requires filemon(4) driver. -.if ${MAKE_VERSION:U0} > 20100901 -.if !target(.ERROR) +# absolute path to what we are reading. +_PARSEDIR ?= ${.PARSEDIR:tA} .-include <local.meta.sys.env.mk> -# If TARGET_SPEC_VARS is other than just MACHINE -# it should be set by now. -# TARGET_SPEC must not contain any '.'s. -TARGET_SPEC_VARS ?= MACHINE - -.if !target(_meta_tspec_env_done_) -_meta_tspec_env_done_: .NOTMAIN -# Allow for local.meta.sys.env.mk to have done this - -.if ${TARGET_SPEC:Uno:M*,*} != "" -# deal with TARGET_SPEC from env -_tspec := ${TARGET_SPEC:S/,/ /g} -.for i in ${TARGET_SPEC_VARS:${M_RANGE:Urange}} -${TARGET_SPEC_VARS:[$i]} := ${_tspec:[$i]} -.endfor -# We need to stop that TARGET_SPEC affecting any submakes -TARGET_SPEC= -# so export but do not track -.export-env TARGET_SPEC -.export ${TARGET_SPEC_VARS} -.for v in ${TARGET_SPEC_VARS:O:u} -.if empty($v) -.undef $v -.endif -.endfor -.endif -.endif - -# Now make sure we know what TARGET_SPEC is -# as we may need it to find Makefile.depend* -.if ${MACHINE:Mhost*} != "" -# host is special -TARGET_SPEC = ${MACHINE} -.else -TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} -.endif - -# absolute path to what we are reading. -_PARSEDIR = ${.PARSEDIR:tA} - .if !defined(SYS_MK_DIR) SYS_MK_DIR := ${_PARSEDIR} .endif -META_MODE += meta verbose +.if !target(.ERROR) + +META_MODE += meta +.if empty(.MAKEFLAGS:M-s) +META_MODE += verbose +.endif .if ${MAKE_VERSION:U0} > 20130323 && empty(.MAKE.PATH_FILEMON) # we do not support filemon META_MODE += nofilemon @@ -102,19 +67,7 @@ META_MODE += silent=yes .endif .endif -# we use the pseudo machine "host" for the build host. -# this should be taken care of before we get here -.if ${OBJTOP:Ua} == ${HOST_OBJTOP:Ub} -MACHINE = host -.endif - -.if !defined(MACHINE0) -# it can be handy to know which MACHINE kicked off the build -# for example, if using Makefild.depend for multiple machines, -# allowing only MACHINE0 to update can keep things simple. -MACHINE0 := ${MACHINE} -.export MACHINE0 -.endif +.if ${MK_DIRDEPS_BUILD:Uno} == "yes" .if !defined(META2DEPS) .if defined(PYTHON) && exists(${PYTHON}) @@ -134,6 +87,11 @@ MAKE_PRINT_VAR_ON_ERROR += \ MAKEFILE \ .MAKE.MODE +MK_META_ERROR_TARGET = yes +.endif + +.if ${MK_META_ERROR_TARGET:Uno} == "yes" + .if !defined(SB) && defined(SRCTOP) SB = ${SRCTOP:H} .endif @@ -150,21 +108,12 @@ _metaError: .NOMETA .NOTMAIN echo "ERROR: log ${meta_error_log}" >&2; }; : .endif +.endif # Are we, after all, in meta mode? .if ${.MAKE.MODE:Uno:Mmeta*} != "" MKDEP_MK ?= meta.autodep.mk -.if ${.MAKE.MAKEFILES:M*sys.dependfile.mk} == "" -# this does all the smarts of setting .MAKE.DEPENDFILE -.-include <sys.dependfile.mk> -# check if we got anything sane -.if ${.MAKE.DEPENDFILE} == ".depend" -.undef .MAKE.DEPENDFILE -.endif -.MAKE.DEPENDFILE ?= Makefile.depend -.endif - # we can afford to use cookies to prevent some targets # re-running needlessly META_COOKIE_TOUCH?= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET:T}} @@ -192,27 +141,13 @@ UPDATE_DEPENDFILE= NO .endif .endif -.if ${.MAKE.LEVEL} == 0 -.if ${MK_DIRDEPS_BUILD:Uyes} == "yes" -# make sure dirdeps target exists and do it first -all: dirdeps .WAIT -dirdeps: -.NOPATH: dirdeps - -.if defined(ALL_MACHINES) -# the first .MAIN: is what counts -# by default dirdeps is all we want at level0 -.MAIN: dirdeps -.endif -.endif +.else # in meta mode? -.endif -.else META_COOKIE_TOUCH= # some targets need to be .PHONY in non-meta mode META_NOPHONY= .PHONY META_NOECHO= echo -.endif -.endif + +.endif # in meta mode? .-include <local.meta.sys.mk> |