automake等自动生成makefile 的相关有用文档
Automake 使用手册 https://blog.csdn.net/wangxiaoqin00007/article/details/35225783
图解acloal autoheader automake https://my.oschina.net/qihh/blog/66113
makefile.am 与configure.ac 的编译过程 https://blog.csdn.net/dingtao7890/article/details/53749493
makefile.am 规则和实例 详解 https://www.jianshu.com/p/2f5e586c3402
makefile学习笔记 https://blog.csdn.net/edisonlg/article/details/7171641
自动生成makefile流程
如图所示为automake,autoconf生成makefile的过程(简化)。
为一个项目源文件生成makefile并make的步骤如下:
操作在包含源文件的项目目录下进行。
(1). 运行autoscan,生成文件configure.scan。
(2). 修改configure.scan,改名为configure.in。
(3).运行autoheader,生成文件configure.h.in(现在一般改为configure.ac)。configure.in里有宏AC_CONFIG_HEADER()时用。
(4).运行libtoolize,生成一些支持文件,ltmain.sh。需要用libtool生成共享库用。
(5).运行allocal,生成aclocal.m4。
(6). 运行autoconf,生成configure。
(7).为源文件编写makefie.am,每一个包含源文件的目录和子目录都有一个makefile.am。
(8).运行automake,生成makefile.in,每个包含makefile.am的子目录都生成makefile.in。
automake -a选项可以补齐文件config.guess,config.sub,install-sh,missing,depcomp。
(9).运行./configure,生成config.status,config.h,makefile。
(10).运行make,生成中间文件对象文件,库文件,最后生成可执行文件。
(11).运行make install,相应的可执行文件,库文件,头文件拷贝到系统相应位置。