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

相关推荐
一只自律的鸡18 天前
【MakeFile】基础培训2
makefile
tod1131 个月前
Makefile进阶(上)
linux·运维·服务器·windows·makefile·进程
一个平凡而乐于分享的小比特1 个月前
Makefile 源码编译系统详解
linux·makefile
一个平凡而乐于分享的小比特2 个月前
Autoconf:Linux自动生成Makefile的详解
makefile·cmake·autoconf
一个平凡而乐于分享的小比特2 个月前
Linux内核构建三剑客:Kconfig、.config与Makefile关系详解
linux·makefile·kconfig·.config
ベadvance courageouslyミ2 个月前
项目一(线程邮箱)
c语言·线程·makefile·进程间通信·线程邮箱
熊猫钓鱼>_>2 个月前
Makefile应用场景实践日志:构建高效C/C++项目工作流
c语言·c++·bug·mfc·makefile·编译·kmp
___波子 Pro Max.2 个月前
Makefile设置DEBUG宏定义方法总结
makefile·make
乖乖是干饭王2 个月前
Linux 内核 Kbuild 中的 ld 调用机制
linux·c·makefile
fareast_mzh3 个月前
redis: undefined reference to `log‘
redis·makefile