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

相关推荐
笑川 孙21 天前
为什么Makefile中的clean需要.PHONY
开发语言·c++·面试·makefile·make·技术
浅安的邂逅1 个月前
Linux Makefile-概述、语句格式、编写规则、多文件编程、Makefile变量分类:自定义变量、预定义变量
linux·c语言·vim·makefile·gcc
xyd陈宇阳1 个月前
Linux 入门五:Makefile—— 从手动编译到工程自动化的蜕变
linux·运维·服务器·makefile
不摆烂选手1 个月前
Ubuntu之Makefile入门
linux·ubuntu·makefile·正点原子imx6ull学习笔记
azaz_plus1 个月前
Linux makefile的一些语法
linux·makefile
witton1 个月前
MinGW下编译ffmpeg源码时生成compile_commands.json
ffmpeg·json·makefile·mingw·调试·compile_command·remake
一朵忽明忽暗的云2 个月前
【Day9】make/makeFile如何让项目构建自动化起飞
linux·makefile·项目自动化构建工具
NullPointerExpection2 个月前
ubuntu20.04已安装 11.6版本 cuda,现需要通过源码编译方式安装使用 cuda 加速的 ffmpeg 步骤
c++·ffmpeg·makefile·cuda
半夏云流3 个月前
CMake常用命令指南(CMakeList.txt)
linux·makefile·cmake
利刃大大4 个月前
【Linux入门】2w字详解yum、vim、gcc/g++、gdb、makefile以及进度条小程序
linux·c语言·vim·makefile·gdb·gcc