%% "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.