In swiftc the situation is a little better, because build system already knows all the files needed for compilation, and knows location of .d files, but make and ninja doesn't support multiple depfiles for one target (but supports multiple outputs that are object files), so we need a tool that will merge it into one.
The broken targets can be found assuming deps log / depfile dependencyinformation is correct. Any target that depends on a generated file (outputof a generator-target) implicitly, but does not have an explicit or order-onlydependency path to the generator-target, is considered broken.
To bring this information into Ninja requires cooperation. On theNinja side, the depfile attribute on the build must point to apath where this data is written. (Ninja only supports the limitedsubset of the Makefile syntax emitted by compilers.) Then the commandmust know to write dependencies into the depfile path.Use it like in the following example:
If the include directory directives are using absolute paths, your depfilemay result in a mixture of relative and absolute paths. Paths used by otherbuild rules need to match exactly. Therefore, it is recommended to userelative paths in these cases.