On Tue, Nov 10, 2009 at 9:16 AM, Christophe LYON <[email protected]> wrote:
> I have another related question: consider
> foo: foo.b
> touch $@
>
> foo.b: foo.d
>
> foo.d:
> touch $@
>
> The first 'make' execution will:
> $ make
> touch foo.d
> touch foo
>
> but the subsequent ones will still:
> $ make
> touch foo
>
> If I change the 1st rule to "foo: foo.d", then:
> $ make
> make: `foo' is up to date.
>
> I thought the last change was just a shortcut for the initial sample, with a
> useless rule removed. What is different?
Hi Christophe,
This is because foo.b is never created. A target (i.e. foo) is always
out of date with respect to a non-existent prerequisite. You will get the
same behavior with
foo: foo.b
touch $@
foo.b:
or, the more familiar:
foo: FORCE
touch $@
FORCE:
If you wanted the behavior you expect, you can mark foo.b as secondary
in your original example:
.SECONDARY: foo.b
Try make -r -d with and without that change to see how it is different.
-- bart
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make