autotools归纳

最近接触到许多linux项目,其编译都是使用的autotools。
autotools是一个自动化的编译工具。个人理解它的最主要功能就是生成Makefile。
因为直接写Makefiel,其依赖关系还是比较复杂的。

一般的我们下载的源码包只要通过以下3条命令,就可完成编译和安装:
./configure
make
sudo make install

但是autotools其本来还是非常复杂的,下面给出参考
以下是命令列表:
autoscan        扫描给定的目录及其子目录,以搜寻普通的可移植性问题,比如检查编译器,库,头文件等。
                生成的configure.scan是configure.ac文件的原型。

aclocal         是一个收集宏的过程。
                将已经安装的宏、用户定义宏和acinclude.m4文件中的宏集中定义到文件aclocal.m4中。

autoheader      生成宏定义的模板文件config.h.in。
                宏定义模板文件被后面的命令所需要。

automake        根据configure.ac和Makefile.am中定义的结构,生成Makefile.in文件。

libtoolize      如果在configure.ac中定义了一些特殊的宏,比如AC_PROG_LIBTOO,automake将会调用此命令。

autoconf        生成configure脚本文件。

make distclean  清除所有生成的文件

./configure     生成Makefile。

make            编译。

make install    把程序安装到系统目录中去。

make uninstall  卸载程序。

make clean      清除生成的目标文件及过程中产生的文件。

make distclean  清除所有产生的文件。

make dist       将程序和相关的文档打包为一个.tar.gz压缩文件以供发布。

autoupdate      如果更新了Autoconf工具的版本,此命令可更新configure.in。
autoreconfig    如果更新了Autoconf工具的版本,此命令可更新产生的配置文件。
ifname          扫描C源程序文件,在标准输出上输出那些出现在#if,#elif,#ifdef或#ifndef中的标识符,
                每个标识符显示为一行,其后跟一空格和所属的文件名。

command       input              output
--------------------------------------------------
autoscan      [source]           configure.scan
                                 autoscan.log

aclocal       configure.ac       aclocal.m4

autoheader    aclocal.m4         autoconfig.h.in

automake      configure.ac       INSTALL
              makefile.am        Makefile.in
                                 COPYING
                                 install-sh
                                 missing
                                 mkinstalldirs
                                 stamp-h.in

libtoolize                       config.guess
                                 config.sub
                                 ltmain.sh
                                 ltconfig

autoconf      configure.ac       configure
              aclocal.m4
              autoconfig.h.in


command         input                      output
-----------------------------------------------------------------
configure       configure                  Makefile
                Makefile.in                config.h
                cofnig.h.in                config.log
                XXXXX.pc.in                config.status
                XXXXX-uninstalled.pc.in    libtool
                                           XXXXX.pc
                                           XXXXX-uninstalled.pc
                                           stamp-h1

make            Makefile

make install    Makefile

make uninstall  Makefile

make clean      Makefile

make distclean  Makefile

make dist       Makefile
原文地址:https://www.cnblogs.com/the-capricornus/p/3834456.html