[coreboot] New patch to review for filo: 2bc5424 makefile: avoid unnecessary rebuilds

Mathias Krause (mathias.krause@secunet.com) gerrit at coreboot.org
Tue Mar 6 16:42:27 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/744


commit 2bc5424a1d455622e8168e4c30873f9fff1a15ac
Author: Mathias Krause <mathias.krause at secunet.com>
Date:   Tue Mar 6 13:14:47 2012 +0100

    makefile: avoid unnecessary rebuilds
    The make target libpayload is a phony target which makes filo and all
    the object files get rebuild on every make invokation. Avoid this by
    lifting the dependencies and rebuild, i.e. relink filo only when
    libpayload has changed.
    Also, when building libpayload as a prerequisite, use $(obj) as DESTDIR,
    as the user might want to use a different build directory then $(src)/build.
    Change-Id: Ifa42362ba1d8c88c9996d645314cfdbdf2994759
    Signed-off-by: Mathias Krause <mathias.krause at secunet.com>
 Makefile |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 3461614..3b4a468 100644
--- a/Makefile
+++ b/Makefile
@@ -118,18 +118,19 @@ all: prepare $(obj)/version.h $(TARGET)
 ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
-	@printf "Found Libpayload $(LIBPAYLOAD).\n"
+	@printf "Found libpayload as $(LIBPAYLOAD)\n"
-libpayload: $(src)/$(LIB_CONFIG)
-	printf "building libpayload.\n"
+libpayload: $(LIBPAYLOAD)
+	@printf "Building libpayload...\n"
 	$(MAKE) -C $(LIBCONFIG_PATH) obj=$(obj)/libpayload-build distclean
 	cp lib.config $(LIBCONFIG_PATH)/.config
 	mkdir -p $(LIBCONFIG_PATH)/build
 	$(MAKE) -C $(LIBCONFIG_PATH) obj=$(obj)/libpayload-build oldconfig
-	$(MAKE) -C $(LIBCONFIG_PATH) obj=$(obj)/libpayload-build DESTDIR=$(src)/build install
+	$(MAKE) -C $(LIBCONFIG_PATH) obj=$(obj)/libpayload-build DESTDIR=$(obj) install
-$(obj)/filo: $(OBJS) libpayload
+$(obj)/filo: $(OBJS) $(LIBPAYLOAD)
 	printf "  LD      $(subst $(shell pwd)/,,$(@))\n"
 	$(LD) -N -T $(ARCHDIR-y)/ldscript -o $@ $(OBJS) $(LIBPAYLOAD) $(LIBGCC)
@@ -142,7 +143,7 @@ include util/kconfig/Makefile
 $(KCONFIG_AUTOHEADER): $(src)/.config
 	$(MAKE) silentoldconfig
-$(OBJS): $(KCONFIG_AUTOHEADER) libpayload
+$(OBJS): $(KCONFIG_AUTOHEADER) | libpayload
 $(obj)/%.o: $(src)/%.c
 	printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
 	$(CC) -MMD $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
@@ -177,5 +178,4 @@ distclean: clean
-.PHONY: $(PHONY) prepare clean distclean FORCE
+.PHONY: $(PHONY) prepare clean distclean libpayload FORCE

More information about the coreboot mailing list