Generated Headers as Build Inputs
A rule producing an input file must run before consumers can read it, and consumer reuse depends on any content changes that affect the result.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace an initial build
If a compilation includes version.h, a generator creating version.h must complete before compilation. An older file may hide a missing step in ordinary development. See clean builds.
Check an update as well
Change the generator's version input and verify the header and its affected objects are rebuilt. An explicit graph should connect both prerequisite steps.[1]
Test a clean parallel compile without relying on an old header
A compiler invocation needs generated/config.h from a schema. If compile starts before the generator finishes, a clean build can fail. A stale header can make the same missing dependency less visible. Declare the generated header as an input of compilation. See build step dependencies.
schema → generated/config.h
generated/config.h and source → compiled object
Editing schema must update the header before recompiling
Check that changing the header invalidates objects
Scheduling the generator first alone is insufficient when freshness ignores its output. Run a clean build, then modify a schema field that changes the generated header and inspect recompilation.