help-make
[Top][All Lists]
Advanced

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

Re: Prerequisites processing order


From: Angel Tsankov
Subject: Re: Prerequisites processing order
Date: Sat, 29 Oct 2005 10:32:49 +0300


----- Original Message ----- From: "Paul D. Smith" <address@hidden>
To: "Angel Tsankov" <address@hidden>
Cc: "make-help mailing list" <address@hidden>
Sent: Friday, July 01, 2005 2:27 PM
Subject: Re: Prerequisites processing order


%% "Angel Tsankov" <address@hidden> writes:

 at> Does make process prerequisites in a specified order? If so,
what
 at> is it?

Make always processes prerequisites in the order they appear in the
prerequisites list, with one exception: the prerequisites in the
rule
containing the command script for that target are processed first,
regardless of the order in which they appear.

For example, this makefile:

   all: one two
   all: three four

   one two three four: ; @echo $@

will always print:

   one
   two
   three
   four

But this one:

   all: one two
   all: three four; @echo "$@: $^"

   one two three four: ; @echo $@

will always print:

   three
   four
   one
   two
   all: three four one two


This is guaranteed.  HOWEVER!  There is another twist here.  If you
run
make with the -j option, to run jobs in parallel, then although make
still walks the prerequisites list in this order it will invoke
"sibling" prerequisites at the same time.  This can mean (depending
on
the scheduler of your operating system, and/or the relative amount
of
time it takes to build various prerequisites, they can complete in a
different order.

If you want to use -j you MUST declare all dependency relationships
and
not rely on any ordering implicit in the makefile.


How do I define dependency relationships?





reply via email to

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