Search code examples
hdf5automakelibtool

how to change where automake installs a libtool library?


I am working on a free software project: https://github.com/ccr/ccr

In this project I am building some shared-object libraries which are actually plugins for HDF5.

I don't want to install these libraries in /usr/local/lib. I want to install them in a special HDF5 plugin directory.

Here's what I have now:

AM_CPPFLAGS = -I$(HDF5_ROOT)/include -I$(BZ2_ROOT)/include
plugindir = /usr/local/hdf5/lib/plugin

# The libh5bz2 library for plugin module.
# Build it as shared library.
lib_LTLIBRARIES = libh5bz2.la
libh5bz2_la_SOURCES = H5Zbzip2.c

LDFLAGS = -L$(BZ2_ROOT)/lib

How do I get my library installed in plugindir?


Solution

  • the prefix (lib_) determines the installation path ($libdir). You can setup your own prefix:

    plugindir = ${prefix}/hdf5/lib/plugin
    plugin_LTLIBRARIES = libh5bz2.la
    

    sidenote: don't hardcode the full path in your Makefile. instead use the predefined variables. e.g. instead of /usr/local/hdf5/lib/plugin use something like ${prefix}/hdf5/lib/plugin, to allow users to easily change the actual installation path..