#1522: Improve determining make dependencies --------------------------+------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: new Priority: major | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: --------------------------+-------------------------------------------------
Comment (by eschnett):
sbrandt: The script doesn't replace continuations with dependencies, it adds dependencies (">>") to the continuation that remain. This means that files that don't exist any more don't lead to make errors.
rhaas: Yes, dependencies are generated when a file changes. If the makefile or the compile options change, then all dependencies are invalid and need to be regenerated. If Cactus doesn't do that automatically, then a make *-cleandeps may be necessary. (I'm not proposing to remove this.)
There is no need to generate dependencies "quickly". If they are missing, then the respective source file needs to be recompiled anyway. (Otherwise, how would you know whether an existing object file was created from the right dependencies and options?)
The latter point confused me for a bit. Here is an example: File source.c: {{{ #if useA # include "a.h" #else # include "b.h" #endif ... code using stuff declared in a.h or b.h ... }}}
If there is a change that makes source.c switch from using a.h to using b.h, then it needs to be recompiled. However, both a.h and b.h may be older than the object file source.o -- so keeping source.o around is an error, as neither the old nor the new dependencies would indicate that source.o is out of date. Hence, re-generating dependencies without recompiling is an error.