help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to do recursive "subsystem" make properly?


From: Bart Robinson
Subject: Re: how to do recursive "subsystem" make properly?
Date: Tue, 10 Nov 2009 11:17:55 -0800

On Tue, Nov 10, 2009 at 9:16 AM, Christophe LYON <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]