[coreboot] New patch to review for filo: 0c3a13b makefile: recreate version.h only when needed

Mathias Krause (mathias.krause@secunet.com) gerrit at coreboot.org
Tue Mar 6 16:42:28 CET 2012

Mathias Krause (mathias.krause at secunet.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/745


commit 0c3a13b773ee21af4c1380c01bacc2d9d00f6784
Author: Mathias Krause <mathias.krause at secunet.com>
Date:   Tue Mar 6 13:26:48 2012 +0100

    makefile: recreate version.h only when needed
    Don't recreate version.h on each make invokation but only when needed, i.e.
    when the make variables have changed. Also make version.h a prerequisite for
    the object files to rebuild them when the version information changes.
    Change-Id: I27a057be25902233ac0751db8061e9ad4cd50642
    Signed-off-by: Mathias Krause <mathias.krause at secunet.com>
 Makefile |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 3b4a468..46a265f 100644
--- a/Makefile
+++ b/Makefile
@@ -112,8 +112,8 @@ TARGET  = $(obj)/filo.elf
-all: prepare $(obj)/version.h $(TARGET)
+all: prepare $(TARGET)
 ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
@@ -143,7 +143,7 @@ include util/kconfig/Makefile
 $(KCONFIG_AUTOHEADER): $(src)/.config
 	$(MAKE) silentoldconfig
-$(OBJS): $(KCONFIG_AUTOHEADER) | libpayload
+$(OBJS): $(KCONFIG_AUTOHEADER) $(obj)/version.h | libpayload
 $(obj)/%.o: $(src)/%.c
 	printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
 	$(CC) -MMD $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
@@ -158,7 +158,8 @@ $(obj)/%.map: $(obj)/%
-$(obj)/version.h: FORCE
+$(obj)/version.h: Makefile
+	printf "  GEN     $(subst $(shell pwd)/,,$(@))\n"
 	echo '#define PROGRAM_NAME "$(PROGRAM_NAME)"' > $@
 	echo '#define PROGRAM_VERSION "$(PROGRAM_VERSION)"' >> $@
@@ -171,6 +172,7 @@ prepare: $(sort $(dir $(OBJS))) $(obj)/util/kconfig/lxdialog/
 	rm -rf $(sort $(dir $(OBJS))) $(obj)/util
+	rm -rf $(obj)/version.h
 distclean: clean
 	rm -rf $(obj)

More information about the coreboot mailing list