Module Name:    src
Committed By:   apb
Date:           Mon Nov 19 16:04:54 UTC 2012

Modified Files:
        src/share/mk: bsd.README bsd.clean.mk

Log Message:
On second thoughts, don't run "rm -rf" in bsd.clean.mk.  Instead,
document that CLEANFILES and CLEANDIRFILES must not contain
directory names.


To generate a diff of this commit:
cvs rdiff -u -r1.307 -r1.308 src/share/mk/bsd.README
cvs rdiff -u -r1.7 -r1.8 src/share/mk/bsd.clean.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.307 src/share/mk/bsd.README:1.308
--- src/share/mk/bsd.README:1.307	Tue Nov 13 22:30:38 2012
+++ src/share/mk/bsd.README	Mon Nov 19 16:04:54 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.307 2012/11/13 22:30:38 pooka Exp $
+#	$NetBSD: bsd.README,v 1.308 2012/11/19 16:04:54 apb Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -904,6 +904,11 @@ or CLEANDIRFILES variables.  For example
 
 	    .include <bsd.clean.mk>
 
+The files listed in CLEANFILES and CLEANDIRFILES must not be
+directories, because the potential risk from running "rm -rf" commands
+in bsd.clean.mk is considered too great.  If you want to recursively
+delete a directory as part of "make clean" or "make cleandir" then you
+need to provide your own target.
 
 =-=-=-=-=   bsd.dep.mk   =-=-=-=-=
 

Index: src/share/mk/bsd.clean.mk
diff -u src/share/mk/bsd.clean.mk:1.7 src/share/mk/bsd.clean.mk:1.8
--- src/share/mk/bsd.clean.mk:1.7	Mon Nov 19 15:14:27 2012
+++ src/share/mk/bsd.clean.mk	Mon Nov 19 16:04:54 2012
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.clean.mk,v 1.7 2012/11/19 15:14:27 apb Exp $
+# $NetBSD: bsd.clean.mk,v 1.8 2012/11/19 16:04:54 apb Exp $
 
 # <bsd.clean.mk>
 #
@@ -15,10 +15,16 @@
 #		the clean target.
 #
 # MKCLEANSRC	Whether or not to clean the source directory
-# 		in addition to the object directory.
+# 		in addition to the object directory.  Defaults to "yes".
 #
 # MKCLEANVERIFY	Whether or not to verify that the file deletion worked.
+#		Defaults to "yes".
 #
+# The files listed in CLEANFILES and CLEANDIRFILES must not be
+# directories, because the potential risk from running "rm -rf" commands
+# in bsd.clean.mk is considered too great.  If you want to recursively
+# delete a directory as part of "make clean" or "make cleandir" then you
+# need to provide your own target.
 
 .if !defined(_BSD_CLEAN_MK_)
 _BSD_CLEAN_MK_=1
@@ -62,7 +68,7 @@ __cleanuse: .USE
 		:? ${.OBJDIR} \
 		:  ${.OBJDIR} ${.CURDIR} }
 	${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?@true: \
-	    (cd ${_d} && rm -rf ${.ALLSRC:@v@${${v}}@} || true) }
+	    (cd ${_d} && rm -f ${.ALLSRC:@v@${${v}}@} || true) }
 .if "${MKCLEANVERIFY}" == "yes"
 	@${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?true: \
 	    bad="\$(cd ${_d} && ls -1d ${.ALLSRC:@v@${${v}}@} 2>/dev/null)"; \

Reply via email to