The right answer is always to write your makefiles so the rules execute in
the required order whether run in parallel or not. Relying on whichever
arbitrary ordering GNU make employs, even if that behavior is stable
(either historically or by design), is likely to result in sadness at some
point, such as when someone calls into your makefile recursively from their
own -j build.

Tl;dr: underspecified dependencies create hidden technical debt.

Kyle

On Tue, Jun 13, 2017 at 11:33 AM, Brett Stahlman <[email protected]>
wrote:

> 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?
>
> Thanks,
> Brett S.
>
> _______________________________________________
> 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

Reply via email to