help-make
[Top][All Lists]
Advanced

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

Re: Inconsistent use of vpath


From: Philip Guenther
Subject: Re: Inconsistent use of vpath
Date: Sun, 3 Jun 2012 22:00:02 -0700

On Sun, Jun 3, 2012 at 8:46 PM, normvcr <address@hidden> wrote:
> Philip Guenther-2 wrote:
...
>> I believe the most common cause of this is because some makefile rule
>> builds a file other than address@hidden  In this case, ../src/foo.cpp  didn't
>> exist before the first run but did afterwards, but make didn't know
>> that some rule that it had run had created it.  What was the rule that
>> generated ../src/foo.cpp?
>
> There is, indeed, a target that first creates foo.cpp, but it only
> overwrites an an old, existing, foo.cpp .  It is as though the creation of
> the new foo.cpp is changing the rules, as you suggested, above, even
> though there was already a foo.cpp before invoking make the first time.
>
> Any ideas how to work around, that?  Perhaps, if I break up the
> rule into two rules (first make foo.cpp, then make foo.o),
> that should simplify things for make, but should such a work-around
> be necessary?

No, make does not need that.  The problem is almost certainly that THE
RULE IS WRONG.  Every rule should create/update *exactly* the path
"$@".  Not "../src/$@" or "${objdir}/$@", but *just* address@hidden  Is that 
what
the current rule does?  Since you don't want to show the rule itself,
you'll have to look and answer that yourself.


Philip Guenther



reply via email to

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