Re: FYI: Why META_MODE rebuilds so much for building again after installworld (no source changes)

From: Simon J. Gerraty <sjg_at_juniper.net>
Date: Thu, 23 Feb 2023 20:15:34 UTC
Mark Millard <marklmi@yahoo.com> wrote:
> The contribution to the list is currently generated via
> use of:
> 
> .if ${.MAKE.LEVEL} == 0

Why is this guarded by .MAKE.LEVEL 0?
.MAKE.META.IGNORE_* should be largely irrelevant at level 0
which in the DIRDEPS_BUILD is reserved for orchestration.
Even in the legacy build, level 0 would be just the top-level makefiles
and anything dealing with meta files would be expected to be level 1 or
greater. 

> .for ignore_legacy_tool in awk cap_mkdb cat cp crunchgen crunchide dd egrep env file2c gencat grep gzip jot lex lb ln m4 mkcsmapper mktemp mv patch realpath rm sed sh touch truncate uudecode uuencode xargs
> .MAKE.META.IGNORE_PATHS+= ${MAKEOBJDIR}/tmp/legacy/usr/sbin/${ignore_legacy_tool}
> .endfor
> .for ignore_other_tool in ctfconvert objcopy nm
> .MAKE.META.IGNORE_PATHS+= ${MAKEOBJDIR}/tmp/usr/bin/${ignore_other_tool}
> .endfor
> .MAKE.META.IGNORE_PATHS:= ${.MAKE.META.IGNORE_PATHS}
> .endif
> 
> The := use is how I avoided needing to worry about late binding
> substitutions for my additions (independent of the internals of
> make's specific .MAKE.META.IGNORE_PATHS handling).

Depending on value of MAKEOBJDIR the above may not work at all.
The default is

share/mk/src.sys.obj.mk:_default_makeobjdir= $${.CURDIR:S,^$${SRCTOP},$${OBJTOP},}

In which case the above would not be correct.

> For reference:
> 
> # more ~/sys-build-scripts.amd64-host/make-main-amd64-nodbg-clang.amd64-host.sh
> kldload -n filemon && \
> cd /usr/main-src/ && \
> mkdir -p /usr/obj/BUILDs/main-amd64-nodbg-clang/sys-typescripts/ && \
> script /usr/obj/BUILDs/main-amd64-nodbg-clang/sys-typescripts/typescript-make-amd64-nodbg-clang-amd64-host-$(date +%Y-%m-%d:%H:%M:%S) \
> env __MAKE_CONF="/usr/home/root/src.configs/make.conf" SRCCONF="/dev/null" SRC_ENV_CONF="/usr/home/root/src.configs/src.conf.amd64-nodbg-clang.amd64-host" \
> WITH_META_MODE=yes \
> MAKEOBJDIRPREFIX="/usr/obj/BUILDs/main-amd64-nodbg-clang" \
> make $*
> 
> 
> ===
> Mark Millard
> marklmi at yahoo.com