From 89bd07e927051c2d806de8e735aa1de750fdecd5 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Thu, 2 Nov 2017 20:45:04 +0000 Subject: [PATCH] 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 --- Makefile.inc1 | 2 ++ share/mk/local.dirdeps.mk | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index 3c5e0188a813..4e8a8fd6493b 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -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 diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk index 45581da7c0a7..85f7bbf052c0 100644 --- a/share/mk/local.dirdeps.mk +++ b/share/mk/local.dirdeps.mk @@ -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