5规则中的命令

bash 复制代码
一条规则可以有多行命令,按顺序执行

使用@不在终端打印命令本身
Normally make prints each line of the recipe before it is executed.
When a line starts with '@', the echoing of that line is suppressed.
The '@' is discarded before the line is passed to the shell.

默认情况下,每一行命令都在一个单独的shell中被执行

Makefile中命令扩展使用$(shell command)或者`command`,不要使用$(),$()是用来引用Makefile中的变量
-i:忽略过程中的错误,继续执行
bash 复制代码
To ignore errors in a recipe line, write a '-' at the beginning of the line's text.
clean:
	-rm -f *.o
This causes make to continue even if rm is unable to remove a file.
bash 复制代码
make -C sub_dir#进入sub_dir中, 执行make命令
make -C sub_dir <target_name>#进入sub_dir中, 执行make命令, 指定target

#执行make -C sub_dir会打印下面信息,[]中的数字表示递归的层级
make[1]: Entering directory 'sub_dir的实际绝对路径'
在sub_dir目录下执行make产生的日志
make[1]: Leaving directory 'sub_dir的实际绝对路径'

https://www.gnu.org/software/make/manual/html_node/Recursion.html

https://www.gnu.org/software/make/manual/html_node/_002dw-Option.html

https://www.gnu.org/software/make/manual/html_node/Echoing.html

相关推荐
边疆.15 小时前
【Linux】自动化构建工具make和Makefile和第一个系统程序—进度条
linux·运维·服务器·makefile·make
LostSpeed16 天前
debug - MDK - arm-none-eabi - 从MDK工程做一个makefile工程出来
makefile·bat·mdk·arm-none-eabi
DebugKitty2 个月前
硬件开发2-ARM裸机开发1-I.MX6ULL - 汇编点灯
汇编·makefile·imax6ull·gpio·电路复用
Joy-鬼魅2 个月前
使用 qmake 生成 Makefile,Makefile 转换为 Qt 的 .pro 文件
qt·makefile
java叶新东老师3 个月前
Makefile if语句用法
c++·makefile
白又白、3 个月前
makefile-- 其他函数
makefile
潇-xiao4 个月前
Makefile的通用模板 + 倒计时小程序(13)
linux·makefile
huangyuchi.5 个月前
【Linux】自动化构建-Make/Makefile
linux·运维·服务器·笔记·自动化·makefile·make
阿沁QWQ6 个月前
makefile细节说明
makefile
笑川 孙6 个月前
为什么Makefile中的clean需要.PHONY
开发语言·c++·面试·makefile·make·技术