help-make
[Top][All Lists]
Advanced

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

Re: Does (normal) prerequisite order matter?


From: Ken Smith
Subject: Re: Does (normal) prerequisite order matter?
Date: Fri, 18 Nov 2005 15:17:03 -0500
User-agent: mutt-ng/devel-r569 (Linux)

On Fri, Nov 18, 2005 at 01:40:10PM -0600, Matt England wrote:
> Does (normal) prerequisite order matter?
> 
> That is to say, in this example:
> 
> <code>
> target1: prereq1 prereq2
> </code>
> 
> ...will the rule (if any) for prereq1 complete (and not just start) before 
> the 

Make will process them from left to right during builds where no
parallelization is performed.  If parallelization is performed, then
prereq1 will still be checked before prereq2 but you can't be sure that
prereq1 will finish, or even start, before prereq2.

Consider this expansion of your example.

target1: prereq1 prereq2
        touch $@

prereq1:
        sleep 5
        touch $@

prereq2:
        touch $@

If you run gmake -j2, prereq2 will be created before prereq1.  If you
run gmake without parallelization, prereq1 will be created before
prereq2.  However, you can employ an order-only prerequisite to ensure
that prereq1 is completed before prereq2 begins even for parallel builds
by adding the following to the above expanded example.

prereq2: | prereq1

  HTH,
  Ken




reply via email to

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