From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOWFA-00011E-EZ for qemu-devel@nongnu.org; Fri, 14 Mar 2014 13:50:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOWF2-0000Tf-Hg for qemu-devel@nongnu.org; Fri, 14 Mar 2014 13:50:04 -0400 Received: from v220110690675601.yourvserver.net ([37.221.199.173]:39179) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOWF2-0000TQ-BI for qemu-devel@nongnu.org; Fri, 14 Mar 2014 13:49:56 -0400 Message-ID: <53234132.8040301@weilnetz.de> Date: Fri, 14 Mar 2014 18:49:38 +0100 From: Stefan Weil MIME-Version: 1.0 References: <1394786300-18017-1-git-send-email-famz@redhat.com> In-Reply-To: <1394786300-18017-1-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Makefile: Don't find and delete when $(DSOSUF) is empty in "make clean" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Paolo Bonzini , stefanha@redhat.com, Michael Roth , Anthony Liguori , Peter Maydell Am 14.03.2014 09:38, schrieb Fam Zheng: > DANGEROUS: don't try it before you read to the end. > > A first "make distclean" will unset $(DSOSUF), a following "make > distclean" or "make clean" will find all the files and delete it. > > Including all the files in the .git directory! If you only use out-of-tree build, you are safe here. Maybe we should no longer support in-tree builds. Personally, I nearly never use them. > Fix it by only do it when $(DSOSUF) is not empty. s/do/doing/ > Signed-off-by: Fam Zheng > --- > Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index bd9cd4f..0666d6e 100644 > --- a/Makefile > +++ b/Makefile > @@ -267,7 +267,7 @@ clean: > rm -f qemu-options.def > find . -name '*.[oda]' -type f -exec rm -f {} + > find . -name '*.l[oa]' -type f -exec rm -f {} + > - find . -name '*$(DSOSUF)' -type f -exec rm -f {} + > + if test -n "$(DSOSUF)"; then find . -name '*$(DSOSUF)' -type f -exec rm -f {} +; fi > find . -name '*.mo' -type f -exec rm -f {} + > rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~ > rm -f fsdev/*.pod No, I think it is still too dangerous to use a macro here. There are only two valid possibilities, so it's easy to name them explicitly: find -name "*.dll" -o -name "*.so" Is there a good reason why rm is called with option -f? Normally, -f should not be needed when cleaning generated files because those files are not write protected. The only other reason for -f would be suppressing an error message if rm tries to remove a non existing files, but that does not apply here. I'd also combine all find statements in a single statement. It is not necessary to parse the directory tree several times. That can be done in a separate patch. Regards, Stefan