summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-11-09 23:36:46 +0000
committerbdrewery <bdrewery@FreeBSD.org>2015-11-09 23:36:46 +0000
commitd7fb1920af601dddc213390c95e86396907515e1 (patch)
treedd2c0c4b8315b8d827ee7b57be4b66ffe99eb40b
parent9d36f45b8f93d31c987b27e2efcbadb63e92b570 (diff)
downloadFreeBSD-src-d7fb1920af601dddc213390c95e86396907515e1.zip
FreeBSD-src-d7fb1920af601dddc213390c95e86396907515e1.tar.gz
Move 'make cleandir' from Makefile to Makefile.inc1.
This leads the way for fixing cross-build cleanup, and eventually replacing 'cleandir' with it during the build. Sponsored by: EMC / Isilon Storage Division MFC after: 2 weeks
-rw-r--r--Makefile34
-rw-r--r--Makefile.inc130
2 files changed, 31 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index ce4c0f6..9d64e50 100644
--- a/Makefile
+++ b/Makefile
@@ -113,7 +113,7 @@
TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
check-old check-old-dirs check-old-files check-old-libs \
- checkdpadd clean cleandepend cleandir \
+ checkdpadd clean cleandepend cleandir cleanworld \
delete-old delete-old-dirs delete-old-files delete-old-libs \
depend distribute distributekernel distributekernel.debug \
distributeworld distrib-dirs distribution doxygen \
@@ -212,38 +212,6 @@ buildworld: upgrade_checks
.endif
#
-# This 'cleanworld' target is not included in TGTS, because it is not a
-# recursive target. All of the work for it is done right here. It is
-# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
-# created by bsd.obj.mk, except that we don't want to .include that file
-# in this makefile.
-#
-# In the following, the first 'rm' in a series will usually remove all
-# files and directories. If it does not, then there are probably some
-# files with file flags set, so this unsets them and tries the 'rm' a
-# second time. There are situations where this target will be cleaning
-# some directories via more than one method, but that duplication is
-# needed to correctly handle all the possible situations. Removing all
-# files without file flags set in the first 'rm' instance saves time,
-# because 'chflags' will need to operate on fewer files afterwards.
-#
-BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
-cleanworld:
-.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
-.if exists(${BW_CANONICALOBJDIR}/)
- -rm -rf ${BW_CANONICALOBJDIR}/*
- -chflags -R 0 ${BW_CANONICALOBJDIR}
- rm -rf ${BW_CANONICALOBJDIR}/*
-.endif
- # To be safe in this case, fall back to a 'make cleandir'
- ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
-.else
- -rm -rf ${.OBJDIR}/*
- -chflags -R 0 ${.OBJDIR}
- rm -rf ${.OBJDIR}/*
-.endif
-
-#
# Handle the user-driven targets, using the source relative mk files.
#
diff --git a/Makefile.inc1 b/Makefile.inc1
index c49bc4c..d6942f0 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -2205,6 +2205,36 @@ builddtb:
###############
+# cleanworld
+# In the following, the first 'rm' in a series will usually remove all
+# files and directories. If it does not, then there are probably some
+# files with file flags set, so this unsets them and tries the 'rm' a
+# second time. There are situations where this target will be cleaning
+# some directories via more than one method, but that duplication is
+# needed to correctly handle all the possible situations. Removing all
+# files without file flags set in the first 'rm' instance saves time,
+# because 'chflags' will need to operate on fewer files afterwards.
+#
+# It is expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
+# created by bsd.obj.mk, except that we don't want to .include that file
+# in this makefile.
+#
+BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
+cleanworld: .PHONY
+.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
+.if exists(${BW_CANONICALOBJDIR}/)
+ -rm -rf ${BW_CANONICALOBJDIR}/*
+ -chflags -R 0 ${BW_CANONICALOBJDIR}
+ rm -rf ${BW_CANONICALOBJDIR}/*
+.endif
+ # To be safe in this case, fall back to a 'make cleandir'
+ ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir
+.else
+ -rm -rf ${.OBJDIR}/*
+ -chflags -R 0 ${.OBJDIR}
+ rm -rf ${.OBJDIR}/*
+.endif
+
.if defined(TARGET) && defined(TARGET_ARCH)
.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
OpenPOWER on IntegriCloud