On Sat, 2025-03-08 at 11:34 -0900, Britton Kerin wrote: > What confuses me is that since the explicitly requested foo exists > and isn't out of date with respect to any non-order-only prereqs (in > the example it doesn't have any) and therefore isn't getting rebuilt, > I wouldn't expect there to be any need to rebuild it's order-only > prereqs either.
That's certainly a reasonable way for it to work, but that's not how it works. It's not the case that FIRST make determines whether the target is up to date with respect to all normal prerequisites, and only if it is out of date does make go back and try to build the order-only prerequisites. Instead, make treats all prerequisites identically in every way right up to the point where it's determining whether the target is up to date: at that step it skips over the order-only prerequisites and their modification time is not used for the up-to-date check.