[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33085: using myprog_CXXFLAGS with VPATH prevents Makefile from findi
From: |
Nick Bowler |
Subject: |
bug#33085: using myprog_CXXFLAGS with VPATH prevents Makefile from finding sources |
Date: |
Thu, 18 Oct 2018 16:40:29 -0400 |
Hello,
On 10/18/18, Julien COURTAT <address@hidden> wrote:
> Here's my bug report, I'm building my software out of the source tree, this
> is called parallel build (very nice feature).
> The way to reproduce the issue is very simple, set myprog_CXXFLAGS = -DANY
> and address@hidden@ and the corresponding Makefile won't find my source file.
> Replace myprog_CXXFLAGS by AM_CXXFLAGS and it works well.
> Autoconf 2.69, automake 1.13.4
[...]
> Makefile.am :
> bin_PROGRAMS=myprog
> myprog_SOURCES = Main.cpp
> myprog_CXXFLAGS = -DANY
> AM_CPPFLAGS = address@hidden@
> address@hidden@
Don't set VPATH like this. It supersedes the definition supplied by
Automake and is almost certainly the cause of your problems.
The GNU build system has built-in support for out-of-tree builds like
this. What you do is cd to a new directory, then run configure from
there. For example:
mkdir build && cd build && /path/to/configure [blah blah] && make
Then everything should Just Work™ (provided you don't override VPATH
like the above). You can use $(top_srcdir), $(srcdir), $(top_builddir)
and $(builddir) to refer to files in particular locations (e.g. for
include paths).
See the Automake manual, §2.2.6 "Parallel Build Trees (a.k.a. VPATH
Builds)"[1] for more information.
[1] https://www.gnu.org/software/automake/manual/automake.html#VPATH-Builds
Hope that helps,
Nick