Install configuration files and log files with automake

Let's say I have a project like this:

(dev dir)
- README
- INSTALL
/ src
  - blah.cpp
  - blah.hpp
/ conf
  - blah_one.xml
  - blah_two.xml

I installed configure.ac and Makefile.am to install binaries in (/ usr / local) / bin. configure.ac is something like:

AC_INIT([blah], [0.1])
AC_PREREQ([2.67])
AM_INIT_AUTOMAKE([1.11])
AC_CONFIG_SRCDIR([src/blah.cpp])
AC_PROG_CXX
AC_LANG([C++])
AC_HEADER_STDC
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_OUTPUT

... a makefile is something like

SUBDIRS = src

... and src / Makefile.am something like

bin_PROGRAMS = blah
blah_SOURCES = blah.cpp blah.hpp

Everything works and "make install" installs the binary correctly in (/ usr / local) / bin.

Now:

I want to expand them to make the "make install" command (after configuration, assembly, and in general) install the blah_one.xml and blah_two.xml configuration files under / etc / blah and prepare the log directory under / var / log / blah /

What is the right way to do this?

+5
source share
1 answer

Ok, I would do this:

blahconfdir=$(sysconfdir)/blah
blahconf_DATA = blah_one.xml blah_two.xml
blahlogdir = $(localstatedir)/log/blah

then when setting up:

./configure --sysconfdir=/etc --localstatedir=/var

"", , , .

+8

All Articles