On Mon, 2025-03-17 at 21:16 -0400, Dmitry Goncharov wrote: > > To build target A: > > - First try to build all NON-ORDER-ONLY prerequisites > > - Compare the modification time of all NON-ORDER-ONLY prerequisites > > - If any NON-ORDER-ONLY prerequisite is newer than A: > > - Try to build all ORDER-ONLY prerequisites > > - Run the recipe to build A > > The patch in attachment is slightly different. The patch causes make > to never update existing order-only prerequisites.
If make never updates them then what's the purpose of having them? Oh, I see from the patch: you don't mean "never" you mean, only if the prerequisite does not exist will it be updated. I agree this preserves probably the most common reason for using OO prereqs (to create directories) but I don't think I like this change. For one thing it feels too different from normal make behavior, in that we do "consider" a prerequisite but we do so only to check for existence, not for out-of-date-ness, which feels odd to me. Secondly, I believe the behavior provided by your patch is available already; you can use $(wildcard ...) to check if a file exists. Isn't something like this (the gross bits can be hidden in a macro I suppose) the equivalent of the change in the patch? xyz: foo | $(if $(wildcard bar),,bar) ; foo bar: ; If bar exists then we expand to nothing, else we expand to bar.