svn commit: r325342 - in head: . share/mk

Bryan Drewery bdrewery at FreeBSD.org
Thu Nov 2 20:45:06 UTC 2017


Author: bdrewery
Date: Thu Nov  2 20:45:04 2017
New Revision: 325342
URL: https://svnweb.freebsd.org/changeset/base/325342

Log:
  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

Modified:
  head/Makefile.inc1
  head/share/mk/local.dirdeps.mk

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Thu Nov  2 20:28:53 2017	(r325341)
+++ head/Makefile.inc1	Thu Nov  2 20:45:04 2017	(r325342)
@@ -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

Modified: head/share/mk/local.dirdeps.mk
==============================================================================
--- head/share/mk/local.dirdeps.mk	Thu Nov  2 20:28:53 2017	(r325341)
+++ head/share/mk/local.dirdeps.mk	Thu Nov  2 20:45:04 2017	(r325342)
@@ -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


More information about the svn-src-all mailing list