git: f69b6410a632 - stable/14 - depend-cleanup.sh: Extend clean_dep to support a custom regex

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Fri, 13 Dec 2024 21:05:08 UTC
The branch stable/14 has been updated by brooks:

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

commit f69b6410a632655896a4c31280604c4af5f1a4ed
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-09-10 17:54:44 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-12-13 20:58:38 +0000

    depend-cleanup.sh: Extend clean_dep to support a custom regex
    
    This will avoid having to duplicate the loop every time the default
    regex isn't good enough, and will be used by upcoming commits.
    
    (cherry picked from commit cc30f4ae6790cf4f19bc4787d7528dfea79ef27a)
---
 tools/build/depend-cleanup.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
index a4d367d7c463..c560a079f43c 100755
--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -89,11 +89,12 @@ run()
 # $1 directory
 # $2 source filename w/o extension
 # $3 source extension
+# $4 optional regex for egrep -w
 clean_dep()
 {
 	for libcompat in "" $ALL_libcompats; do
 		dirprfx=${libcompat:+obj-lib${libcompat}/}
-		if egrep -qw "$2\.$3" "$OBJTOP"/$dirprfx$1/.depend.$2.*o 2>/dev/null; then
+		if egrep -qw "${4:-$2\.$3}" "$OBJTOP"/$dirprfx$1/.depend.$2.*o 2>/dev/null; then
 			echo "Removing stale ${libcompat:+lib${libcompat} }dependencies and objects for $2.$3"
 			run rm -f \
 			    "$OBJTOP"/$dirprfx$1/.depend.$2.* \