diff options
author | Nicholas Chin <nic.c3.14@gmail.com> | 2024-07-20 18:27:00 -0600 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2024-09-20 13:04:10 +0000 |
commit | cb7c58f6266b10fdd1ffc3309aa929b11a81f6c5 (patch) | |
tree | 16d20b3ff0e36d77625dbdfc1ca6445b46c7b7c8 /src/soc/nvidia | |
parent | 924337184ee944c5e38864ae39848b557c02a848 (diff) |
Makefile.mk: Skip unnecessary recompiles when static.{c,h} are updated
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.h an order-only prerequisite [1] using the new
generated files argument for create_cc_template to ensure that the
header 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-i440fx 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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84387
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/nvidia')
0 files changed, 0 insertions, 0 deletions