2 days ago
- Build systems like Ninja can only express positive dependencies on existing files, not negative dependencies that would detect when a new file shadows an existing dependency.
- In the example, adding src/interface.h changes which header the compiler includes, but Ninja does not rebuild because it only depends on dependency/include/interface.h.
- Using depfiles from cc -M does not solve the problem because Ninja does not know when to regenerate the depfile when a new header appears.
- This illustrates a fundamental limitation of build systems: they cannot track dependencies on the absence or creation of files that could change the build result.