aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/mk/dirdeps.mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/mk/dirdeps.mk')
-rw-r--r--contrib/bmake/mk/dirdeps.mk192
1 files changed, 135 insertions, 57 deletions
diff --git a/contrib/bmake/mk/dirdeps.mk b/contrib/bmake/mk/dirdeps.mk
index ee31e47c76c5..b281d15ec346 100644
--- a/contrib/bmake/mk/dirdeps.mk
+++ b/contrib/bmake/mk/dirdeps.mk
@@ -1,6 +1,8 @@
-# $Id: dirdeps.mk,v 1.151 2022/01/28 01:13:14 sjg Exp $
+# $Id: dirdeps.mk,v 1.175 2025/01/05 01:16:19 sjg Exp $
-# Copyright (c) 2010-2022, Simon J. Gerraty
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2010-2023, Simon J. Gerraty
# Copyright (c) 2010-2018, Juniper Networks, Inc.
# All rights reserved.
#
@@ -137,7 +139,7 @@
# DIRDEPS_EXPORT_VARS (DEP_EXPORT_VARS)
# It is discouraged, but sometimes necessary for a
# Makefile.depend file to influence the environment.
-# Doing this is correctly (especially if using DIRDEPS_CACHE) is
+# Doing this correctly (especially if using DIRDEPS_CACHE) is
# tricky so a Makefile.depend file can set DIRDEPS_EXPORT_VARS
# and dirdeps.mk will do the deed:
#
@@ -150,10 +152,10 @@
# any other DIRDEP.
#
# This allows for adding TESTS to the build, such that the build
-# if any test fails, but without the risk of introducing
+# will fail if any test fails, but without the risk of introducing
# circular dependencies.
-now_utc ?= ${%s:L:gmtime}
+now_utc ?= ${%s:L:localtime}
.if !defined(start_utc)
start_utc := ${now_utc}
.endif
@@ -179,7 +181,7 @@ _DIRDEP_USE_LEVEL?= 0
_CURDIR ?= ${.CURDIR}
_OBJDIR ?= ${.OBJDIR}
-.if ${MAKEFILE:T} == ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS:Uall:M*/*} != ""
+.if ${MAKEFILE:T} == ${.PARSEFILE} && empty(DIRDEPS) && ${.TARGETS:Uall:M*[/.]*} != ""
# This little trick let's us do
#
# mk -f dirdeps.mk some/dir.${TARGET_SPEC}
@@ -210,12 +212,16 @@ _DEP_TARGET_SPEC =
# it should be set by sys.mk or similar by now.
# TARGET_SPEC must not contain any '.'s.
TARGET_SPEC_VARS ?= MACHINE
+# we allow for this to be a subset
+TARGET_SPEC_VARS.host ?= MACHINE
+TARGET_SPEC_VARS.host32 = ${TARGET_SPEC_VARS.host}
# this is what we started with
TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,}
# this is what we mostly use below
-DEP_TARGET_SPEC = ${TARGET_SPEC_VARS:S,^,DEP_,:@v@${$v:U}@:ts,}
+DEP_TARGET_SPEC_VARS = ${TARGET_SPEC_VARS.${DEP_MACHINE}:U${TARGET_SPEC_VARS}}
+DEP_TARGET_SPEC = ${DEP_TARGET_SPEC_VARS:S,^,DEP_,:@v@${$v:U}@:ts,}
# make sure we have defaults
-.for v in ${TARGET_SPEC_VARS}
+.for v in ${DEP_TARGET_SPEC_VARS}
DEP_$v ?= ${$v}
.endfor
@@ -225,12 +231,7 @@ DEP_$v ?= ${$v}
# we compute below are fully qualified wrt DEP_TARGET_SPEC.
# The makefiles may only partially specify (eg. MACHINE only),
# so we need to construct a set of modifiers to fill in the gaps.
-.if ${MAKE_VERSION} >= 20170130
-_tspec_x := ${TARGET_SPEC_VARS:range}
-.else
-# do it the hard way
-_tspec_x := ${TARGET_SPEC_VARS:[#]:@x@i=1;while [ $$i -le $x ]; do echo $$i; i=$$((i + 1)); done;@:sh}
-.endif
+_tspec_x := ${TARGET_SPEC_VARS:${M_RANGE:Urange}}
# this handles unqualified entries
M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC};
# there needs to be at least one item missing for these to make sense
@@ -240,10 +241,27 @@ _tspec_a$i := ,${TARGET_SPEC_VARS:[$i..-1]:@v@$$$${DEP_$v}@:ts,}
M_dep_qual_fixes += C;(\.${_tspec_m$i})$$;\1${_tspec_a$i};
.endfor
TARGET_SPEC_VARSr := ${TARGET_SPEC_VARS:[-1..1]}
+.if ${TARGET_SPEC_VARS.host} == ${TARGET_SPEC_VARS}
+M_dep_qual_fixes.host = ${M_dep_qual_fixes}
+.elif ${TARGET_SPEC_VARS.host:[#]} > 1
+_htspec_x := ${TARGET_SPEC_VARS.host:${M_RANGE:Urange}}
+# this handles unqualified entries
+M_dep_qual_fixes.host = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC};
+# there needs to be at least one item missing for these to make sense
+.for i in ${_htspec_x:[2..-1]}
+_htspec_m$i := ${TARGET_SPEC_VARS.host:[2..$i]:@w@[^,]+@:ts,}
+_htspec_a$i := ,${TARGET_SPEC_VARS.host:[$i..-1]:@v@$$$${DEP_$v}@:ts,}
+M_dep_qual_fixes.host += C;(\.${_htspec_m$i})$$;\1${_htspec_a$i};
+.endfor
+.else
+M_dep_qual_fixes.host = U
+.endif
.else
# A harmless? default.
M_dep_qual_fixes = U
.endif
+M_dep_qual_fixes.host ?= ${M_dep_qual_fixes}
+M_dep_qual_fixes.host32 = ${M_dep_qual_fixes.host}
.if !defined(.MAKE.DEPENDFILE_PREFERENCE)
# .MAKE.DEPENDFILE_PREFERENCE makes the logic below neater?
@@ -271,6 +289,10 @@ _machine_dependfiles := ${.MAKE.DEPENDFILE_PREFERENCE:T:M*${MACHINE}*}
.endif
.endif
+# turn a list into a set of :N modifiers
+# NskipFoo = ${Foo:${M_ListToSkip}}
+M_ListToSkip ?= O:u:S,^,N,:ts:
+
# this is how we identify non-machine specific dependfiles
N_notmachine := ${.MAKE.DEPENDFILE_PREFERENCE:E:N*${MACHINE}*:${M_ListToSkip}}
@@ -322,7 +344,7 @@ _tspec := ${_DEP_TARGET_SPEC:S/,/ /g}
.for i in ${_tspec_x}
DEP_${TARGET_SPEC_VARS:[$i]} := ${_tspec:[$i]}
.endfor
-.for v in ${TARGET_SPEC_VARS:O:u}
+.for v in ${DEP_TARGET_SPEC_VARS:O:u}
.if empty(DEP_$v)
.undef DEP_$v
.endif
@@ -347,6 +369,10 @@ BUILD_DIRDEPS ?= yes
DIRDEPS_CACHE ?= ${_OBJDIR:tA}/dirdeps.cache${_TARGETS:U${.TARGETS}:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.}
.endif
+# sanity check: Makefile.depend.options should *not* include us
+.if ${.INCLUDEDFROMFILE:U:M${.MAKE.DEPENDFILE_PREFIX}.options} != ""
+.error ${DEP_RELDIR}/${.MAKE.DEPENDFILE_PREFIX}.options: should include dirdeps-options.mk
+.endif
# pickup customizations
# as below you can use !target(_DIRDEP_USE) to protect things
@@ -389,6 +415,8 @@ DIRDEPS_FILTER += M${_DEP_RELDIR}
# this is what we run below
DIRDEP_MAKE ?= ${.MAKE}
DIRDEP_DIR ?= ${.TARGET:R}
+# we normally want the default target
+DIRDEP_TARGETS ?=
# if you want us to report load averages during build
# DIRDEP_USE_PRELUDE += ${DIRDEP_LOADAVG_REPORT};
@@ -401,7 +429,7 @@ DIRDEP_LOADAVG_LAST = 0
# Note: expr(1) will exit 1 if the expression evaluates to 0
# hence the || true
DIRDEP_LOADAVG_REPORT = \
- test -z "${"${expr ${now_utc} - ${DIRDEP_LOADAVG_INTEVAL:U60} - ${DIRDEP_LOADAVG_LAST} || true:L:sh:N-*}":?yes${DIRDEP_LOADAVG_LAST::=${now_utc}}:}" || \
+ test -z "${"${expr ${now_utc} - ${DIRDEP_LOADAVG_INTERVAL:U60} - ${DIRDEP_LOADAVG_LAST} || true:L:sh:N-*}":?yes${DIRDEP_LOADAVG_LAST::=${now_utc}}:}" || \
echo "${TRACER}`${DIRDEP_LOADAVG_CMD}`"
# we suppress SUBDIR when visiting the leaves
@@ -416,7 +444,8 @@ _DIRDEP_USE: .USE .MAKE
MACHINE_ARCH= NO_SUBDIR=1 ${DIRDEP_USE_ENV} \
TARGET_SPEC=${.TARGET:E} \
MACHINE=${.TARGET:E} \
- ${DIRDEP_MAKE} -C ${DIRDEP_DIR} || exit 1; \
+ ${DIRDEP_MAKE} -C ${DIRDEP_DIR} ${DIRDEP_TARGETS} || exit 1; \
+ ${DIRDEP_USE_EPILOGUE} \
break; \
done
@@ -540,7 +569,7 @@ BUILD_DIRDEPS = no
dirdeps: dirdeps-cached
dirdeps-cached: ${DIRDEPS_CACHE} .MAKE
@echo "${TRACER}Using ${DIRDEPS_CACHE}"
- @MAKELEVEL=${.MAKE.LEVEL} \
+ @${DIRDEPS_CACHED_ENV} MAKELEVEL=${.MAKE.LEVEL} \
TARGET_SPEC=${TARGET_SPEC} \
${TARGET_SPEC_VARS:@v@$v=${$v}@} \
${.MAKE} -C ${_CURDIR} -f ${DIRDEPS_CACHE} \
@@ -553,6 +582,7 @@ BUILD_DIRDEPS_MAKEFILE ?= -f dirdeps.mk
# these should generally do
BUILD_DIRDEPS_MAKEFILE ?=
+BUILD_DIRDEPS_OVERRIDES ?=
BUILD_DIRDEPS_TARGETS ?= ${.TARGETS}
.if ${DIRDEPS_CACHE} != ${STATIC_DIRDEPS_CACHE:Uno} && ${DIRDEPS_CACHE:M${SRCTOP}/*} == ""
@@ -572,13 +602,15 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP
TARGET_SPEC=${TARGET_SPEC} \
MAKEFLAGS= ${DIRDEP_CACHE_MAKE:U${.MAKE}} -C ${_CURDIR} \
${BUILD_DIRDEPS_MAKEFILE} \
- ${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \
+ ${BUILD_DIRDEPS_TARGETS} \
+ ${BUILD_DIRDEPS_OVERRIDES} \
+ BUILD_DIRDEPS_CACHE=yes \
.MAKE.DEPENDFILE=.none \
${"${DEBUG_DIRDEPS:Nno}":?DEBUG_DIRDEPS='${DEBUG_DIRDEPS}':} \
- ${.MAKEFLAGS:tW:S,-D ,-D,g:tw:M*WITH*} \
- ${.MAKEFLAGS:tW:S,-d ,-d,g:tw:M-d*} \
- 3>&1 1>&2 | sed 's,${SRCTOP},_{SRCTOP},g;s,_{,$${,g' >> ${.TARGET}.new && \
- mv ${.TARGET}.new ${.TARGET}
+ ${.MAKEFLAGS:S,-D ,-D,gW:M*WITH*} \
+ ${.MAKEFLAGS:S,-d ,-d,gW:M-d*} \
+ 3>&1 1>&2 | sed 's,${SRCTOP},_{SRCTOP},g;s,_{SRCTOP}/_{SRCTOP},_{SRCTOP},g;s,_{,$${,g' >> ${.TARGET}.new && \
+ { ${BUILD_DIRDEPS_EPILOGUE} mv ${.TARGET}.new ${.TARGET}; }
.endif
.endif
@@ -633,28 +665,28 @@ _machines += host
_machines := ${_machines:O:u}
.endif
-.if ${TARGET_SPEC_VARS:[#]} > 1
+.if ${DEP_TARGET_SPEC_VARS:[#]} > 1
# we need to tweak _machines
_dm := ${DEP_MACHINE}
# apply the same filtering that we do when qualifying DIRDEPS.
# M_dep_qual_fixes expects .${MACHINE}* so add (and remove) '.'
# Again we expect that any already qualified machines are fully qualified.
-_machines := ${_machines:M*,*} ${_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,}
+_machines := ${_machines:M*,*} ${_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:S,^.,,}
DEP_MACHINE := ${_dm}
-_machines := ${_machines:O:u}
+_machines := ${_machines:${M_dep_qual_fixes.${DEP_MACHINE}:U${M_dep_qual_fixes}:ts:}:O:u}
.endif
# reset each time through
_build_dirs =
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+.if ${DEP_RELDIR} == ${_DEP_RELDIR} && ${_CURDIR} != ${SRCTOP}
# pickup other machines for this dir if necessary
_build_dirs += ${_machines:@m@${_CURDIR}.$m@}
.endif
.if ${_debug_reldir}
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: nDIRDEPS=${DIRDEPS:[#]}
-.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: DIRDEPS='${DIRDEPS}'
+.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: DIRDEPS=${DIRDEPS:${DEBUG_DIRDEPS_LIST_FILTER:U:N/:ts:}}
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: _machines='${_machines}'
.endif
@@ -664,9 +696,22 @@ DEP_DIRDEPS_FILTER = \
${DIRDEPS_FILTER.${DEP_TARGET_SPEC}:U} \
${TARGET_SPEC_VARS:@v@${DIRDEPS_FILTER.${DEP_$v}:U}@} \
${DIRDEPS_FILTER:U}
+
.if empty(DEP_DIRDEPS_FILTER)
# something harmless
-DEP_DIRDEPS_FILTER = U
+DEP_DIRDEPS_FILTER = u
+.endif
+
+# this is applied after we have computed build dirs
+# so everything is fully qualified and starts with ${SRCTOP}/
+DEP_DIRDEPS_BUILD_DIR_FILTER = \
+ ${DIRDEPS_BUILD_DIR_FILTER.${DEP_TARGET_SPEC}:U} \
+ ${TARGET_SPEC_VARS:@v@${DIRDEPS_BUILD_DIR_FILTER.${DEP_$v}:U}@} \
+ ${DIRDEPS_BUILD_DIR_FILTER:U}
+
+.if empty(DEP_DIRDEPS_BUILD_DIR_FILTER)
+# something harmless
+DEP_DIRDEPS_BUILD_DIR_FILTER = u
.endif
# this is what we start with
@@ -686,9 +731,10 @@ __qual_depdirs += ${__hostdpadd}
.if ${_debug_reldir}
.info DEP_DIRDEPS_FILTER=${DEP_DIRDEPS_FILTER:ts:}
-.info depdirs=${__depdirs:S,^${SRCTOP}/,,}
-.info qualified=${__qual_depdirs:S,^${SRCTOP}/,,}
-.info unqualified=${__unqual_depdirs:S,^${SRCTOP}/,,}
+.info DEP_DIRDEPS_BUILD_DIR_FILTER=${DEP_DIRDEPS_BUILD_DIR_FILTER:ts:}
+.info depdirs=${__depdirs:S,^${SRCTOP}/,,:${DEBUG_DIRDEPS_LIST_FILTER:U:N/:ts:}}
+.info qualified=${__qual_depdirs:S,^${SRCTOP}/,,:${DEBUG_DIRDEPS_LIST_FILTER:U:N/:ts:}}
+.info unqualified=${__unqual_depdirs:S,^${SRCTOP}/,,:${DEBUG_DIRDEPS_LIST_FILTER:U:N/:ts:}}
.endif
# _build_dirs is what we will feed to _DIRDEP_USE
@@ -699,13 +745,28 @@ _build_dirs += \
${_machines:Nhost*:@m@${__unqual_depdirs:@d@$d.$m@}@}
# qualify everything now
-_build_dirs := ${_build_dirs:${M_dep_qual_fixes:ts:}:O:u}
+.if ${_debug_reldir}
+.info _build_dirs=${_build_dirs:${DEBUG_DIRDEPS_LIST_FILTER:U:N/:ts:}}
+.endif
+# make sure we do not mess with qualifying "host" entries
+_build_dirs := ${_build_dirs:M*.host*:${M_dep_qual_fixes.host:ts:}} \
+ ${_build_dirs:N*.host*:${M_dep_qual_fixes:ts:}}
+# some filters can only be applied now
+_build_dirs := ${_build_dirs:${DEP_DIRDEPS_BUILD_DIR_FILTER:ts:}:O:u}
+.if ${_debug_reldir}
+.info _build_dirs=${_build_dirs:${DEBUG_DIRDEPS_LIST_FILTER:U:N/:ts:}}
+.endif
.endif # empty DIRDEPS
_build_all_dirs += ${_build_dirs} ${_build_xtra_dirs}
_build_all_dirs := ${_build_all_dirs:O:u}
+# we prefer DIRDEPS_EXPORT_VARS
+.if empty(DIRDEPS_EXPORT_VARS) && !empty(DEP_EXPORT_VARS)
+DIRDEPS_EXPORT_VARS = ${DEP_EXPORT_VARS}
+.endif
+
# Normally if doing make -V something,
# we do not want to waste time chasing DIRDEPS
# but if we want to count the number of Makefile.depend* read, we do.
@@ -717,11 +778,9 @@ _cache_script = echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}';
# guard against _new_dirdeps being too big for a single command line
_new_dirdeps := ${_build_all_dirs:@x@${target($x):?:$x}@:S,^${SRCTOP}/,,}
_cache_xtra_deps := ${_build_xtra_dirs:S,^${SRCTOP}/,,}
-.export _cache_xtra_deps _new_dirdeps
-.if !empty(DIRDEPS_EXPORT_VARS) || !empty(DEP_EXPORT_VARS)
+.if !empty(DIRDEPS_EXPORT_VARS)
# Discouraged, but there are always exceptions.
# Handle it here rather than explain how.
-DIRDEPS_EXPORT_VARS ?= ${DEP_EXPORT_VARS}
_cache_xvars := echo; ${DIRDEPS_EXPORT_VARS:@v@echo '$v = ${$v}';@} echo '.export ${DIRDEPS_EXPORT_VARS}'; echo;
_cache_script += ${_cache_xvars}
.endif
@@ -732,13 +791,7 @@ dirdeps: ${_build_all_dirs}
${_build_all_dirs}: _DIRDEP_USE
.if ${_debug_reldir}
-.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs:S,^${SRCTOP}/,,}
-.endif
-
-.if !empty(DIRDEPS_EXPORT_VARS) || !empty(DEP_EXPORT_VARS)
-.export ${DIRDEPS_EXPORT_VARS} ${DEP_EXPORT_VARS}
-DIRDEPS_EXPORT_VARS =
-DEP_EXPORT_VARS =
+.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs:S,^${SRCTOP}/,,:${DEBUG_DIRDEPS_LIST_FILTER:U:N/:ts:}}
.endif
# this builds the dependency graph
@@ -749,9 +802,10 @@ _cache_script += echo; echo 'DIRDEPS.${_this_dir}.$m = \';
.endif
# it would be nice to do :N${.TARGET}
.if !empty(__qual_depdirs)
-.for q in ${__qual_depdirs:${M_dep_qual_fixes:ts:}:E:O:u:N$m}
+.for q in ${__qual_depdirs:M*.host*:${M_dep_qual_fixes.host:ts:}:E:O:u:N$m} \
+ ${__qual_depdirs:N*.host*:${M_dep_qual_fixes:ts:}:E:O:u:N$m}
.if ${_debug_reldir} || ${DEBUG_DIRDEPS:@x@${${DEP_RELDIR}.$m:L:M$x}${${DEP_RELDIR}.$q:L:M$x}@} != ""
-.info ${DEP_RELDIR}.$m: graph: ${_build_dirs:M*.$q:S,^${SRCTOP}/,,}
+.info ${DEP_RELDIR}.$m: q=$q graph: ${_build_dirs:M*.$q:S,^${SRCTOP}/,,}
.endif
.if ${BUILD_DIRDEPS_CACHE} == "yes"
_cache_deps += ${_build_dirs:M*.$q:S,^${SRCTOP}/,,}
@@ -766,15 +820,27 @@ ${_this_dir}.$m: ${_build_dirs:M*.$q}
.if ${BUILD_DIRDEPS_CACHE} == "yes"
.if !empty(_build_dirs)
_cache_deps += ${_build_dirs:M*.$m:N${_this_dir}.$m:S,^${SRCTOP}/,,}
+# anything in _{build,env}_xtra_dirs is hooked to dirdeps: only
+.if ${MAKE_VERSION} < 20240105
.if !empty(_cache_deps)
.export _cache_deps
_cache_script += for x in $$_cache_deps; do echo " _{SRCTOP}/$$x \\"; done;
.endif
-# anything in _{build,env}_xtra_dirs is hooked to dirdeps: only
+.export _cache_xtra_deps _new_dirdeps
x!= echo; { echo; ${_cache_script} echo; echo '${_this_dir}.$m: $${DIRDEPS.${_this_dir}.$m}'; \
echo; echo 'dirdeps: ${_this_dir}.$m \'; \
for x in $$_cache_xtra_deps; do echo " _{SRCTOP}/$$x \\"; done; \
echo; for x in $$_new_dirdeps; do echo "_{SRCTOP}/$$x: _DIRDEP_USE"; done; } >&3
+.else
+# we do not have the same limits on command lines
+.if !empty(_cache_deps)
+_cache_script += for x in ${_cache_deps}; do echo " _{SRCTOP}/$$x \\"; done;
+.endif
+x!= echo; { echo; ${_cache_script} echo; echo '${_this_dir}.$m: $${DIRDEPS.${_this_dir}.$m}'; \
+ echo; echo 'dirdeps: ${_this_dir}.$m \'; \
+ for x in ${_cache_xtra_deps}; do echo " _{SRCTOP}/$$x \\"; done; \
+ echo; for x in ${_new_dirdeps}; do echo "_{SRCTOP}/$$x: _DIRDEP_USE"; done; } >&3
+.endif
.endif
.else
${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
@@ -783,13 +849,23 @@ ${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
.endif
+.if !empty(DIRDEPS_EXPORT_VARS)
+.if ${BUILD_DIRDEPS_CACHE} == "no"
+.export ${DIRDEPS_EXPORT_VARS}
+.endif
+# Reset these, we are done with them for this iteration.
+DIRDEPS_EXPORT_VARS =
+DEP_EXPORT_VARS =
+.endif
+
# Now find more dependencies - and recurse.
.for d in ${_build_all_dirs}
.if !target(_dirdeps_checked.$d)
# once only
_dirdeps_checked.$d:
+_dr := ${d:S,^${SRCTOP}/,,}
.if ${_debug_search}
-.info checking ${d:S,^${SRCTOP}/,,}
+.info checking ${_dr}
.endif
# Note: _build_all_dirs is fully qualifed so d:R is always the directory
.if exists(${d:R})
@@ -797,14 +873,13 @@ _dirdeps_checked.$d:
_DEP_TARGET_SPEC := ${d:E}
# some makefiles may still look at this
_DEP_MACHINE := ${d:E:C/,.*//}
+DEP_MACHINE := ${_DEP_MACHINE}
# set these too in case Makefile.depend* uses them
-.if ${TARGET_SPEC_VARS:[#]} > 1
+.if ${DEP_TARGET_SPEC_VARS:[#]} > 1
_dtspec := ${_DEP_TARGET_SPEC:S/,/ /g}
.for i in ${_tspec_x}
-DEP_${TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]}
+DEP_${DEP_TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]}
.endfor
-.else
-DEP_MACHINE := ${_DEP_MACHINE}
.endif
# Warning: there is an assumption here that MACHINE is always
# the first entry in TARGET_SPEC_VARS.
@@ -812,20 +887,23 @@ DEP_MACHINE := ${_DEP_MACHINE}
_m := ${.MAKE.DEPENDFILE_PREFERENCE:T:S;${TARGET_SPEC}$;${d:E};:C;${MACHINE}((,.+)?)$;${d:E:C/,.*//}\1;:@m@${exists(${d:R}/$m):?${d:R}/$m:}@:[1]}
.if !empty(_m)
# M_dep_qual_fixes isn't geared to Makefile.depend
-_qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}}
-.if ${_debug_search}
-.info Looking for ${_qm}
-.endif
+_qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes.${d:E}:U${M_dep_qual_fixes}:ts:}}
# set this "just in case"
# we can skip :tA since we computed the path above
DEP_RELDIR := ${_m:H:S,^${SRCTOP}/,,}
# and reset this
DIRDEPS =
-.if ${_debug_reldir} && ${_qm} != ${_m}
-.info loading ${_m} for ${d:E}
+.if ${_debug_search} || ${_debug_reldir}
+.info Loading ${_m:S,${SRCTOP}/,,} for ${_dr}
.endif
.include <${_m}>
.else
+# set these as if we found Makefile.depend*
+DEP_RELDIR := ${_dr:R}
+DIRDEPS =
+.if ${_debug_reldir}
+.info loading local.dirdeps-missing.mk for ${_dr}
+.endif
.-include <local.dirdeps-missing.mk>
.endif
.endif