From ddea54a714039e6efe57b51b78a63723d9eb3093 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 7 Jul 2011 13:44:26 -0700 Subject: Makefile: fix "make clean" for cross-compile 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 Acked-by: Mike Frysinger Signed-off-by: Artem Bityutskiy --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1f3e270..bc3ee6d 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 $(BUILDDIR)/include/version.h $(MAKE) -C $(TESTS) clean -- cgit v1.2.3