Hello,

I have a little problem with Automake to handle the subdirectories when
installing headers.

Here is roughly the project hierarchy that I have:

foo/
  foo-bin/
    Makefile.am
    ...
  foo-tests/
    Makefile.am
    ...
  foo-lib/
    Makefile.am
    include/
      foo/
        header1.h
        subdir/
          header2.h
    src/
      file1.cpp

Nothing too fancy, there is a root directory containing the configure.ac,
and 3 subdirectories for the shared library, the main binary, and the tests.

The interesting part here is project-lib/. It contains the library that the
binary and tests link to.

Since I want to be able to generate the configure files out of the source
tree, I've settled to use $top_srcdir relative path in my Makefile.am.

Here is what it looks like:

libfoo_la_SOURCES = \
  $(top_srcdir)/foo-lib/src/file1.cpp

pkginclude_HEADERS = \
  $(top_srcdir)/foo-lib/include/foo/header1.h \
  $(top_srcdir)/foo-lib/include/foo/subdir/header2.h

Without these $top_srcdir relative path, I have problems when I try to use
the foo-lib from foo-bin, or when I try to generate the project out of the
source tree.

Now the problem: when installing these headers, they end up being flattened!
That is, I end up with:

$prefix/include/foo/header1.h
$prefix/include/foo/header2.h

While I was expecting:

$prefix/include/foo/header1.h
$prefix/include/foo/subdir/header2.h

So I assume that is what nobase_ is supposed to achieve, but since the path
I use are not relative to the Makefile.am, but to $top_srcdir, I end up
with the whole $top_srcdir path being copied:

$prefix/include/foo-lib/include/foo/header1.h
$prefix/include/foo-lib/include/foo/subdir/header2.h

which is clearly not what is expected.

Any thoughts and advises on this are greatly appreciated :)
If you need access to the real Makefile.am files, instead of the canonical
examples, the project is here:
https://github.com/NewbiZ/crashburn

Thanks so much for reading.
Aurelien

Reply via email to