summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2014-05-02 01:39:30 +0000
committersjg <sjg@FreeBSD.org>2014-05-02 01:39:30 +0000
commit1911be667b76fa324ee9950e886885c6e4cc6c79 (patch)
tree6e4ff3af24186e91c99e6f7566a86ea8df73a4b6 /share
parent035dac0445f8b533a641d0c0e67469d93df434d5 (diff)
downloadFreeBSD-src-1911be667b76fa324ee9950e886885c6e4cc6c79.zip
FreeBSD-src-1911be667b76fa324ee9950e886885c6e4cc6c79.tar.gz
Add 'destroy' target to efficiently rm -rf objtree
Reviewed by: obrien
Diffstat (limited to 'share')
-rw-r--r--share/mk/bsd.obj.mk25
1 files changed, 25 insertions, 0 deletions
diff --git a/share/mk/bsd.obj.mk b/share/mk/bsd.obj.mk
index 38afcde..d2a6bd7 100644
--- a/share/mk/bsd.obj.mk
+++ b/share/mk/bsd.obj.mk
@@ -146,4 +146,29 @@ cleandir: cleanobj
.include <bsd.subdir.mk>
+.if make(destroy*) && defined(OBJROOT)
+# this is much faster and more reliable than cleaning.
+
+# just in case we are playing games with these...
+_OBJDIR?= ${.OBJDIR}
+_CURDIR?= ${.CURDIR}
+
+destroy-arch: .NOMETA
+.if ${_OBJDIR} != ${_CURDIR}
+ cd ${_CURDIR} && rm -rf ${_OBJDIR}
+.endif
+
+destroy: destroy-all
+destroy-all:
+
+.if ${_OBJDIR} != ${_CURDIR}
+.for m in ${ALL_MACHINE_LIST}
+destroy-all: destroy.$m
+destroy.$m: .NOMETA
+ cd ${_CURDIR} && rm -rf ${OBJROOT}$m*/${RELDIR:N.}
+.endfor
+.endif
+
+.endif
+
.endif # !target(__<bsd.obj.mk>__)
OpenPOWER on IntegriCloud