depend-cleanup.sh: Simplify the logic, and clean bootstrap tools.

* There's no need to check if the file exists before grepping it; if it does not exist, grep will fail, which is what we want.  Just redirect the error message to /dev/null.
* There's no need to split the .o and .pico cases; the bodies are identical, so combine the conditions.  Use a glob to avoid a false negative if one exists but not the other.
* Also run depend-cleanup.sh on the bootstrap build tree.  This unbreaks the build after 29c5f8bf9a.

Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D38447
This commit is contained in:
Dag-Erling Smørgrav 2023-02-08 23:58:51 +01:00
parent 847967bc4e
commit 0dfaefa975
2 changed files with 5 additions and 12 deletions

View File

@ -1062,6 +1062,9 @@ _bootstrap-tools:
@echo "--------------------------------------------------------------"
@echo ">>> stage 1.2: bootstrap tools"
@echo "--------------------------------------------------------------"
.if ${MK_CLEAN} != "yes"
${_+_}cd ${.CURDIR}; ${BMAKE} _NO_INCLUDE_COMPILERMK=t _cleanobj_fast_depend_hack
.endif
${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
mkdir -p ${WORLDTMP}/usr ${WORLDTMP}/lib/casper ${WORLDTMP}/lib/geom \
${WORLDTMP}/bin

View File

@ -28,18 +28,8 @@ fi
# $3 source extension
clean_dep()
{
if [ -e "$OBJTOP"/$1/.depend.$2.pico ] && \
egrep -qw "$2\.$3" "$OBJTOP"/$1/.depend.$2.pico; then \
echo "Removing stale dependencies and objects for $2.$3"; \
rm -f \
"$OBJTOP"/$1/.depend.$2.* \
"$OBJTOP"/$1/$2.*o \
"$OBJTOP"/obj-lib32/$1/.depend.$2.* \
"$OBJTOP"/obj-lib32/$1/$2.*o
fi
if [ -e "$OBJTOP"/$1/.depend.$2.o ] && \
egrep -qw "$2\.$3" "$OBJTOP"/$1/.depend.$2.o; then \
echo "Removing stale dependencies and objects for $2.$3"; \
if egrep -qw "$2\.$3" "$OBJTOP"/$1/.depend.$2.*o 2>/dev/null; then
echo "Removing stale dependencies and objects for $2.$3"
rm -f \
"$OBJTOP"/$1/.depend.$2.* \
"$OBJTOP"/$1/$2.*o \