automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

vpath builds and nobase_include_HEADERS


From: johnwohlbier
Subject: vpath builds and nobase_include_HEADERS
Date: Wed, 03 Jun 2009 22:24:29 +0000

I'm having troubles with out of tree (vpath) builds, using nobase_include_HEADERS, and *.in files processed by configure.

I have a collection of components in a component library.

src/
src/lib1/
Makefile.am
header1.hh
types.hh.in
source1.cc
src/lib2/
Makefile.am
header2.hh
source2.cc

I want to do out of tree (vpath) builds, and maintain the directory structure of the components for the headers on install.

First, in order to preserve the directory structure for the headers on install, I added rules such as these to the Makefile.am's

from lib1/Makefile.am

nobase_include_HEADERS = \
$(header_file_list)

lib1/header1.hh : lib1
for file in $(header_file_list) ; do \
nobase_file="`echo $$file | sed -e 's?lib1/??'`" ; \
$(LN_S) -f @HOST_ACDIR@/src/lib1/$$nobase_file lib1/. ; \
done

lib1 :
mkdir lib1;

where $(header_file_list) has the directory name in the file name and @HOST_ACDIR@ points to the location of configure.

This of course makes a directory lib1 in my current lib1 build dir and makes soft links to the header files in the source tree. Then on a make install it puts the headers in the place I want, ie, $prefix/include/lib1.
I have such a snippet for all of my components.

One additional aspect of this is that my source tree has a types.hh.in which is processed by configure and placed in the build directory. I have an additional rule that links the processed file into my lib1 subdirectory for install.

Now, the problem is that in lib2 headers/sources I want to have includes such as
#include <lib1/header1.hh>
#include <lib1/types.hh>

And of course I want my -I include path to point to the build location of these headers since some of them have been processed by configure, ie, types.hh.in -> types.hh

The trouble is that as part of my effort to get the nobase_include_HEADERS feature for installing headers in subdirectories, is that those headers now live in lib1/lib1 due to the targets in my Makefile.am and the code won't compile with -I$(top_builddir)/lib1.

This all seems very complicated and it most definitely seems like this combination of vpath/nobase_include_HEADERS/types.hh.in is a pretty usual combination that I shouldn't have to stand on my head for to make it work.

Any suggestions on how better to do this? I hope my explanation of the directory and file layout above is sufficient to convey what I'm trying to do.

Thanks much.

jgw


reply via email to

[Prev in Thread] Current Thread [Next in Thread]