git: f697b9d03d99 - main - Update sys.dirdeps.mk set default DEP_*

From: Simon J. Gerraty <sjg_at_FreeBSD.org>
Date: Thu, 18 Apr 2024 21:07:32 UTC
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=f697b9d03d998da8ec69f2028dd7702a42adc3fc

commit f697b9d03d998da8ec69f2028dd7702a42adc3fc
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2024-04-18 21:07:24 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2024-04-18 21:07:24 +0000

    Update sys.dirdeps.mk set default DEP_*
    
    Even at level 0 it is handy to default DEP_*
    used by Makefile.depend* to aid the first include if
    in a leaf dir.
    
    Reviewed by: stevek
---
 share/mk/sys.dirdeps.mk | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/share/mk/sys.dirdeps.mk b/share/mk/sys.dirdeps.mk
index 1e3363c22339..4d2dfa8416fa 100644
--- a/share/mk/sys.dirdeps.mk
+++ b/share/mk/sys.dirdeps.mk
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: BSD-2-Clause
 #
-# $Id: sys.dirdeps.mk,v 1.14 2024/02/25 19:12:13 sjg Exp $
+# $Id: sys.dirdeps.mk,v 1.15 2024/04/18 17:18:31 sjg Exp $
 #
 #	@(#) Copyright (c) 2012-2023, Simon J. Gerraty
 #
@@ -196,11 +196,10 @@ RELSRCTOP?= ${RELTOP}
 # just in case
 .MAKE.DEPENDFILE ?= Makefile.depend
 
-.if ${.MAKE.LEVEL} > 0
-# Makefile.depend* also get read at level 1+
-# and often refer to DEP_MACHINE etc,
-# so ensure DEP_* (for TARGET_SPEC_VARS anyway) are set
-.for V in ${TARGET_SPEC_VARS}
-DEP_$V = ${$V}
+# Makefile.depend* often refer to DEP_MACHINE etc,
+# we need defaults for both first include in a leaf dir
+# and when level > 0
+# so ensure DEP_* for TARGET_SPEC_VARS and RELDIR are set
+.for V in ${TARGET_SPEC_VARS} RELDIR
+DEP_$V ?= ${$V}
 .endfor
-.endif