git: 7386c0675c89 - main - Update dirdpes.mk et al
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Jun 2026 20:30:15 UTC
The branch main has been updated by sjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=7386c0675c89b12cac1da8e16fc8fc32eb42ca07
commit 7386c0675c89b12cac1da8e16fc8fc32eb42ca07
Author: Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2026-06-19 20:29:25 +0000
Commit: Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2026-06-19 20:29:25 +0000
Update dirdpes.mk et al
Update to latest dirdeps related makefiles.
dirdeps.mk tweaks useful for universe among other corner cases.
also additional filtering for bogus paths ending in /
gendirdeps.mk allow more debugging
also additional filtering for bogus paths ending in /
install-new.mk fix bug when isPOSIX_SHELL is true
meta2deps.?? handle file names with spaces by ignoring them
Reviewed by: stevek
Differential Revision: https://reviews.freebsd.org/D57683
---
share/mk/dirdeps.mk | 28 +++++++++++++++++++---------
share/mk/gendirdeps.mk | 14 ++++++++++----
share/mk/install-new.mk | 4 ++--
share/mk/meta2deps.py | 25 ++++++++++++++++---------
share/mk/meta2deps.sh | 15 +++++++++++++--
5 files changed, 60 insertions(+), 26 deletions(-)
diff --git a/share/mk/dirdeps.mk b/share/mk/dirdeps.mk
index b281d15ec346..abd3407eddf4 100644
--- a/share/mk/dirdeps.mk
+++ b/share/mk/dirdeps.mk
@@ -1,8 +1,8 @@
-# $Id: dirdeps.mk,v 1.175 2025/01/05 01:16:19 sjg Exp $
+# $Id: dirdeps.mk,v 1.178 2026/05/09 20:33:46 sjg Exp $
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2010-2023, Simon J. Gerraty
+# Copyright (c) 2010-2026, Simon J. Gerraty
# Copyright (c) 2010-2018, Juniper Networks, Inc.
# All rights reserved.
#
@@ -322,6 +322,12 @@ _debug_search = 1
.else
_debug_search = 0
.endif
+.if ${DEBUG_DIRDEPS:Mno*recurse} != ""
+BUILD_DIRDEPS_RECURSE = no
+.endif
+.if ${DEBUG_DIRDEPS:M-V} != ""
+_V_READ_DIRDEPS = yes
+.endif
# First off, we want to know what ${MACHINE} to build for.
# This can be complicated if we are using a mixture of ${MACHINE} specific
@@ -585,6 +591,11 @@ BUILD_DIRDEPS_MAKEFILE ?=
BUILD_DIRDEPS_OVERRIDES ?=
BUILD_DIRDEPS_TARGETS ?= ${.TARGETS}
+# sometimes we temporarily want to block updating of DIRDEPS_CACHE
+.if ${MK_UPDATE_DIRDEPS_CACHE:Uyes} == "no" && exists(${DIRDEPS_CACHE})
+STATIC_DIRDEPS_CACHE ?= ${DIRDEPS_CACHE}
+.endif
+
.if ${DIRDEPS_CACHE} != ${STATIC_DIRDEPS_CACHE:Uno} && ${DIRDEPS_CACHE:M${SRCTOP}/*} == ""
# export this for dirdeps-cache-update.mk
DYNAMIC_DIRDEPS_CACHE := ${DIRDEPS_CACHE}
@@ -715,12 +726,12 @@ DEP_DIRDEPS_BUILD_DIR_FILTER = u
.endif
# this is what we start with
-__depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:C,//+,/,g:O:u:@d@${SRCTOP}/$d@}
+__depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:C,//+,/,g:S,/$,,:O:u:@d@${SRCTOP}/$d@}
# some entries may be qualified with .<machine> or .<target_spec>
# we can tell the unqualified ones easily - because they exist
__unqual_depdirs := ${__depdirs:@d@${exists($d):?$d:}@}
-__qual_depdirs := ${__depdirs:${__unqual_depdirs:Uno:${M_ListToSkip}}}
+__qual_depdirs := ${__depdirs:${__unqual_depdirs:Uno:${M_ListToSkip}}:C,/(\.[^.]*)$,\1,}
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# if it was called out - we likely need it.
@@ -745,16 +756,13 @@ _build_dirs += \
${_machines:Nhost*:@m@${__unqual_depdirs:@d@$d.$m@}@}
# qualify everything now
-.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:}}
+.info _build_dirs=${_build_dirs:S,^${SRCTOP}/,,:${DEBUG_DIRDEPS_LIST_FILTER:U:N/:ts:}}
.endif
.endif # empty DIRDEPS
@@ -791,7 +799,7 @@ dirdeps: ${_build_all_dirs}
${_build_all_dirs}: _DIRDEP_USE
.if ${_debug_reldir}
-.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs:S,^${SRCTOP}/,,:${DEBUG_DIRDEPS_LIST_FILTER:U:N/:ts:}}
+.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_all_dirs:S,^${SRCTOP}/,,:${DEBUG_DIRDEPS_LIST_FILTER:U:N/:ts:}}
.endif
# this builds the dependency graph
@@ -858,6 +866,7 @@ DIRDEPS_EXPORT_VARS =
DEP_EXPORT_VARS =
.endif
+.if ${BUILD_DIRDEPS_RECURSE:Uyes} != "no"
# Now find more dependencies - and recurse.
.for d in ${_build_all_dirs}
.if !target(_dirdeps_checked.$d)
@@ -909,6 +918,7 @@ DIRDEPS =
.endif
.endif
.endfor
+.endif
.endif # -V
.endif # BUILD_DIRDEPS
diff --git a/share/mk/gendirdeps.mk b/share/mk/gendirdeps.mk
index ab1786f3603f..e5f536441a8d 100644
--- a/share/mk/gendirdeps.mk
+++ b/share/mk/gendirdeps.mk
@@ -1,8 +1,8 @@
-# $Id: gendirdeps.mk,v 1.54 2025/08/12 21:36:43 sjg Exp $
+# $Id: gendirdeps.mk,v 1.56 2026/06/19 18:57:57 sjg Exp $
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2011-2025, Simon J. Gerraty
+# Copyright (c) 2011-2026, Simon J. Gerraty
# Copyright (c) 2010-2018, Juniper Networks, Inc.
# All rights reserved.
#
@@ -87,6 +87,12 @@ _debug.gendirdeps = 0
all:
+.if ${_debug.gendirdeps}
+.if ${DEBUG_GENDIRDEPS:M-d*}
+.MAKEFLAGS: ${DEBUG_GENDIRDEPS:M-d*}
+.endif
+.endif
+
_CURDIR ?= ${.CURDIR}
_OBJDIR ?= ${.OBJDIR}
_OBJTOP ?= ${OBJTOP}
@@ -331,7 +337,7 @@ DIRDEPS += \
# what modifiers do we allow in GENDIRDEPS_FILTER
GENDIRDEPS_FILTER_MASK += @CMNS
-DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:M[${GENDIRDEPS_FILTER_MASK:O:u:ts}]*:ts:}:C,//+,/,g:O:u}
+DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:M[${GENDIRDEPS_FILTER_MASK:O:u:ts}]*:ts:}:C,//+,/,g:S,/$,,:C,/(\.[^.]+)$,\1,:O:u}
.if ${_debug.gendirdeps}
.info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS}
@@ -353,7 +359,7 @@ src_dirdep_list = \
SRC_DIRDEPS = \
${src_dirdep_list:N${RELDIR}:N${RELDIR}/*:C,(/h)/.*,,}
-SRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:C,//+,/,g:O:u}
+SRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:C,//+,/,g:S,/$,,:C,/(\.[^.]+)$,\1,:O:u}
# if you want to capture SRC_DIRDEPS in .MAKE.DEPENDFILE put
# SRC_DIRDEPS_FILE = ${_DEPENDFILE}
diff --git a/share/mk/install-new.mk b/share/mk/install-new.mk
index 2fb9725a7a47..001460439ca8 100644
--- a/share/mk/install-new.mk
+++ b/share/mk/install-new.mk
@@ -1,4 +1,4 @@
-# $Id: install-new.mk,v 1.9 2025/11/19 17:44:15 sjg Exp $
+# $Id: install-new.mk,v 1.10 2026/06/19 19:47:03 sjg Exp $
#
# @(#) Copyright (c) 2009, Simon J. Gerraty
#
@@ -47,7 +47,7 @@ InstallNew= ${CmpCpMv}; InstallNew() { \
for new in "$$@"; do \
if test $$_t $$new; then \
if ${isPOSIX_SHELL:Ufalse}; then \
- target=$${new%.new}; \
+ target=$${new%.new*}; \
else \
target=`expr $$new : '\(.*\).new'`; \
fi; \
diff --git a/share/mk/meta2deps.py b/share/mk/meta2deps.py
index 77ed86397a0f..a5a64dba3290 100755
--- a/share/mk/meta2deps.py
+++ b/share/mk/meta2deps.py
@@ -39,7 +39,7 @@ We only pay attention to a subset of the information in the
SPDX-License-Identifier: BSD-2-Clause
RCSid:
- $Id: meta2deps.py,v 1.54 2025/07/24 16:05:48 sjg Exp $
+ $Id: meta2deps.py,v 1.56 2026/05/22 00:33:26 sjg Exp $
Copyright (c) 2011-2025, Simon J. Gerraty
Copyright (c) 2011-2017, Juniper Networks, Inc.
@@ -446,7 +446,7 @@ class MetaFile:
version = 0 # unknown
if name:
- self.name = name;
+ self.name = name
if file:
f = file
cwd = self.last_dir = self.cwd
@@ -515,6 +515,12 @@ class MetaFile:
if self.debug > 2:
print('op={} elen={} wlen={} line="{}"'.format(w[0], elen, wlen, line.strip()), file=self.debug_out)
if wlen != elen:
+ if wlen > elen and w[0] in 'CELMRW':
+ # It could just be spaces in pathname.
+ # More trouble than its worth, just skip it.
+ if self.debug > 0:
+ print('Skipping: wrong number of words: expected {} got {} in: {}'.format(elen, wlen, line), file=self.debug_out)
+ continue
raise AssertionError('corrupted filemon data: wrong number of words: expected {} got {} in: {}'.format(elen, wlen, line))
pid = int(w[1])
@@ -669,7 +675,7 @@ class MetaFile:
return
if os.path.isdir(path):
if op in 'RW':
- self.last_dir = path;
+ self.last_dir = path
if self.debug > 1:
print("ldir=", self.last_dir, file=self.debug_out)
return
@@ -703,7 +709,7 @@ class MetaFile:
self.seenit(dir)
-def main(argv, klass=MetaFile, xopts='', xoptf=None):
+def main(argv, klass=MetaFile, xopts='', xoptf=None, conf=None):
"""Simple driver for class MetaFile.
Usage:
@@ -743,11 +749,12 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
except:
pass
- conf = {
- 'SRCTOPS': [],
- 'OBJROOTS': [],
- 'EXCLUDES': [],
- }
+ if not conf:
+ conf = {}
+
+ for k in ['EXCLUDES', 'OBJROOTS', 'SRCTOPS']:
+ if k not in conf:
+ conf[k] = []
conf['SB'] = os.getenv('SB', '')
diff --git a/share/mk/meta2deps.sh b/share/mk/meta2deps.sh
index 293ebdab6e7c..454b8eeb861c 100755
--- a/share/mk/meta2deps.sh
+++ b/share/mk/meta2deps.sh
@@ -77,7 +77,7 @@
# RCSid:
-# $Id: meta2deps.sh,v 1.26 2025/12/08 17:34:02 sjg Exp $
+# $Id: meta2deps.sh,v 1.27 2026/05/22 00:33:26 sjg Exp $
# SPDX-License-Identifier: BSD-2-Clause
#
@@ -162,6 +162,10 @@ error() {
exit 1
}
+warning() {
+ echo "WARNING: $@" >&2
+}
+
meta2deps() {
DPDEPS=
SRCTOPS=$SRCTOP
@@ -273,8 +277,15 @@ meta2deps() {
;;
\#*) ;; # ok
[LM],) error "missing path2 in: '$op $pid $path'";;
- [LMX],*" "*) error "wrong number of words in: '$op $pid $path $path2'";;
+ [LMX],*" "*)
+ warning "wrong number of words in: '$op $pid $path $path2'"
+ continue
+ ;;
*,|[LMX],*) ;; # ok
+ [CELMRW],*)
+ warning "wrong number of words in: '$op $pid $path $path2'"
+ continue
+ ;;
*) error "wrong number of words in: '$op $pid $path $path2'";;
esac
# we track cwd and ldir (of interest) per pid