当前位置:网站首页>Makefile相关语法总结(Openc910)
Makefile相关语法总结(Openc910)
2022-07-26 21:38:00 【东边坡】
1. @ 表示后面的指令信息不会在执行过程中显示出来,例:
![]()
2. $ 替换在makefile中定义的变量或命令行中定义的变量,例:
![]()
3. (findstring FIND,IN) 在“IN”之中查找“FIND” ,如果存在则返回“FIND”,否则返回空
4. -s 执行命令时不在屏幕上显示内容(执行过程)
5. $(warning TEXT…) 非致命错误,只打印提示“ TEXT…”, make 的执行过程继续
6. $(error TEXT…)致命错误,打印提示“ TEXT…”信息,并退出 make 的执行
7. “ifeq” else”“endif”不能以[Tab]键做为开始(不然就被认为是命令),例:

8. 在makefile中,tab和空格是严格区分开的
- 以TAB开头的是shell脚本语法,语句直接传递给shell进行解析
- 如: echo命令是shell语法,只能tab开头
- 以空格开头的是makefile语法
- 如:ifneq是makefile语法,只能以空格开头
9. make是在读取Makefile时就计算条件表达式的值,并根据条件表达式的值来选择执行语句
10. 当在shell在执行make命令时,make的工作过程如下:
- 1)、make会在当前目录下找名字叫“Makefile”或“makefile”的文件
- 2)、找文件中的第一目标文件,并把这个文件作为最终的目标文件
- 3)、如果第一目标文件不存在,或是后面的依赖文件( .o)修改时间要比第一目标文件新,那么,他就会执行后面所定义的命令来生成目标文件
- 4)、如果依赖文件也不存在,那么make会在当前文件中找生成依赖文件的条目,先执行它生成依赖文件.o文件,然后再回来生成目标文件
- 注:如果依赖文件不存在,先执行依赖中的命令,生成依赖文件,再执行后面的命令

11. 用法1:

解析:
1. SRC=$(wildcard *.S) #得到当前目录下所有的 .S 文件名
2. $( SRC: %.S=%.o) 或 ${ SRC: %.S=%.o } #把变量SRC中的每⼀个值结尾⽤ %.o替换掉%.S
12. 用法2:

解析:
1. find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \;
- ./tests/lib/ 查找的路径
- -maxdepth 1 在深度为1的地方,即当前路径文件下
- -type f 文件类型为一般文件
- -exec cp {} ./work/ \ 执行命令cp {} ./work/ \,将查找到的文件复制到work下
2. cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=c910
- 先执行cd ./work
- 再执行make -s clean
- 再执行make -s all
- 传递参数CPU_ARCH_FLAG_0=c910
边栏推荐
- JS delay execution window.onload
- Open source | arex Ctrip traffic playback practice without code intrusion
- Pytorch--Visdom使用
- Unity installation failed: operation not allowed, MKDIR
- Liepin questionnaire star has become a "parasite" on wechat
- yolov1
- 想让照片中的云飘起来?视频编辑服务一键动效3步就能实现
- Promise me, don't write shit code after reading it..
- Nacos作为注册中心、配置中心入门使用篇-实现远程调用、动态获取配置文件、数据库配置信息
- 知识库工具 | 微网站、文档中心、形象展示页拖拽即可生成(附模板,直接用)
猜你喜欢

LeetCode 121:买卖股票的最佳时机

yolov1

SQL injection less24 (secondary injection)

xshell7个人免费下载,使用

Financial institution map

A few pictures help you clarify "China's financial institution system"

unity 安装失败:operation not permitted, mkdir......

Overview of banking industry

Matlab solution of the densest stacking and smallest circumscribed square of N circles (two-dimensional, three-dimensional, etc. circle packing problem)

09.01 depth first search
随机推荐
easyui datagrid 获取多条选中的数据进行操作
MySQL recommendation
面试 必备
Pytorch--Visdom使用
MPLS基础知识概述
Redis 分布式锁 + Lua原子操作
JMeter -- response Chinese garbled code processing
Join method in JS
Just one dependency to give swagger a new skin, which is simple and cool~
Understand China's financial system in one article
30000 hair loss people, supporting an IPO
Difference between D and C
OPPO 自研大规模知识图谱及其在数智工程中的应用
07 df 命令
JS verify complex password
Altium Designer 22 修改选中元件的层属性
SQL injection less24 (secondary injection)
同花顺手机炒股开户安全吗?怎么办理开户呢
Add resource files for the project and pictures for buttons in QT
Matlab draw short-term energy diagram