Revisiting the semantics of phony

Skip to first unread message

RJ Ascani

May 1, 2021, 3:47:07 PM5/1/21
to ninja-build
Hi ninja-dev,

According to the ninja manual, the phony rule [1] can be used to create aliases for other targets. However, ninja does not currently consider the outputs of a phony edge to be dirty if the edge's inputs have been modified. This appears to have come up a few times over the years in discussion [2] and pull requests [3, 4], but no fix has been merged.

Would such a change still be possible? I think it is a reasonable expectation of the user for targets that depend on a phony target to be rebuilt if one of the phony target's inputs is modified, but obviously this behavior has existed in ninja for a long time now. I've uploaded a new PR [5] that rebases to the latest and addresses some of the outstanding feedback on the last attempt, but I'd also like to solicit from the community whether this might break any existing uses.


Scott Graham

May 6, 2021, 3:47:28 PM5/6/21
to RJ Ascani, ninja-build
This seems to make sense to me, given mixing of phonys with files. Any reason we shouldn't try merging 1964?

You received this message because you are subscribed to the Google Groups "ninja-build" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

RJ Ascani

Oct 1, 2021, 1:36:53 PM10/1/21
to ninja-build
Hello everyone,

The PR to set output mtime of phony edges to the latest inputs[1] has now been merged. Please test with this change and let us know if any phony use cases break.

Thank you,

Reply all
Reply to author
0 new messages