On Sat, 2022-05-21 at 14:34 -0400, Dmitry Goncharov wrote: > On Sat, May 21, 2022 at 12:25 PM Paul Smith <psm...@gnu.org> wrote: > > Maybe what you're saying is that make should throw an error or > > warning if you try to add an order-only prerequisite to a phony > > target, telling you that it will have no effect on your makefile? > > Having a phony target depend (usually indirectly, but there are > examples of immediate dependency) on an order-only prerequisite is > quite common. This happens when the top target is marked phony and > there is an order-only prerequisite down the graph.
Agreed we would never mention an indirect dependency. That is not an invalid use of order-only prerequisites anyway; the order-only prerequisite will be relevant only for its immediate target not "parents" of that target and if the immediate target is not phony then the o-o prerequisite is entirely valid there. I can't think of a reason to add an order-only prerequisite directly to a phony target on purpose, but I suppose it could happen as the result of some variable expansion or something which is annoying to avoid. But I do not plan to add any sort of warning like this at the moment.