[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inconsistent use of vpath
From: |
normvcr |
Subject: |
Re: Inconsistent use of vpath |
Date: |
Sun, 3 Jun 2012 20:46:25 -0700 (PDT) |
Philip Guenther-2 wrote:
>
> On Sat, Jun 2, 2012 at 2:17 PM, normvcr <address@hidden> wrote:
>> I have come across a puzzling problem while building with make.
>>
>> make all
>>
>> While building the targets, make eventually comes to building
>> foo.o, but quits with an error, that it cannot find foo.cpp .
>>
>> However, when I now do, again, at the OS prompt:
>>
>> make all
>>
>> make picks up where it left off, and succeeds; the echo of the command
>> shows that make
>> is correctly using .../src/foo.cpp through the vpath directives.
>>
>> My question is, why did make not find .../src/foo.cpp in the course
>> of the original invokation of make?
>
> 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?
--
View this message in context:
http://old.nabble.com/Inconsistent-use-of-vpath-tp33951080p33955695.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.