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

login
register
mail settings
Submitter Brian Norris
Date July 7, 2011, 10:16 p.m.
Message ID <1310076977-13593-1-git-send-email-computersforpeace@gmail.com>
Download mbox | patch
Permalink /patch/103737/
State Accepted
Commit 9a38f97d1cebcda5bb49032b1079d383ff34de3d
Headers show

Comments

Brian Norris - July 7, 2011, 10:16 p.m.
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

Fix (suggested by Mike Frysinger): create the directory if it doesn't
exist. Also, $(CC) needs to be able to find the generated header in
$(BUILDDIR)/include.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 Makefile |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Mike Frysinger - July 7, 2011, 10:22 p.m.
Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike

Patch

diff --git a/Makefile b/Makefile
index afbe201..1f3e270 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ 
 
 VERSION = 1.4.5
 
-CPPFLAGS += -I./include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
+CPPFLAGS += -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
 
 ifeq ($(WITHOUT_XATTR), 1)
   CPPFLAGS += -DWITHOUT_XATTR
@@ -71,6 +71,7 @@  cscope:
 $(BUILDDIR)/include/version.h: $(BUILDDIR)/include/version.h.tmp
 	$(Q)cmp -s $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@
 $(BUILDDIR)/include/version.h.tmp:
+	${Q}mkdir -p $(dir $@)
 	$(Q)echo '#define VERSION "$(VERSION)"' > $@
 
 #