diff mbox

[2/3] Makefile: fix "make clean" for cross-compile

Message ID 1310071467-9017-2-git-send-email-computersforpeace@gmail.com
State New, archived
Headers show

Commit Message

Brian Norris July 7, 2011, 8:44 p.m. UTC
When cross-compiling (make CROSS=mipsel-linux-), I get this error:

rm -rf /home/norris/git/mtd-utils/mipsel-linux
find /home/norris/git/mtd-utils/mipsel-linux/ -xdev \
		'(' -name '*.[ao]' -o -name '.*.c.dep' ')' \
		-exec rm -f {} +
find: `/home/norris/git/mtd-utils/mipsel-linux/': No such file or directory
make: *** [clean] Error 1

Now, for cross-compiling, we've already deleted the $(BUILDDIR), so we
should check this before cleaning individual objects with "find."

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 Makefile |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

Comments

Mike Frysinger July 7, 2011, 8:48 p.m. UTC | #1
Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 7c20ea5..78f5f9f 100644
--- a/Makefile
+++ b/Makefile
@@ -50,9 +50,11 @@  ifneq ($(BUILDDIR),$(CURDIR))
 endif
 endif
 endif
-	find $(BUILDDIR)/ -xdev \
-		'(' -name '*.[ao]' -o -name '.*.c.dep' ')' \
-		-exec rm -f {} +
+	@if test -d "$(BUILDDIR)/"; then \
+		find $(BUILDDIR)/ -xdev \
+			'(' -name '*.[ao]' -o -name '.*.c.dep' ')' \
+			-exec rm -f {} + ; \
+	fi
 	rm -f include/version.h
 	$(MAKE) -C $(TESTS) clean