转自:https://blog.csdn.net/yygydjkthh/article/details/43318461
/********************************************************************* * Author : Samson * Date : 01/30/2015 * Test platform: * 3.13.0-24-generic * GNU bash, 4.3.11(1)-release * *******************************************************************/
它们这三个东东是怎么来的呢?
Makefile.am: 是一些编译的选项及要进行编译的文件项等,例如:
bin_PROGRAMS=test
lib_LIBRARIES = libhand.a
libhand_a_SOURCES = hand.c
libhand_a_SOURCES = hand.c
Makefile.in: 在automake手册中是这样说:while automake is in charge of creating Makefile.ins from Makefile.ams and configure.ac. 意思是Makefile.in是由Makefile.am和configure.ac的基础之上而生成的。
Makefile: 使用生成的configure脚本根据Makefile.in中的内容进行生成的最终进行程序或库编译的规则文件;
关系图如下,(此图来自网络)
![](https://app.yinxiang.com/shard/s39/res/0a35940f-f270-4758-ba69-23697ecae043/22307085_1.jpg.gif)
此图参考:
automake 读取 Makefile.am 来产生 Makefile.in,
configure 读取 Makefile.in 来产生 Makefile
configure 脚本通常由 autoconf 读取 configure.in 产生
还有aclocal….
目的就是让程序员只写一个规则:.am文件/或.in文件,
就能生成适合各种配置/平台的Makfiles。
如果你写过Makefile,你就知道手工写一个放之四海而皆准的Makefile是多痛苦了。
当然这个Makefile的目的不是编译helloworld之类的小程序,呵呵