From 6fc334d6b6835e1cfeef01461654513de7649a1d Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 3 Oct 2014 12:59:13 -0700 Subject: [PATCH] Makefile: Change $(generic-deps) to order-only prerequisite Turns out making the compilation of every single source file depend on the auto-generated build.h in CL:219170 wasn't really such a great idea for incremental builds. Who would've thought. However, it's still undesirable that individual Makefiles for sources that actually include build.h need to add that dependency manually. Therefore, this patch fixes the issue by using $(generic-deps) as an order-only prerequisites in rules. This kind of prerequisite is still made before the target if it doesn't exist, but it is not automatically updated based on the timestamp. Also removed some additional manual build.h dependencies that I must somehow overlooked in the old patch. The files that actually include build.h still get it as a normal prerequisite through the automatic dependency rule in .d that is created by GCC's -MMD option. $(generic-deps) only solves the chicken-and-egg problem of where build.h comes from in fresh/cleaned build directories that don't have any .d dependency files yet. BUG=chrome-os-partner:32622 TEST=Manually did an incremental build with a single changed file. Confirmed that actual build.h dependencies (id.bootblock.o, console.*.o) were still remade, but not all other coreboot sources. Change-Id: I5a830aae6b17dd7d4061a577fd2410b678d6f1f0 Signed-off-by: Julius Werner Reviewed-on: https://chromium-review.googlesource.com/221470 Reviewed-by: Aaron Durbin --- Makefile | 3 ++- src/arch/x86/Makefile.inc | 6 +++--- src/arch/x86/boot/Makefile.inc | 3 --- src/arch/x86/lib/Makefile.inc | 4 +--- src/vendorcode/google/chromeos/Makefile.inc | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 159d9797ee..5e58cedde5 100644 --- a/Makefile +++ b/Makefile @@ -179,6 +179,7 @@ $(obj)/config.h: $(MAKE) oldconfig # Dependencies that should be built before all files in all classes +# Careful: interpreted as order-only prerequisites, use only for header files! generic-deps = $(obj)/config.h # Every file can append to this string. It is simply eval'ed after the scan. @@ -256,7 +257,7 @@ define create_cc_template # $4 additional dependencies ifn$(EMPTY)def $(1)-objs_$(2)_template de$(EMPTY)fine $(1)-objs_$(2)_template -$$(call src-to-obj,$1,$$(1)): $$(1) $$$$(generic-deps) $(4) +$$(call src-to-obj,$1,$$(1)): $$(1) $(4) | $$$$(generic-deps) @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n" $(CC_$(1)) -MMD $$$$(CFLAGS_$(1)) -MT $$$$(@) $(3) -c -o $$$$@ $$$$< en$(EMPTY)def diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index df6b3081d7..4436feb53b 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -114,7 +114,7 @@ bootblock_romccflags = -mcpu=i386 endif bootblock_romccflags += -O2 $(bootblock-c-ccopts) $(bootblock-generic-ccopts) -$(objgenerated)/bootblock.inc: $(src)/arch/x86/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(objutil)/romcc/romcc $$(generic-deps) +$(objgenerated)/bootblock.inc: $(src)/arch/x86/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(objutil)/romcc/romcc | $$(generic-deps) @printf " ROMCC $(subst $(obj)/,,$(@))\n" $(CC_bootblock) $(INCLUDES) $(INCLUDES_bootblock) -MM -MT$(objgenerated)/bootblock.inc \ $< > $(objgenerated)/bootblock.inc.d @@ -191,12 +191,12 @@ $(objcbfs)/romstage_%.elf: $(objcbfs)/romstage_%.debug $(OBJCOPY_romstage) --add-gnu-debuglink=$< $@.tmp mv $@.tmp $@ -$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(objutil)/romcc/romcc $$(generic-deps) +$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(objutil)/romcc/romcc | $$(generic-deps) printf " ROMCC romstage.inc\n" $(ROMCC) -c -S $(ROMCCFLAGS) -I. $(INCLUDES) $(INCLUDES_romstage) $< -o $@ else # CONFIG_ROMCC -$(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $$(generic-deps) +$(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c | $$(generic-deps) @printf " CC romstage.inc\n" $(CC_romstage) -MMD $(CFLAGS_romstage) $(romstage-c-ccopts) $(romstage-generic-ccopts) -I$(src) -I. -I$(obj) -c -S $< -o $@ diff --git a/src/arch/x86/boot/Makefile.inc b/src/arch/x86/boot/Makefile.inc index 7ad20c5573..c4e8786248 100644 --- a/src/arch/x86/boot/Makefile.inc +++ b/src/arch/x86/boot/Makefile.inc @@ -12,7 +12,4 @@ ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += acpigen.c ramstage-$(CONFIG_HAVE_ACPI_RESUME) += wakeup.S -$(obj)/arch/x86/boot/coreboot_table.ramstage.o : $(OPTION_TABLE_H) -$(obj)/arch/x86/boot/smbios.ramstage.o: $(obj)/build.h - endif diff --git a/src/arch/x86/lib/Makefile.inc b/src/arch/x86/lib/Makefile.inc index fe1b379b9c..275be00dbf 100644 --- a/src/arch/x86/lib/Makefile.inc +++ b/src/arch/x86/lib/Makefile.inc @@ -36,6 +36,4 @@ rmodules_x86_32-y += memset.c rmodules_x86_32-y += memcpy.c rmodules_x86_32-y += memmove.c -$(obj)/arch/x86/lib/console.ramstage.o :: $(obj)/build.h - -endif \ No newline at end of file +endif diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc index acc72a1138..d5545e9f58 100644 --- a/src/vendorcode/google/chromeos/Makefile.inc +++ b/src/vendorcode/google/chromeos/Makefile.inc @@ -131,7 +131,7 @@ VBOOT_CFLAGS += $(verstage-c-ccopts) VBOOT_CFLAGS += -include $(top)/src/include/kconfig.h -Wno-missing-prototypes VBOOT_CFLAGS += -DVBOOT_DEBUG -$(VB2_LIB): $$(generic-deps) +$(VB2_LIB): | $$(generic-deps) @printf " MAKE $(subst $(obj)/,,$(@))\n" $(Q)FIRMWARE_ARCH=$(VB_FIRMWARE_ARCH) \ CC="$(CC_verstage)" \