Thu 03 Dec 2015 07:58:39 AM UTC, original submission:
We encountered a difference how timestamps are handled between clean builds and rebuild depending if a rule has a recipe or not. If a rule doesn't have a recipe GNU make doesn't check the timestamp of the dependency correctly and therefore fails to trigger recipes from dependent rules.
I have checked GNU make 3.81, 4.0 and 4.1: they are all affected by this issue.
I've attached 3 makefiles that highlight the problem. We have
- file "a" that depends on file "b"
- file "b" is one of the files generated when file "d" is updated
- the target for dependency "d" is file/.PHONY target "c"
- the empty rule "b: c" makes sure that the dependencies are correct, i.e. when we ask for "a" the rule for "c" is triggered
Without recipe attached to rule "b: c" the file "a" is not updated on first rebuild, only on the second one.
Example 1 uses a .PHONY target for "c", example 2 does not. The example output is generated with make 4.1 to have the "--trace" option available.
Example 1: wrong execution on rebuild:
Example 1: correct execution on rebuild by adding a no-op ":" recipe
Example 1: correct execution on rebuild by adding an empty recipe
Example 2: wrong execution on rebuild:
Example 2: correct execution on rebuild by adding a no-op ":" recipe
Example 2: correct execution on rebuild by adding an empty recipe
|