]> www.infradead.org Git - mtd-utils.git/commitdiff
Makefile: fix "make clean" for cross-compile
authorBrian Norris <computersforpeace@gmail.com>
Thu, 7 Jul 2011 20:44:26 +0000 (13:44 -0700)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 20 Jul 2011 05:26:25 +0000 (08:26 +0300)
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>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Makefile

index 1f3e270c94131dbf3f975f22451876cf74a25fcf..bc3ee6da2ce9ed83df27c115220a843b2f9c09e3 100644 (file)
--- 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