From patchwork Fri Oct 7 23:19:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 118385 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 9C571B70F5 for ; Sat, 8 Oct 2011 10:20:02 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B3443291DF; Sat, 8 Oct 2011 01:19:58 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SwodipbR0qk8; Sat, 8 Oct 2011 01:19:58 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C0867290C3; Sat, 8 Oct 2011 01:19:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F3F67290C3 for ; Sat, 8 Oct 2011 01:19:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M4DrvUCe2CbT for ; Sat, 8 Oct 2011 01:19:52 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.67]) by theia.denx.de (Postfix) with ESMTPS id 3A8A2290BE for ; Sat, 8 Oct 2011 01:19:50 +0200 (CEST) Received: from hpaq6.eem.corp.google.com (hpaq6.eem.corp.google.com [172.25.149.6]) by smtp-out.google.com with ESMTP id p97NJcIN006862; Fri, 7 Oct 2011 16:19:38 -0700 Received: from sglass.mtv.corp.google.com (sglass.mtv.corp.google.com [172.22.72.144]) by hpaq6.eem.corp.google.com with ESMTP id p97NJaeo019463; Fri, 7 Oct 2011 16:19:36 -0700 Received: by sglass.mtv.corp.google.com (Postfix, from userid 121222) id C8D88140F4B; Fri, 7 Oct 2011 16:19:35 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 7 Oct 2011 16:19:34 -0700 Message-Id: <1318029574-10895-1-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.3.1 X-System-Of-Record: true Subject: [U-Boot] [PATCH] Move timestamp and version files into 'generated' subdir X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de There is a rather subtle build problem where the build time stamp is not updated for out-of-tree builds if there exists an in-tree build which has a valid timestamp file. So if you do an in-tree build, then an out-of-tree build your timestamp will not change. The correct timestamp_autogenerated.h lives in the object tree, but it is not always found there. The source still lives in the source tree and when compiling version.h, it includes timestamp_autogenerated.h. Since the current directory is always searched first, this will come from the source tree rather than the object tree if it exists there. This affects dependency generation also, which means that common/cmd_version.o will not even be rebuilt if you have ever done an in-tree build. A similar problem exists with the version file. This change moves both files into the 'generated' subdir, which is already used for asm-offsets.h. Then timestamp.h and version.h are updated to include the files from there. There are other places where these generated files are included, but I cannot see why these don't just use the timestamp.h and version.h headers. So this change also tidies that up. I have tested this with in- and out-of-tree builds, but not SPL. I have looked at various other options for fixing this, including sed on the dep files, -I- and -include flags to gcc, but I don't think they can be made to work. Comments welcome. Signed-off-by: Simon Glass --- Makefile | 5 +++-- arch/arm/cpu/armv7/omap-common/spl.c | 3 +-- arch/arm/cpu/armv7/omap-common/spl_mmc.c | 3 +-- arch/arm/cpu/armv7/omap-common/spl_nand.c | 3 +-- drivers/serial/usbtty.h | 2 +- include/timestamp.h | 2 +- include/version.h | 2 +- 7 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index cd6fc8c..f69ea25 100644 --- a/Makefile +++ b/Makefile @@ -30,8 +30,8 @@ U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) else U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION) endif -TIMESTAMP_FILE = $(obj)include/timestamp_autogenerated.h -VERSION_FILE = $(obj)include/version_autogenerated.h +TIMESTAMP_FILE = $(obj)include/generated/timestamp_autogenerated.h +VERSION_FILE = $(obj)include/generated/version_autogenerated.h HOSTARCH := $(shell uname -m | \ sed -e s/i.86/x86/ \ @@ -456,6 +456,7 @@ $(obj)spl/u-boot-spl.bin: depend $(MAKE) -C spl all $(TIMESTAMP_FILE): + @mkdir -p $(dir $@) @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@ @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@ diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c index c76fea6..01fd58a 100644 --- a/arch/arm/cpu/armv7/omap-common/spl.c +++ b/arch/arm/cpu/armv7/omap-common/spl.c @@ -29,8 +29,7 @@ #include #include #include -#include -#include +#include #include #include #include diff --git a/arch/arm/cpu/armv7/omap-common/spl_mmc.c b/arch/arm/cpu/armv7/omap-common/spl_mmc.c index 1d1e50c..6f5b43e 100644 --- a/arch/arm/cpu/armv7/omap-common/spl_mmc.c +++ b/arch/arm/cpu/armv7/omap-common/spl_mmc.c @@ -28,8 +28,7 @@ #include #include #include -#include -#include +#include #include #include diff --git a/arch/arm/cpu/armv7/omap-common/spl_nand.c b/arch/arm/cpu/armv7/omap-common/spl_nand.c index af02a59..38d06b1 100644 --- a/arch/arm/cpu/armv7/omap-common/spl_nand.c +++ b/arch/arm/cpu/armv7/omap-common/spl_nand.c @@ -25,8 +25,7 @@ #include #include #include -#include -#include +#include #include diff --git a/drivers/serial/usbtty.h b/drivers/serial/usbtty.h index a23169a..14961c1 100644 --- a/drivers/serial/usbtty.h +++ b/drivers/serial/usbtty.h @@ -37,7 +37,7 @@ #include #endif -#include +#include /* If no VendorID/ProductID is defined in config.h, pretend to be Linux * DO NOT Reuse this Vendor/Product setup with protocol incompatible devices */ diff --git a/include/timestamp.h b/include/timestamp.h index b2f4cf4..05a6658 100644 --- a/include/timestamp.h +++ b/include/timestamp.h @@ -24,7 +24,7 @@ #define __TIMESTAMP_H__ #ifndef DO_DEPS_ONLY -#include "timestamp_autogenerated.h" +#include "generated/timestamp_autogenerated.h" #endif #endif /* __TIMESTAMP_H__ */ diff --git a/include/version.h b/include/version.h index 129acef..c908bd3 100644 --- a/include/version.h +++ b/include/version.h @@ -27,7 +27,7 @@ #include #ifndef DO_DEPS_ONLY -#include "version_autogenerated.h" +#include "generated/version_autogenerated.h" #endif #ifndef CONFIG_IDENT_STRING