automake:autotools 工具集使用速成
automake:autotools 工具集使用速成 一般而言,对于小项目或玩具程序,手动编写 Makefile 即可。但对于大型项目,手动编写维护 Makefile 成为一件费时费力的无聊工作。 本文介绍 autotools 工具集自动生成符合 Linux 规范的 Makefile 文件。 如果读者没有安装 autotools 工具集,ubuntu默认自带了,如果没有,安装命令如下, $ sudo apt-get install automake 安装完成之后,会有如下工具可用, 一般大型项目,代码组织结构分为两种,一种是所有文件都在同一个目录下的 flat 结构,另一种是按层次组织的多文件夹形式。 先来看第一种: flat 结构的项目使用 autotools 工具集 本篇测试代码如下, #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "sum.h" #include "sub.h" #include "mul.h" #include "div.h" int main() { printf("======== < Integer Arithmethic > ========\n"); int x, y; printf("Enter two integer: "); scanf("%d%d",