使用autoconf生成Makefile.in文件
来源:互联网 发布:免费建站 知乎 编辑:程序博客网 时间:2024/06/05 04:03
来源:http://stackoverflow.com/questions/2531827/what-are-makefile-am-and-makefile-in
Makefile.am is a programmer-defined file and is used by automake to generate the Makefile.in file (the .am stands for automake). The configure script typically seen in source tarballs will use the Makefile.in to generate a Makefile.
The configure script itself is generated from a programmer-defined file named either configure.ac or configure.in (deprecated). I prefer .ac (for autoconf) since it differentiates it from the generated Makefile.in files and that way I can have rules such as make dist-clean which runs rm -f *.in. Since it is a generated file, it is not typically stored in a revision system such as Git, SVN, Mercurial or CVS, rather the .ac file would be.
Read more on GNU Autotools. Read about make and Makefile first, then learn about automake, autoconf, libtool, etc.
Simple example
Shamelessly adapted from: http://www.gnu.org/software/automake/manual/html_node/Creating-amhello.html and tested on Ubuntu 14.04 Automake 1.14.1.
Makefile.am
SUBDIRS = src
dist_doc_DATA = README.md
README.md
Some doc.
configure.ac
AC_INIT([automake_hello_world], [1.0], [bug-automake@gnu.org])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
src/Makefile.am
bin_PROGRAMS = autotools_hello_world
autotools_hello_world_SOURCES = main.c
src/main.c
#include <config.h>
#include <stdio.h>
int main (void) {
puts ("Hello world from " PACKAGE_STRING);
return 0;
}
Usage
autoreconf --install
mkdir build
cd build
../configure
make
sudo make install
autoconf_hello_world
sudo make uninstall
This outputs:
Hello world from automake_hello_world 1.0
Notes
autoreconf --install generates several template files which should be tracked by Git, including Makefile.in. It only needs to be run the first time.
make install installs:
the binary to /usr/local/bin
README.md to /usr/local/share/doc/automake_hello_world
阅读全文
0 0
- 使用autoconf生成Makefile.in文件
- 使用autoconf和automake生成Makefile文件
- 使用Automake,Autoconf生成Makefile
- 使用Automake,Autoconf生成Makefile
- 使用Automake,Autoconf生成Makefile
- 如何使用autoconf,automake,libtool自动生成Makefile文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- autoconf 和automake生成Makefile文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- autoconf 和automake生成Makefile文件
- autoconf 和automake生成Makefile文件
- autoconf 和automake生成Makefile文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- 在CentOS上安装phpMyAdmin的教程
- SO_REUSEADDR和SO_REUSEPORT异同
- Python的多线程
- Prim算法求最小生成树
- 解决zabbix在configure时候遇到的问题(Ubuntu)
- 使用autoconf生成Makefile.in文件
- Linux创建线程的属性设置
- 1970年计算的时间转日期
- 简单电路实验
- mysql复合主键如何设定自增长属性
- java用递归方法返回文件下的所有子目录
- mysql的数据类型
- 7816 ATR解析
- 一个好用的askII码对照表