Android系统开发(4)——Autotools

Autotools工具的构成

1、autoscan

autoscan是用来扫描源代码目录生成configure.san文件的,configure.san包含了系统配置的基本选项,里面都是一些宏定义,我们需要将它的名字改为configure.in

2、aclocal

aclocal是一个perl脚本程序。aclocal根据configure.in文件内容自动生成aclocal.m4文件,生成的aclocal.m4文件是宏展开文件。

3、autoconf

autoconf是用来产生configure文件的,configure.in文件的内容是一些宏,这些宏经过autoconf处理后会变成检查系统特性、环境变量、软件必须的参数的shell脚本。

4、autohead

自动生成config.h.in

5、automake

使用automake-add-missing来产生Makefile.in.

Document address:https://www.gnu.org/software/autoconf/manual/autoconf.html

Files used in preparing a software package for distribution, when using just Autoconf:

     your source files --> [autoscan*] --> [configure.scan] --> configure.ac
     
     configure.ac --.
                    |   .------> autoconf* -----> configure
     [aclocal.m4] --+---+
                    |   `-----> [autoheader*] --> [config.h.in]
     [acsite.m4] ---‘
     
     Makefile.in

Additionally, if you use Automake, the following additional productions come into play:

     [acinclude.m4] --.
                      |
     [local macros] --+--> aclocal* --> aclocal.m4
                      |
     configure.ac ----‘
     
     configure.ac --.
                    +--> automake* --> Makefile.in
     Makefile.am ---‘

Files used in configuring a software package:

                            .-------------> [config.cache]
     configure* ------------+-------------> config.log
                            |
     [config.h.in] -.       v            .-> [config.h] -.
                    +--> config.status* -+               +--> make*
     Makefile.in ---‘                    `-> Makefile ---‘

Autotools过程演示

1、autoscan
修改configure.san文件名为configure.ac或者configure.in,打开配置我们生成makefile的信息。
2、aclocal
执行autoconf命令来生成configure可执行文件,并新建一个Makefile.am来编辑内容
  1. bin_PROGRAMS = hello  
  2. hello_SOURCES = hello.c  

安装软件

执行make命令和sudo make install
去/usr/local/bin下面执行我们的可执行文件hello

生成压缩包

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。