I'm currently working on a C++ project which relies on recursive automake for building.
I want to build a shared library and the Makefile.am
in the src
directory of the library looks like
# ...
# Library name
lib_LTLIBRARIES = libadapter-@MY_API_VERSION@.la
# Sources
libadapter_@MY_API_VERSION@_la_SOURCES = \
$(top_builddir)/src/sourceA.cpp \
$(top_builddir)/src/sourceB.cpp
# ...
Since version 1.14, automake issues a warning when the subdir-objects
option is not specified in AM_INIT_AUTOMAKE
in configure.ac
. However, adding the subdir-objects
option seems to break the build process with make
complaining about missing .Plo
files. I already searched the web for people experiencing similar problems but did not find any sensible hint on how to resolve the issue without changing the project to a non-recursive one. Any help is greatly appreciated.
EDIT:
Diving more deeply into the problem, I noted that ./configure
creates a directory literally named $(top_builddir)
below the current source directory of the library, which contains all the required .Plo
files for building the library. In the Makefile
, however, I found that the .Plo
equivalents of my library sources (sourceA.cpp
and sourceB.cpp
in the example) are prefixed by include $(top_builddir)/src/$(DEPDIR)/
and $(top_builddir)
is a variable defined as a relative path (namely, ../../../src/.deps/
). Now it becomes clear why make
can't find the .Plo
files because it searches the wrong directory. This looks like a possible duplicate of bug #16375. Any workarounds?
EDIT 2:
Digging further in the web revealed two more threads which address the issue: #1327 and automake-bug. A known workaround seems to be passing the --disable-dependency-tracking
option to ./configure
. At least for me it works.