Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk Use :Q to deal with the case that CLEANFILES or CLE...



details:   https://anonhg.NetBSD.org/src/rev/c163e2efd1b0
branches:  trunk
changeset: 771477:c163e2efd1b0
user:      apb <apb%NetBSD.org@localhost>
date:      Tue Nov 22 18:25:48 2011 +0000

description:
Use :Q to deal with the case that CLEANFILES or CLEANDIRFILES
contains quoted substrings (such as file names with spaces).
Problem reported by Joseph Koshy, who also provided the
important part of the fix.

diffstat:

 share/mk/bsd.clean.mk |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 0ae2c1ac5809 -r c163e2efd1b0 share/mk/bsd.clean.mk
--- a/share/mk/bsd.clean.mk     Tue Nov 22 16:56:29 2011 +0000
+++ b/share/mk/bsd.clean.mk     Tue Nov 22 18:25:48 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.clean.mk,v 1.4 2011/10/05 12:34:04 apb Exp $
+# $NetBSD: bsd.clean.mk,v 1.5 2011/11/22 18:25:48 apb Exp $
 
 # <bsd.clean.mk>
 #
@@ -44,18 +44,27 @@
 # If the list of files is empty, then the commands
 # reduce to "true", with an "@" prefix to prevent echoing.
 #
+# The use of :M* is needed to handle the case that CLEANFILES
+# or CLEANDIRFILES is not completely empty but contains spaces.
+# This can easily happen when CLEANFILES or CLEANDIRFILES is set
+# from other variables that happen to be empty.)
+#
+# The use of :Q is needed to handle the case that CLEANFILES
+# or CLEANDIRFILES contains quoted strings, such as
+# CLEANFILES = "filename with spaces".
+#
 __cleanuse: .USE
 .if 0  # print "# clean CLEANFILES" for debugging
-       ${"${.ALLSRC:@v@${${v}:M*}@}" == "":?@true:${_MKMSG} \
+       ${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?@true:${_MKMSG} \
                "clean" ${.ALLSRC} }
 .endif
 .for _d in ${"${.OBJDIR}" == "${.CURDIR}" || "${MKCLEANSRC}" == "no" \
                :? ${.OBJDIR} \
                :  ${.OBJDIR} ${.CURDIR} }
-       ${"${.ALLSRC:@v@${${v}:M*}@}" == "":?@true: \
+       ${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?@true: \
            (cd ${_d} && rm -f ${.ALLSRC:@v@${${v}}@} || true) }
 .if "${MKCLEANVERIFY}" == "yes"
-       @${"${.ALLSRC:@v@${${v}:M*}@}" == "":?true: \
+       @${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?true: \
            bad="\$(cd ${_d} && ls -d ${.ALLSRC:@v@${${v}}@} 2>/dev/null)"; \
            if test -n "\$bad"; then \
                echo "Failed to remove files from ${_d}:" ; \



Home | Main Index | Thread Index | Old Index