[PATCH 1/3] Makefile: fix "version.h" build for cross-compiling

Brian Norris computersforpeace at gmail.com
Thu Jul 7 16:44:25 EDT 2011


When using "make CROSS=mipsel-linux-", I get the following errors:

/bin/sh: /home/norris/git/mtd-utils/mipsel-linux/include/version.h.tmp: No such file or directory
make: *** [/home/norris/git/mtd-utils/mipsel-linux/include/version.h.tmp] Error 1

So instead of "building" our version.h within $(BUILDIR), we should
just build it in the main source directory, as it isn't architecture-
specific or anything. Hopefully that doesn't "break the rules" of our
cross-compilation setup...

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

diff --git a/Makefile b/Makefile
index afbe201..7c20ea5 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ TARGETS = $(BINS)
 TARGETS += lib/libmtd.a
 TARGETS += ubi-utils/libubi.a
 
-OBJDEPS = $(BUILDDIR)/include/version.h
+OBJDEPS = include/version.h
 
 include common.mk
 
@@ -53,7 +53,7 @@ endif
 	find $(BUILDDIR)/ -xdev \
 		'(' -name '*.[ao]' -o -name '.*.c.dep' ')' \
 		-exec rm -f {} +
-	rm -f $(BUILDDIR)/include/version.h
+	rm -f include/version.h
 	$(MAKE) -C $(TESTS) clean
 
 install:: ${BINS} ${SCRIPTS}
@@ -68,9 +68,9 @@ tests::
 cscope:
 	cscope -bR
 
-$(BUILDDIR)/include/version.h: $(BUILDDIR)/include/version.h.tmp
+include/version.h: include/version.h.tmp
 	$(Q)cmp -s $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@
-$(BUILDDIR)/include/version.h.tmp:
+include/version.h.tmp:
 	$(Q)echo '#define VERSION "$(VERSION)"' > $@
 
 #
-- 
1.7.0.4





More information about the linux-mtd mailing list