使用 automake 安装配置文件和日志文件
假设我有一个这样的项目:
(dev dir)
- README
- INSTALL
/ src
- blah.cpp
- blah.hpp
/ conf
- blah_one.xml
- blah_two.xml
我制作了一个configure.ac和Makefile.am来在 (/usr/local)/bin 下安装二进制文件。 configure.ac 类似于:
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 类似于
SUBDIRS = src
... src/Makefile.am 类似于
bin_PROGRAMS = blah
blah_SOURCES = blah.cpp blah.hpp
它一切正常,并且“make install”正确地将二进制文件安装在 (/usr/local)/bin 下。
现在:
我想扩展这些命令“make install”(在配置、构建等之后)在 /etc/blah 下安装配置文件 blah_one.xml 和 blah_two.xml,并在 /var 下“准备”日志目录/log/blah/
正确的方法是什么?
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 install 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我会这样做:
然后当您配置时: 在
不知道“准备”步骤的详细信息的情况下,很难知道需要发生什么以及如何让它发生。
Well, I'd do this:
then when you configure:
Without knowing details of your "prepare" step, it's hard to know what needs to happen, and how to get it to happen.