On Sun, Jun 3, 2012 at 8:46 PM, normvcr <norm...@telus.net> wrote:
> Philip Guenther-2 wrote:
...
>> I believe the most common cause of this is because some makefile rule
>> builds a file other than $@.  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* $@.  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

_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to