深入浅出 Makefile 简单实现
来源:互联网 发布:wamp php 环境变量 编辑:程序博客网 时间:2024/05/22 00:48
最近在看makefile规则,简单写了一个sample code 验证了一把
首先是代码目录架构,有A /B /C 三个文件夹:
A文件夹中的代码如下:
Ahello.c
#include <stdio.h>void ahello(const char *name){ printf("----AAAA---I am in Hello %s!\n", name);}Ahello.h
void ahello(const char *name);
C文件夹中的代码如下:
Chello.c
#include <stdio.h> void chello(const char *name){ printf("---CCCC---I am in Hello %s!\n", name);}Chello.h
void chello(const char *name);
main.c:
#include "../A/Ahello.h"#include "../C/Chello.h"int main(){ ahello("everyone"); chello("everyone"); return 0;}Makefile;
valuable:=main.o ../A/Ahello.o ../C/Chello.ohello:$(valuable) gcc -o hello $(valuable)main.o:main.c gcc -c main.cAhello.o:../A/Ahello.c gcc -c ../A/Ahello.cChello.o:../C/Chello.c gcc -c ../C/Chello.cclean: rm hello $(valuable)
在B中执行make 命令生成如下的目录结构:
执行./hello 输出:
----AAAA---I am in Hello everyone!
---CCCC---I am in Hello everyone!
参考博客:http://blog.csdn.net/ruglcc/article/details/7814546/#t30
0 0
- 深入浅出 Makefile 简单实现
- 深入浅出Android makefile
- 深入浅出Android makefile
- Makefile编写及一个简单的Makefile架构实现
- 一个简单的通用Makefile实现
- 一个简单的通用Makefile实现
- Makefile解析和简单的进度条实现
- 【Linux】简单的makefile和进度条实现!!
- 深入浅出Android makefile(1)--初探
- 深入浅出Android makefile(2)--LOCAL_PATH
- 深入浅出Android makefile(3)--LOCAL_SRC_FILES
- makefile的全面深入浅出教程
- 深入浅出Android makefile(1)--初探
- 深入浅出Android makefile(1)--初探
- 深入浅出Android makefile(3)--LOCAL_SRC_FILES
- 深入浅出Android makefile(1)--初探
- 深入浅出Android makefile(4)--LOCAL_STATIC_LIBRARIES
- 深入浅出Android makefile(5)--BUILD_HOST_EXECUTABLE
- Java复杂Json转成实体
- java读写文件
- linux命令行-wget
- Phpstorm 调试ThinkPHP项目
- jQery easyUI 刷新当前tab
- 深入浅出 Makefile 简单实现
- 技术债务和技术投资
- mysql主键怎么恢复从1开始呀
- 内省
- [转载]CSS 中为了兼容浏览器的前缀
- Android Java汉字转拼音总结
- openvswitch2.1.2源码安装及rpm打包
- swift基础语法(二)
- Git简介