[Top][All Lists]

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

Re: Question about order dependencies

From: Philip Guenther
Subject: Re: Question about order dependencies
Date: Mon, 14 Sep 2009 13:01:12 -0700

On Sun, Sep 13, 2009 at 11:11 PM, drwowe <address@hidden> wrote:
> Suppose I have the following makefile:
> foo: ...
>   ...
> bar: ...
>   ...
> all: foo bar
> Here's the problem:  I need to make sure foo completes before bar is
> started, but only if foo was going to be executed anyway.  The obvious
> thing, making a dependency "bar: foo" is wrong, because the user needs to be
> able to say "make bar" on the command line without building foo.

Hmm, could you give an example of what the 'foo' and 'bar' targets
would be doing?  Apparently the 'bar' target doesn't really rely on
'foo' even existing, so where does the requirement for 'foo' to be
built before 'bar' come from?

> Ordering-only dependencies seemed at first glance to be what I needed, but
> it turns out that saying "bar: | foo" still forces foo to get built.

Is 'foo' a .PHONY target?

> Anyway, I came up with a very ugly workaround by checking the MAKECMDGOALS
> and adding "bar: foo" conditionally if "all" or "foo" is on the command
> line, but I was wondering if there was an easier way to impose ordering
> constraints on goals without triggering new goals?

Depending on why there's this ordering requirement, that may actually
be the semantically cleanest solution...

Philip Guenther

reply via email to

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