Nicholas Chin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84387?usp=email )
Change subject: Makefile.mk: Change dependency on static.c to static.h ......................................................................
Makefile.mk: Change dependency on static.c to static.h
The generated static.c file output by sconfig is currently added as a prerequisite for all objects to ensure that static.h exists before compiling anything that might need it. However, this forces every single object out of date when the compiled devicetree is updated, even though not every file actually needs static.h.
Only static.h actually needs to exist before compilation of other objects, since static.c is an independent compilation unit that doesn't need to exist before other objects can be built. Thus, change the prerequisite from static.c to static.h, and add a rule for static.h that depends on static.c. The recipe is a simple `true` since sconfig generates static.c and static.h at the same time. To prevent unnecessary recompiles, make static.c a an order-only prerequisite [1] using the new order only prerequisite argument for create_cc_template to ensure that static.h exists before any object might need it, but without forcing a recompile of all objects by default whenever it is updated.
On a clean build, all objects will be compiled since they do not exist, and these will occur after static.h is generated due to the default order-only prerequisite. On subsequent incremental compiles, sources that do need static.h will be appropriately marked out of date due to the generated .d dependency files from the compiler, which list static.h as a normal prerequisite for each objects that do include it, which overrides the default order-only prerequisite. The dependency files generated for all other objects will not include static.h, and thus the objects will not be updated since the default order-only dependency does not force them out of date.
After updating the devicetree of qemu-i440f after a clean build, comparing the build log with `make --debug=why` with the generated dependency files indicates that only objects that actually depend on static.h were rebuilt, instead of every object. Running a timeless incremental build after making a change in the devicetree yielded identical roms when performed with this patch and main, with the only difference being the number of objects that needed to be rebuilt. Also tested with the E6430.
[1] https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html
Change-Id: I34efc162760ae703285f3982fa16cc23a86b37f6 Signed-off-by: Nicholas Chin nic.c3.14@gmail.com --- M Makefile.mk 1 file changed, 11 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/84387/1
diff --git a/Makefile.mk b/Makefile.mk index a046438..1353b05 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -776,6 +776,10 @@ DEVICETREE_FWCONFIG_H := $(obj)/static_fw_config.h SCONFIG_OPTIONS += --output_f=$(DEVICETREE_FWCONFIG_H)
+# Generated at the same time as static.c +$(DEVICETREE_STATIC_H): $(DEVICETREE_STATIC_C) + true + $(DEVICETREE_STATIC_C): $(DEVICETREE_FILE) $(OVERRIDE_DEVICETREE_FILE) $(CHIPSET_DEVICETREE_FILE) $(objutil)/sconfig/sconfig @printf " SCONFIG $(subst $(src)/,,$(<))\n" mkdir -p $(dir $(DEVICETREE_STATIC_C)) @@ -788,13 +792,13 @@ postcar-y+=$(DEVICETREE_STATIC_C) smm-y+=$(DEVICETREE_STATIC_C)
-# Ensure static.c and static.h are created before any objects are compiled -ramstage-c-deps+=$(DEVICETREE_STATIC_C) -romstage-c-deps+=$(DEVICETREE_STATIC_C) -verstage-c-deps+=$(DEVICETREE_STATIC_C) -bootblock-c-deps+=$(DEVICETREE_STATIC_C) -postcar-c-deps+=$(DEVICETREE_STATIC_C) -smm-c-deps+=$(DEVICETREE_STATIC_C) +# Ensure static.h is created before any objects are compiled +ramstage-c-order-deps+=$(DEVICETREE_STATIC_H) +romstage-c-order-deps+=$(DEVICETREE_STATIC_H) +verstage-c-order-deps+=$(DEVICETREE_STATIC_H) +bootblock-c-order-deps+=$(DEVICETREE_STATIC_H) +postcar-c-order-deps+=$(DEVICETREE_STATIC_H) +smm-c-order-deps+=$(DEVICETREE_STATIC_H)
# Ensure fmap_config.h are created before any objects are compiled ramstage-c-deps+=$(obj)/fmap_config.h