diff options
author | Nicholas Chin <nic.c3.14@gmail.com> | 2024-08-25 17:31:23 -0600 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2024-09-20 13:04:05 +0000 |
commit | 924337184ee944c5e38864ae39848b557c02a848 (patch) | |
tree | 264d2910cd43ff184a50889ffc4c64867dd9e18b /src | |
parent | c867f746fe011c89c22bd46ebd04b99c4c4aa134 (diff) |
Makefile: Allow defining order-only prerequisites in create_cc_template
Generated files such as static.h are currently added as prerequisites
for all compilation units to ensure that they exist and are up to date
before anything that might need them is compiled. However, this has the
side effect of forcing every compilation unit out of date when such
files are regenerated, even if the object has no dependency on the
generated file. GNU Make has order-only prerequisites [1] which are used
to define prerequisites that must be updated before a given target, but
which don't force the target out of date.
Add a new argument to create_cc_template, similar to the "additional
dependencies" argument, which allows dependencies on such generated
files for a specified object class and source suffix to be defined. This
new functionality will be utilized in subsequent commits to fix up the
dependencies on generated files.
Objects that do depend on generated headers will still be handled
correctly due to the .d dependency files that are generated by the
compiler during the build, which declare normal prerequisites to any
headers an object directly or indirectly includes. As per the GNU Make
documentation, normal prerequisites take precedence over order-only
prerequisites, so the header dependencies declared in the .d files will
override the order-only one declared through create_cc_template.
This does mean that a necessary rebuild of an object due to a generated
file may be missed if the dependency file from the compiler is missing,
but this is an unusual situation that is unlikely to occur during normal
incremental builds.
[1] https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html
Change-Id: I50d87b3d9012967eefb197be12b2e0f096b0b67c
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84386
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions