DIRDEPS_BUILD: Cleanup leftover WORLDTMP files.

This will force any existing objects to rebuild if their .meta
files reference files from WORLDTMP.  This is a problem after
the UNIFIED_OBJDIR effort caused buildworld and DIRDEPS_BUILD
to share an OBJDIR.  Without cleaning these files the
Makefile.depend files end up with odd tmp/legacy/... entries
since some bootstrap-tools linger from there and otherwise
don't rebuild.  Removing the files causes anything having
used WORLDTMP to rebuild.

Sponsored by:	Dell EMC Isilon
This commit is contained in:
Bryan Drewery 2017-11-02 20:45:04 +00:00
parent e22fef7dc1
commit 89bd07e927
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325342
2 changed files with 16 additions and 0 deletions

View File

@ -815,6 +815,7 @@ _worldtmp: .PHONY
@echo "--------------------------------------------------------------"
.if !defined(NO_CLEAN)
rm -rf ${WORLDTMP}
@mkdir -p ${WORLDTMP}
.else
.if exists(${WORLDTMP})
@echo ">>> Deleting stale files in build tree..."
@ -831,6 +832,7 @@ _worldtmp: .PHONY
.endfor
.endif # ${USING_SYSTEM_COMPILER} == "yes"
.endif # !defined(NO_CLEAN)
@touch ${WORLDTMP}/${.TARGET}
.for _dir in \
lib lib/casper usr legacy/bin legacy/usr

View File

@ -49,6 +49,20 @@ DIRDEPS_FILTER.host = \
DIRDEPS_FILTER+= \
Nbin/cat.host \
${DIRDEPS_FILTER.xtras:U}
# Cleanup a buildworld's WORLDTMP so that any files generated from it
# or using it will rebuild with the DIRDEPS SYSROOT. Otherwise existing
# object .meta files may still reference those directories and not be
# rebuilt and lead to incorrect Makefile.depend files due to lack of
# .dirdep files.
.if !defined(NO_CLEANUP_WORLDTMP) && exists(${OBJTOP}/tmp/_worldtmp)
cleanup_worldtmp: .PHONY .NOMETA
@echo "Cleaning leftover WORLDTMP from buildworld."
-rm -rf ${OBJTOP}/tmp/*
-chflags -R 0 ${OBJTOP}/tmp/*
rm -rf ${OBJTOP}/tmp
beforedirdeps: cleanup_worldtmp
.endif
.endif
# reset this each time