aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2025-12-31 13:10:39 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2025-12-31 18:51:14 +0000
commitaa611fa7e835ae77a623cc6d05020f5ee76dc881 (patch)
treeaeb5d6869a420e15a5b7e6d5c212fcd14a938974
parent1d52d5c5372a43655a252880d34088fa56aa2530 (diff)
depend-cleanup.sh: Reduce repetition
MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D54329
-rwxr-xr-xtools/build/depend-cleanup.sh20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
index ff7d4b2a5921..e7b62510a4e5 100755
--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -161,13 +161,13 @@ run()
# $4 optional regex for egrep -w
clean_dep()
{
+ local dirprfx dir
for libcompat in "" $ALL_libcompats; do
- dirprfx=${libcompat:+obj-lib${libcompat}/}
- if egrep -qw "${4:-$2\.$3}" "$OBJTOP"/$dirprfx$1/.depend.$2.*o 2>/dev/null; then
+ dirprfx=${libcompat:+obj-lib${libcompat}}
+ dir="${OBJTOP%/}/${dirprfx}/$1"
+ if egrep -qw "${4:-$2\.$3}" "${dir}"/.depend.$2.*o 2>/dev/null; then
echo "Removing stale ${libcompat:+lib${libcompat} }dependencies and objects for $2.$3"
- run rm -fv \
- "$OBJTOP"/$dirprfx$1/.depend.$2.* \
- "$OBJTOP"/$dirprfx$1/$2.*o
+ run rm -fv "${dir}"/.depend.$2.* "${dir}"/$2.*o
fi
done
}
@@ -183,12 +183,13 @@ clean_dep()
# $4 regex for egrep -w
clean_obj()
{
+ local dirprfx dir
for libcompat in "" $ALL_libcompats; do
- dirprfx=${libcompat:+obj-lib${libcompat}/}
- if strings "$OBJTOP"/$dirprfx$1/$2.*o 2>/dev/null | egrep -qw "${4}"; then
+ dirprfx=${libcompat:+obj-lib${libcompat}}
+ dir="${OBJTOP%/}/${dirprfx}/$1"
+ if strings "${dir}"/$2.*o 2>/dev/null | egrep -qw "${4}"; then
echo "Removing stale ${libcompat:+lib${libcompat} }objects for $2.$3"
- run rm -fv \
- "$OBJTOP"/$dirprfx$1/$2.*o
+ run rm -fv "${dir}"/$2.*o
fi
done
}
@@ -221,6 +222,7 @@ extract_src_opts()
extract_obj_opts()
{
+ local fn
for fn; do
if [ -f "${fn}" ]; then
cat "${fn}"