Received: from eggs.gnu.org ([2001:4830:134:3::10]:40596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPMSZ-0008RU-DE for qemu-devel@nongnu.org; Sun, 16 Mar 2014 21:35:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPMST-0005Ok-EH for qemu-devel@nongnu.org; Sun, 16 Mar 2014 21:35:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPMST-0005Og-6B for qemu-devel@nongnu.org; Sun, 16 Mar 2014 21:35:17 -0400 From: Fam Zheng Date: Mon, 17 Mar 2014 09:35:22 +0800 Message-Id: <1395020122-4957-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v2] Makefile: Fix "make clean" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Fam Zheng , Anthony Liguori , Stefan Weil , Michael Roth , stefanha@redhat.com, Paolo Bonzini This fixes a dangerous bug: "make clean" after "make distclean" will delete every single file including those under .git, if you do in-tree build! Rationale: A first "make distclean" will unset $(DSOSUF), a following "make distclean" or "make clean" will find all the files and delete it. Fix it by explicitly typing the file extensions here, and combine multiple find invocations into one. Signed-off-by: Fam Zheng --- v2: Improve as Stefan Weil suggested. Signed-off-by: Fam Zheng --- Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index bd9cd4f..ec74039 100644 --- a/Makefile +++ b/Makefile @@ -265,10 +265,7 @@ clean: # avoid old build problems by removing potentially incorrect old files rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h 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 {} + - find . -name '*.mo' -type f -exec rm -f {} + + find . \( -name '*.l[oa]' -o -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} + rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~ rm -f fsdev/*.pod rm -rf .libs */.libs -- 1.9.0