首页 > 其他 > 详细

Makefile入门1

时间:2019-12-24 18:17:28      阅读:88      评论:0      收藏:0      [点我收藏+]

Linux中的编译脚本Makefile的讲解设计

 

概念

编译控制脚本(.c.h----->bin)

Makefile最终要的是清晰编译链接的整个过程

Makefile的优化设计

工作原理

make qmake cmake makefile Makefile make

编译流程

1.预编译
gcc -E hello.c -o hello.i
目的:展开宏定义,引入头文件
2.汇编
gcc -s hello.i -o hello.s
目的:将c语言转换为汇编代码
3.编译
gcc -c hello.s -o hello.s
4.链接

显式规则

target:dep
command
hello.i:hello.c
    gcc -E hello.c -o hello.i
hello.s:hello.i
    gcc -S hello.i -o hello.s
hello.o:hello.s
    gcc -C hello.s -o hello.o

变量

OBJ=

OBJ:=

OBJ+=

伪目标

.PHONY:

98

通配符

%*?

%任意一个

?匹配

*所有

%.c

*.c

$@:代表目标文件

$^:代表依赖文件

$<:代表第一个依赖文件

98

Makefile入门1

原文:https://www.cnblogs.com/liugangjiayou/p/12092544.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!