I've been waiting for Paul to show up with the definitive word but he may be away. I'm 95% sure he's spoken on this before with the gist of it being "While not required by standard, GNU make has always worked left-to-right and this will not change".
While I *think* I've correctly channeled his answer, the real thing could probably be found in the archives of the help-make or bug-make mailing lists if you want to search there. David On Wed, Jun 14, 2017 at 7:36 AM, Brett Stahlman <[email protected]> wrote: > On Wed, Jun 14, 2017 at 2:00 AM, Edward Welbourne > <[email protected]> wrote: > > Brett Stahlman (13 June 2017 17:33) > >> I don't see anything in the Make docs that guarantees prerequisites > >> will be processed in left to right order. Opinions on the web seems to > >> be split into 2 camps: > >> > >> 1. Make always builds dependencies in left to right order, but a > >> well-designed Makefile won't rely upon it. > >> 2. Make is free to build dependencies in any order it likes, provided > >> it respects the stated dependencies. > >> > >> My own recent experience suggests #2 is the correct statement, but I > >> can't rule out the possibility that a bug in my Makefile is producing > >> the apparent non-determinism I'm observing. At any rate, can anyone > >> point me to a definitive source on this? > > > > I suspect most implementations of make do in fact build in left-to-right > > order but none guarantee it; and I won't be surprised if GNU make used > > to but has lately stopped doing so, although I can't give you a > > definitive source either way. I certainly wouldn't ever assume > > deterministic build order; if one prerequisite needs to be built before > > another, the make-file should express that via a dependency (perhaps > > just an order-only one). > > Makes sense. I saw it suggested somewhere that Make has to perform a > complex, inherently unstable, topological sort, which may make it > difficult to preserve left to right order. By experimentation, I > discovered that the order seemed to be affected by the actual target > names: e.g., names such as "foo" and "foo22222" produced left to right > order, whereas "foo2" did not. For the vast majority of target names > tried, the order was strictly left to right. > > Thanks, > Brett S. > > > > > Eddy. > > _______________________________________________ > Bug-make mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/bug-make >
_______________________________________________ Bug-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-make
