Makefile入门1

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

通配符

%*?

扫描二维码关注公众号,回复: 8299020 查看本文章

%任意一个

?匹配

*所有

%.c

*.c

$@:代表目标文件

$^:代表依赖文件

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

98

猜你喜欢

转载自www.cnblogs.com/liugangjiayou/p/12092544.html
今日推荐