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

Mike Frysinger vapier.adi at gmail.com
Thu Jul 7 17:12:16 EDT 2011


On Thu, Jul 7, 2011 at 17:09, Brian Norris wrote:
> On Thu, Jul 7, 2011 at 1:48 PM, Mike Frysinger wrote:
>> i dont think it's just a matter of "diff build dir for diff
>> toolchains, so common version.h is ok".  it's a matter of "building
>> out of tree should build out of tree".
>
> OK, but what is the point of in- vs. out-of-tree? So that we can have
> a readonly source directory where the mtd-utils code stays?

this one imo, but maybe Artem can speak to the origins (which predate
my contributions)

>> i think the fix to your problem is:
>>  $(BUILDDIR)/include/version.h.tmp
>> +    $(Q)mkdir -p $(dir $@)
>>       $(Q)echo '#define VERSION "$(VERSION)"' > $@
>
> Except that gives this error:
>  CC      ftl_format.o
>  CC      lib/libmtd.o
> In file included from lib/libmtd.c:40:0:
> ./include/common.h:28:21: fatal error: version.h: No such file or directory
> compilation terminated.
> make: *** [/home/norris/git/mtd-utils/mipsel-linux/lib/libmtd.o] Error 1
>
> Really, the build system is setup to look for headers in-tree, not
> out-of-tree. I'm not sure a good way to fix this other than to
> generate that header in-tree...any better suggestions?

top level Makefile:
-CPPFLAGS += -I./include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
+CPPFLAGS += -I./include -I$(BUILDDIR)/include -I./ubi-utils/include
$(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
-mike



More information about the linux-mtd mailing list