开发者

Configuration files and log files installation with automake

Let's say I have a project like that:

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

I made out a configure.ac and Makefile.am to install binaries under (/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

... Makefile is something like

SUBDIRS = src

...and src/Makefile.am is something like

bin_PROGRAMS = blah
blah_SOURCES = blah.cpp blah.hpp

It all works, and "make install" correctly install the binary under (/usr/local)/bin.

Now:

I want extend these to make the command "make install" (after configure, build and whatsoever) to instal开发者_开发问答l configuration files blah_one.xml and blah_two.xml under /etc/blah, and to "prepare" a log directory under /var/log/blah/

What is the correct way to do it?


Well, I'd do this:

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

then when you configure:

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

Without knowing details of your "prepare" step, it's hard to know what needs to happen, and how to get it to happen.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜