Add a 'realclean' target, which simply and quickly removes everything

that was built in previous 'make buildworld' and 'make buildkernel'.  The
target knows enough to run a 'chflags -R 0' and a second 'rm' if the first
'rm' ran into any errors while removing files.

Suggested by:	email with Richard Coleman Re: upcoming 64b-time_t changes.
Reviewed by:	imp, marcel, and others on -hackers
MFC after:	1 week
This commit is contained in:
Garance A Drosehn 2004-02-16 20:18:25 +00:00
parent 5193980ced
commit 2047c5d32e

View File

@ -103,6 +103,21 @@ ${TGTS}: upgrade_checks
buildworld: upgrade_checks
.endif
#
# This 'realclean' target is not included in TGTS, because it is not
# a recursive target. All of the work for it is done right here.
# The first 'rm' will usually remove all files and directories. If
# it does not, then there are probably some files with chflags set.
# Unset all special chflags, and try the 'rm' a second time.
realclean :
-rm -Rf ${.OBJDIR}/* 2>/dev/null
@-if [ "`echo ${.OBJDIR}/*`" != "${.OBJDIR}/*" ] ; then \
echo "chflags -R 0 ${.OBJDIR}/*" ; \
chflags -R 0 ${.OBJDIR}/* ; \
echo "rm -Rf ${.OBJDIR}/*" ; \
rm -Rf ${.OBJDIR}/* ; \
fi
#
# Handle the user-driven targets, using the source relative mk files.
#