[Top][All Lists]
[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: |
Mon, 4 Jun 2012 20:01:28 -0700 |
On Sun, Jun 3, 2012 at 11:29 PM, normvcr <address@hidden> wrote:
...
> I think you have hit the nail on the head. I checked and, indeed,
> $@ is foo.cpp, but I want to build $(srcdir)/foo.cpp . The rule has been
>
> %.cpp: %.h
> Do stuff which results in $(srcdir)/foo.cpp
>
> So, I tried
>
> $(srcdir)/%.cpp: %h
> Do same kind of stuff
>
> but it did not match on this rule.
>
> As you can surmise, I am generating the .cpp file from the .h file,
> and I also keep my object code in a different folder than the source
> code, so that is why I am running make not in the source directory,
> but in the object directory.
>
> Can you suggest how to construct a rule that would match?
Why do you want to put a generated file in the source tree instead of
the object tree? The "source" file in this case is the .h file; the
.cpp file is an object file as much as the .o file that is generated
from the .cpp, which will itself be Just Another Input to generating
the executable or library.
So, keep the rule as "%.cpp: %.h", but fix it to write to address@hidden Then
change any $(srcdir)/foo.cpp references to just foo.cpp
Philip Guenther