Linux Makefile自动生成--总体流程

来源:互联网 发布:中国外交有多阴险知乎 编辑:程序博客网 时间:2024/06/12 23:38

原始出处:http://blog.csdn.net/spch2008/article/details/12504705


步骤一:

[plain] view plain copy
 print?
  1. your source files --> [autoscan*] --> [configure.scan] --> configure.ac  
autoscan扫描源文件,生成configure.scan,手动更改成configure.ac。内有各种宏定义,用于检测系统环境。

步骤二:

[plain] view plain copy
 print?
  1. [acinclude.m4] --.  
  2.                  |  
  3. [local macros] --+--> aclocal* --> aclocal.m4  
  4.                  |  
  5. configure.ac ----’  
aclocal首先加载本地能够查找到的宏定义,然后扫描configure.ac,将configure.ac中使用的宏从加载的文件中拷贝到aclocal.m4中。

注意:只要用到了某个宏,即将存放该宏的文件中的内容全部拷贝到aclocal.m4中。

步骤三:

[plain] view plain copy
 print?
  1. configure.ac --.  
  2.                |   .------> autoconf* -----> configure  
  3. [aclocal.m4] --+---+  
  4.                |  ‘-----> [autoheader*] --> [config.h.in]  
  5. [acsite.m4] ---’  
autoconf通过aclocal.m4,acsite.m4,将configure.ac中的宏展开,形成configure文件。

而autoheader则根据configure.ac中的宏AC_CHECK_FUNC形成config.h.in模板。该步骤主要用于代码移植,将在后续文章中介绍。

步骤四:

[plain] view plain copy
 print?
  1. configure.ac --.  
  2.                +--> automake* --> Makefile.in  
  3. Makefile.am ---’  
Makefile.am需要用户提供,用于对生成的Makefile进行配置。

步骤五:

[plain] view plain copy
 print?
  1.         .-------------> [config.cache]  
  2. --------+-------------> config.log  
  3.         |  
  4. .       v            .-> [config.h] -.  
  5. +--> config.status* -+               +--> make*  
  6. ’                  ‘-> Makefile ---’  

运行./configure,生成config.log,config.status,后者接受config.h.in, Makefile.in,生成config.h,Makefile。


我觉得可以这样认为,.in文件为配置文件,用户可以进行一些更改。


0 0