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

相关推荐
李日灐4 天前
< 6 > Linux 自动化构建工具:makefile 详解 + 进度条实战小项目
linux·运维·服务器·后端·自动化·进度条·makefile
送外卖的CV工程师18 天前
STM32+Makefile编译+OpenOCD 烧录调试
stm32·单片机·嵌入式硬件·makefile·调试·烧录·openocd
zhang-ge18 天前
Makefile调试技巧:打印信息与变量调试
makefile
送外卖的CV工程师19 天前
STM32 CubeMX Makefile 工程编译 入门指南
stm32·单片机·嵌入式硬件·学习·makefile·stm32cubemx
H Journey24 天前
C++之 CMake、CMakeLists.txt、Makefile
开发语言·c++·makefile·cmake
【骠姚校尉】1 个月前
Makefile核心教程(六) --- 一文吃透 Makefile 通配符
linux·makefile·通配符·核心教程
星光20251 个月前
Makefile语法
makefile
阿昭L1 个月前
Windows通用的C/C++工程CMakeLists
c语言·c++·windows·makefile·cmake
数字IC那些事儿1 个月前
CMakeLists.txt 语法解释
makefile·system c
一只自律的鸡3 个月前
【MakeFile】基础培训2
makefile