make
first gets the modification time of the target, then compares that value to the modification time of each prereq, in order from left to right, stopping as soon as it finds any prereq that is newer than the target (since a single newer prereq is sufficient to require the target be rebuilt).
For example, suppose you have a rule like this:
foo: bar baz boo
Further, suppose that the modification times on these files are as follows:
foo: 4
bar: 3
baz: 6
boo: 2
In this case, make
will compare the modification time of foo
(4) to the modification time of bar
(3); since bar
is older, make
will move on and compare the modification time of foo
(4) to the modification time of baz
(6). Since baz
is newer, make
will decide that foo
must be rebuilt, and will stop checking the prereqs of foo
(so boo
will never be checked).
If you have multiple dependency lines for the output target, as in:
foo: bar baz
foo: boo
The prereqs in the second and subsequent dependency lines are simply appended to the end of the list of prereqs for the output target -- that is, this example is exactly equivalent to the first example above.
In general, all make
variants behave this way, although some variants have extensions that modify this behavior (for example, GNU make includes order-only prerequisites; Sun make has "keep state" features; etc).