Hello, On 10/18/18, Julien COURTAT <julien.cour...@aqsacom.com> 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 VPATH=@MYDIR@ 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 = -I@MYPROG_PATH@ > VPATH=@MYPROG_PATH@
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