[U-Boot-Users] [Patch] Creation of version_autogenerated.h only triggered for new and different contents...

Carsten Schlote schlote at vahanus.net
Fri Jun 29 15:00:11 CEST 2007


Hi,

below a simple patch for the make rule, which creates the
version_autogenerated.h file. Instead of just updating this file any
time make is started, now the file is checked for different contents. If
it differs, the version header is updated, otherwise not.

This saves unnessesary rebuilds of several files in the tree.

Regards
  Carsten


---------

diff --git a/Makefile b/Makefile
index c52b21b..7999870 100755
--- a/Makefile
+++ b/Makefile
@@ -290,11 +290,13 @@ $(U_BOOT_NAND):   $(NAND_SPL) $(obj)u-boot.bin
                cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin >
$(obj)u-boot-nand.bin
 
 version:
-               @echo -n "#define U_BOOT_VERSION \"U-Boot " >
$(VERSION_FILE); \
-               echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE); \
+               @echo -n "#define U_BOOT_VERSION \"U-Boot " >
$(VERSION_FILE).tmp; \
+               echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE).tmp; \
                echo -n $(shell $(CONFIG_SHELL)
$(TOPDIR)/tools/setlocalversion \
-                        $(TOPDIR)) >> $(VERSION_FILE); \
-               echo "\"" >> $(VERSION_FILE)
+                        $(TOPDIR)) >> $(VERSION_FILE).tmp; \
+               echo "\"" >> $(VERSION_FILE).tmp
+               @diff --brief $(VERSION_FILE) $(VERSION_FILE).tmp || cp
$(VERSION_FILE).tmp $(VERSION_FILE)
+               @rm $(VERSION_FILE).tmp
 
 gdbtools:
                $(MAKE) -C tools/gdb all || exit 1






More information about the U-Boot mailing list