One sign is that target does not exist, understand this.
Another is by comparing modification timestamp of target and prerequisites. How it works in more details? What is the logic of comparing target and prerequisite timestamps and how it works when there are multiple prerequisites?
makefirst 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:
Further, suppose that the modification times on these files are as follows:
In this case,
makewill compare the modification time offoo(4) to the modification time ofbar(3); sincebaris older,makewill move on and compare the modification time offoo(4) to the modification time ofbaz(6). Sincebazis newer,makewill decide thatfoomust be rebuilt, and will stop checking the prereqs offoo(soboowill never be checked).If you have multiple dependency lines for the output target, as in:
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
makevariants 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).