没有makefile的日子
<1>. 没有makefile的日子
[上一篇]中介绍了makefile的编写规则,第一个标题是“没有makefile的日子”,收到[博客园]的网友zhuangzhuang1988的回复可以使用automake来自动生成makefile。如果在linux下从源代码安装过程序的话,通常的过程是这样:
./configure; make; make install
下面我们将试图如何生成这种发行版本,这里面主要使用到了aclocal, automake等工具。
1. 现在假设程序源代码已经编写完成,这里是main.c
[email protected]:~/automake/helloworld$ ls
2. 运行autoscan,此时将生成autoscan.log,configure.scan两个文件。
[email protected]:~/automake/helloworld$ autoscan
3. 我们将configure.scan作为configure.in文件的模板,以供aclocal来使用。首先将configure.scan改名为configure.in
[email protected]:~/automake/helloworld$ mv configure.scan configure.in
[email protected]:~/automake/helloworld$ vim configure.in
5. 运行autoconf命令,将生成configure文件。
[email protected]:~/automake/helloworld$ autoconf
[email protected]:~/automake/helloworld$ vim Makefile.am
8. 下面开始测试一下上面生成的文件。
[email protected]:~/automake/helloworld$./configure
通过使用这些工具,只要编写简单的几个文件就能生成Makefile,编译源代码。
<2>. 参考资料及代码下载
IBM例解 autoconf 和 automake 生成 Makefile 文件
作者:许强(就读于[哈尔滨工业大学(威海)软件学院])出处:[http://xuqiang.cnblogs.com]
1. 本博客中的文章均是个人在学习和项目开发中总结。其中难免存在不足之处 ,欢迎留言指正。 2. 本文版权归作者和博客园共有,转载时,请保留本文链接。