help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Prerequisite ordering - make 3.81


From: Dave Korn
Subject: RE: Prerequisite ordering - make 3.81
Date: Tue, 23 Jan 2007 12:11:44 -0000

On 22 January 2007 15:09, Daniel Thom wrote:


> As long as the 'target:' line with the "This operation is important. . ."
> statement comes *BEFORE* 'target: two' the behavior is as shown above.  If
> it is below 'target: two' both versions of make behave the same.
> 
> Is this an expected difference between the two versions (I'm guessing it
> is)? I did look at the info pages and google around, but I didn't see an
> answer for this exact (and very simple) scenario.  I'm sure I can work
> around this difference, though I need to support multiple versions of make
> and would prefer not to kludge this too badly if this is a bug rather than
> expected behavior (this is a much simplified example).

  Make builds a tree (directed acyclic graph actually) of dependencies and
walks it building prerequisites.  There has /never/ been /any/ guarantee about
the order in which it walks the tree, and assuming that it will or won't visit
nodes in any given order is an incorrect assumption.  This is one of the
commonest causes of bugs that only appear when you use the -j option for
parallel make, because when you do that your previous assumptions about order
of building targets can go right out the window.

  If you *require* target "two" to be built after target "one", then it is in
fact the case that "one" is a /prerequisite/ of "two", and should be listed as
such in your makefile; the fact you have omitted this dependency is a bug in
your code.  

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....





reply via email to

[Prev in Thread] Current Thread [Next in Thread]