Skip to contentSkip to conversation

Move timestamp and version files into 'generated' subdir

PATCH Superseded Simon Glass 3 participants 7 messages Oct 10, 2011 – Oct 18, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Move timestamp and version files into 'generated' subdir

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.

---
Changes in v2:
- Remove {timestamp,version}_autogenerated.h from include/.gitignore

Changes in v3:
- Rebase to master: a recent commit has tidied up one part of this patch

 Makefile                                  |    4 ++--
 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/.gitignore                        |    2 --
 include/timestamp.h                       |    2 +-
 include/version.h                         |    2 +-
 8 files changed, 8 insertions(+), 13 deletions(-)
Makefile +2 -2
index 5db2e0e..dd59922 100644
@@ -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/ \
arch/arm/cpu/armv7/omap-common/spl.c +1 -2
index c76fea6..01fd58a 100644
@@ -29,8 +29,7 @@
 #include <nand.h>
 #include <mmc.h>
 #include <fat.h>
-#include <timestamp_autogenerated.h>
-#include <version_autogenerated.h>
+#include <version.h>
 #include <asm/omap_common.h>
 #include <asm/arch/mmc_host_def.h>
 #include <i2c.h>
arch/arm/cpu/armv7/omap-common/spl_mmc.c +1 -2
index 1d1e50c..6f5b43e 100644
@@ -28,8 +28,7 @@
 #include <asm/arch/sys_proto.h>
 #include <mmc.h>
 #include <fat.h>
-#include <timestamp_autogenerated.h>
-#include <version_autogenerated.h>
+#include <version.h>
 #include <asm/omap_common.h>
 #include <asm/arch/mmc_host_def.h>
 
arch/arm/cpu/armv7/omap-common/spl_nand.c +1 -2
index af02a59..38d06b1 100644
@@ -25,8 +25,7 @@
 #include <asm/utils.h>
 #include <asm/arch/sys_proto.h>
 #include <nand.h>
-#include <timestamp_autogenerated.h>
-#include <version_autogenerated.h>
+#include <version.h>
 #include <asm/omap_common.h>
 
 
drivers/serial/usbtty.h +1 -1
index a23169a..14961c1 100644
@@ -37,7 +37,7 @@
 #include <usb/spr_udc.h>
 #endif
 
-#include <version_autogenerated.h>
+#include <version.h>
 
 /* If no VendorID/ProductID is defined in config.h, pretend to be Linux
  * DO NOT Reuse this Vendor/Product setup with protocol incompatible devices */
include/.gitignore +0 -2
index 77594e5..ec224c5 100644
@@ -3,5 +3,3 @@
 /bmp_logo.h
 /config.h
 /config.mk
-/timestamp_autogenerated.h
-/version_autogenerated.h
include/timestamp.h +1 -1
index b2f4cf4..05a6658 100644
@@ -24,7 +24,7 @@
 #define	__TIMESTAMP_H__
 
 #ifndef DO_DEPS_ONLY
-#include "timestamp_autogenerated.h"
+#include "generated/timestamp_autogenerated.h"
 #endif
 
 #endif	/* __TIMESTAMP_H__ */
include/version.h +1 -1
index 129acef..c908bd3 100644
@@ -27,7 +27,7 @@
 #include <timestamp.h>
 
 #ifndef DO_DEPS_ONLY
-#include "version_autogenerated.h"
+#include "generated/version_autogenerated.h"
 #endif
 
 #ifndef CONFIG_IDENT_STRING
Signature · 1 line
1.7.3.1
#2 lore raw

PATCH v3 1/1 Move timestamp and version files into 'generated' subdir

In reply to Simon Glass

Dear Simon Glass,

Quoted 36 lines · In message <[email protected]> you wrote:

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.

---
Changes in v2:
- Remove {timestamp,version}_autogenerated.h from include/.gitignore

Changes in v3:
- Rebase to master: a recent commit has tidied up one part of this patch

Quoted 9 lines
 Makefile                                  |    4 ++--
 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/.gitignore                        |    2 --
 include/timestamp.h                       |    2 +-
 include/version.h                         |    2 +-
 8 files changed, 8 insertions(+), 13 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If in any problem you find yourself doing an immense amount of  work,
the answer can be obtained by simple inspection.
#3 lore raw

PATCH v3 1/1 Move timestamp and version files into 'generated' subdir

In reply to Simon Glass

Dear Simon Glass,

Quoted 4 lines · In message <[email protected]> you wrote:

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.

...

Quoted 9 lines
 Makefile                                  |    4 ++--
 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/.gitignore                        |    2 --
 include/timestamp.h                       |    2 +-
 include/version.h                         |    2 +-
 8 files changed, 8 insertions(+), 13 deletions(-)

This change breaks building for the following boards:

	BMW                     MUSENKI                 debris
	CPC45                   MVBLUE                  eXalion
	CPC45_ROMBOOT           OXC                     kvme080
	CU824                   PN62                    linkstation_HGLAN
	HIDDEN_DRAGON           Sandpoint8240           utx8245
	MOUSSE                  Sandpoint8245

For example:

+ ./MAKEALL CPC45
Configuring for CPC45 board...
ppc_6xx-gcc: /work/wd/tmp-ppc/arch/powerpc/cpu/mpc824x/bedbug_603e.c: No such file or directory
ppc_6xx-gcc: no input files
make[1]: *** No rule to make target /work/wd/tmp-ppc/arch/powerpc/cpu/mpc824x/.depend', needed by _depend'. Stop.

Please fix.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Punishment becomes ineffective after a certain point. Men become  in-
sensitive.
	-- Eneg, "Patterns of Force", stardate 2534.7
#4 lore raw

PATCH v3 1/1 Move timestamp and version files into 'generated' subdir

Hi Wolfgang,

Quoted 29 lines · Wolfgang Denk

Dear Simon Glass,

Quoted 4 lines · In message <[email protected]> you wrote:

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.

...

Quoted 9 lines
?Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?4 ++--
?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/.gitignore ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 --
?include/timestamp.h ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +-
?include/version.h ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +-

?8 files changed, 8 insertions(+), 13 deletions(-)

This change breaks building for the following boards:

? ? ? ?BMW ? ? ? ? ? ? ? ? ? ? MUSENKI ? ? ? ? ? ? ? ? debris ? ? ? ?CPC45 ? ? ? ? ? ? ? ? ? MVBLUE ? ? ? ? ? ? ? ? ?eXalion ? ? ? ?CPC45_ROMBOOT ? ? ? ? ? OXC ? ? ? ? ? ? ? ? ? ? kvme080 ? ? ? ?CU824 ? ? ? ? ? ? ? ? ? PN62 ? ? ? ? ? ? ? ? ? ?linkstation_HGLAN ? ? ? ?HIDDEN_DRAGON ? ? ? ? ? Sandpoint8240 ? ? ? ? ? utx8245 ? ? ? ?MOUSSE ? ? ? ? ? ? ? ? ?Sandpoint8245

For example:

Quoted 8 lines

+ ./MAKEALL CPC45
Configuring for CPC45 board...
ppc_6xx-gcc: /work/wd/tmp-ppc/arch/powerpc/cpu/mpc824x/bedbug_603e.c: No such file or directory
ppc_6xx-gcc: no input files
make[1]: *** No rule to make target /work/wd/tmp-ppc/arch/powerpc/cpu/mpc824x/.depend', needed by _depend'. ?Stop.

Please fix.

Actually I think this is the dependency patch rather than this one. Certainly I can repeat this problem on master and it is fixed with that patch.

Regards,
Simon

Quoted 13 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Punishment becomes ineffective after a certain point. Men become ?in- sensitive.
? ? ? ?-- Eneg, "Patterns of Force", stardate 2534.7

#5 lore raw

PATCH v3 1/1 Move timestamp and version files into 'generated' subdir

Dear Simon,

Quoted 2 lines · In message <CAPnjgZ1P1NApf=7tJf3x6cV5CyaKuQpp+wo8JKUWhfuVW2kJZA@mail.gmail.com>…

Actually I think this is the dependency patch rather than this one.

Which patch do you mean? Git bisect pointed at Subject:

Quoted 2 lines

Certainly I can repeat this problem on master and it is fixed with that patch.

Please give me a link or other handle I can grab :-)

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The number  of  Unix  installations  has  grown  to  10,  with  more
expected."    - The Unix Programmer's Manual, 2nd Edition, June, 1972
#6 lore raw

PATCH v3 1/1 Move timestamp and version files into 'generated' subdir

Hi Wolfgang,

Quoted 4 lines · Wolfgang Denk

Dear Simon,

Quoted 1 line · In message <CAPnjgZ1P1NApf=7tJf3x6cV5CyaKuQpp+wo8JKUWhfuVW2kJZA@mail.gmail.com>…
Quoted 8 lines
Quoted 1 line

Actually I think this is the dependency patch rather than this one.

Which patch do you mean? ?Git bisect pointed at Subject:

Quoted 2 lines

Certainly I can repeat this problem on master and it is fixed with that patch.

Please give me a link or other handle I can grab :-)

OK, I mean that I don't think this fault was due to this commit:

efb2172 Move timestamp and version files into 'generated' subdir

but to this one:

4750884 Adjust dependency rules to permit per-file flags

and therefore the patch previously sent[1] should fix this also.

Regards,
Simon

[1] http://patchwork.ozlabs.org/patch/120457/

Quoted 12 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "The number ?of ?Unix ?installations ?has ?grown ?to ?10, ?with ?more expected." ? ?- The Unix Programmer's Manual, 2nd Edition, June, 1972