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

相关推荐
___波子 Pro Max.6 天前
Makefile设置DEBUG宏定义方法总结
makefile·make
乖乖是干饭王12 天前
Linux 内核 Kbuild 中的 ld 调用机制
linux·c·makefile
fareast_mzh20 天前
redis: undefined reference to `log‘
redis·makefile
冉佳驹21 天前
Linux ——— sudo权限管理和GCC编译工具链的核心操作
linux·makefile·make·gcc·sudo·.phony
攻城狮7号22 天前
【AI时代速通QT】第十节:在 Windows 上配置vs和qmake环境手动编译 Qt 项目
windows·qt·makefile·visual studio·qmake·vcvarsall·nmake/jom
青云交1 个月前
ShellCheck命令行工具适配开源鸿蒙PC实战指南
华为·开源·makefile·harmonyos·shellcheck·预编译二进制·hnp 打包
不知所云,1 个月前
3. cmake 和 Ninja安装
驱动开发·makefile·make·构建工具·ninja
HalvmånEver1 个月前
Linux:基础开发工具(四)
linux·运维·服务器·开发语言·学习·makefile
Fcy6482 个月前
Linux下的项目自动化构建-make\makefile详解
linux·运维·自动化·makefile·make
边疆.2 个月前
【Linux】自动化构建工具make和Makefile和第一个系统程序—进度条
linux·运维·服务器·makefile·make