On 2021-05-06 06:15, Benjamin Fogle wrote:
Oh, I see. I misinterpreted the docs: Phony targets shouldn't be _direct_ dependencies of real files, but indirect dependencies work as expected. I'm glad that this wasn't some obscure behavior I was relying on.
The "needs update" dependency relationship in Make is not transitive; there is no indirection in it. If we have A -> B -> C, it is not the case that A -> C, if the -> symbol means "needs update due to". A's rule is triggered if A is missing or older than B. That's it; there is no concern for B. A doesn't care how B comes into existence. B's dependency is not A's dependency. If B is a phony target, then "needs update due to" is always true. Suppose C is newer than B, but the rule for updating B is not simply time-stamp-based: the rule notices that the content of C has not changed and avoids touching B. In that case, A will not update. If we have another symbol => which means "comes before in a goal chain", then A -> B -> C implies A => B => C, and that has transitivity A => C.