On 2014-03-20 14:12 +0200, Aurélien Vallée wrote:
[snip exposition]
> 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
[...]
> 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

Yes, this is the documented behaviour.

> While I was expecting:
> 
> $prefix/include/foo/header1.h
> $prefix/include/foo/subdir/header2.h

OK.

> 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

Sortof.  The nobase_ option replicates the hierarchy in your source
tree, which IMO is pretty useless but that's what it does.

> which is clearly not what is expected.

You need a directory variable for each directory you wish to install
files into.  See the Automake manual for details, start with §3.3 The
Uniform Naming Scheme[1].

Something like this (untested):

  foosubdir = $(pkgincludedir)/subdir
  
  pkginclude_HEADERS = path/to/header1.h
  foosub_HEADERS = path/to/header2.h

[1] https://gnu.org/software/automake/manual/automake.html#Uniform

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)

Reply via email to