makefile 的使用
2015-12-14 23:00
204 查看
查看makefile的版本 make -v
安装 sudo apt-get install apt-get install make
大型项目 都是使用makefile来管理编译的
文件名 必须命名为Makefile
内容如下(ps:必须要制表符tab键来)
demo2.out:max.o min.o demo2.c
gcc max.o min.o demo2.c -o demo2.out
max.o:max.c
gcc -c max.c -o max.o
min.o:min.c
gcc -c min.c -o min.o
demo2.c的源文件如下
#include <stdio.h>
#include "max.h"
#include "min.h"
int main()
{
int a=13;
int b=14;
int c=max(a,b);
int d=min(a,b);
printf("the max number is %d\n the min number is %d",c,d);
return 0;
}
执行make 则开始编译,生成了min.o max.o 和demo2.out
执行 ./demo2.out 就可以看到运行结果了。
安装 sudo apt-get install apt-get install make
大型项目 都是使用makefile来管理编译的
文件名 必须命名为Makefile
内容如下(ps:必须要制表符tab键来)
demo2.out:max.o min.o demo2.c
gcc max.o min.o demo2.c -o demo2.out
max.o:max.c
gcc -c max.c -o max.o
min.o:min.c
gcc -c min.c -o min.o
demo2.c的源文件如下
#include <stdio.h>
#include "max.h"
#include "min.h"
int main()
{
int a=13;
int b=14;
int c=max(a,b);
int d=min(a,b);
printf("the max number is %d\n the min number is %d",c,d);
return 0;
}
执行make 则开始编译,生成了min.o max.o 和demo2.out
执行 ./demo2.out 就可以看到运行结果了。
相关文章推荐
- NSURLSession基础
- iOS开发UI篇—核心动画(基础动画)
- 数学魔术
- CSS3阴影 box-shadow的使用和技巧总结
- 使用C#连接ORACLE数据库
- 给jdk写注释系列之jdk1.6容器(2)-LinkedList源码解析
- Session 与 Cookie
- Hbase存储详解
- iOS平台下的内存管理和一些内存检测的实用方法
- 海量数据处理
- AdapterView及子类的相关学习整理
- Android笔记:ListView 显示(数据变化后滚动到)最底部。
- vim配置
- AngularJS 指令
- 第三阶段第一天
- void指针类型
- 学习popupmenu
- Java学习笔记(4):2.数组
- 【软件工程】1.软件工程概述
- toggle界面转化(UGUI)