当前位置:网站首页>Makefile separates file names and suffixes
Makefile separates file names and suffixes
2022-07-02 14:34:00 【Ayka】
Reference resources Get filename without extension within makefile - Stack Overflowhttps://stackoverflow.com/questions/13995906/get-filename-without-extension-within-makefile And GNU make 8.3 Functions for File Names
https://www.gnu.org/software/make/manual/make.html#File-Name-Functions The minimum example is as follows :
SRCNAME = $(basename bar_1.foo.c)
SRCTYPE = $(suffix bar_1.foo.c)
The result is SRCNAME yes bar_1.foo,SRCTYPE yes .c( Note that the suffix here contains periods ).
Practical examples are as follows :
SRCNAME = $(basename $(SRC))
SRCTYPE = $(suffix $(SRC))
all:
ifeq ($(SRCTYPE),.s)
all: assembly
else ifeq ($(SRCTYPE),.c)
all: program
else
$(error Source file suffix must be *.c or *.s)
endif
assembly:
@echo ASM
program:
@echo C
Notice the second and third here all target Do not add indents , Reference resources conditional - How do you conditionally call a target based on a target variable (Makefile)? - Stack Overflow
Be careful ifeq No space can be added before or after the comma of the condition , Add only one at the end endif.
For example, if you execute
make SRC=rv32_fib.s
Will output
ASM
边栏推荐
- STM32库函数进行GPIO初始化
- 2022 home projector preferred! Dangbei F5 brings the ultimate audio-visual experience with its powerful audio-visual effect
- Convolutional neural network (Introduction)
- MQ tutorial | exchange (switch)
- taobao.logistics.dummy.send( 无需物流发货处理 )接口,淘宝店铺发货API接口,淘宝订单发货接口,淘宝r2接口,淘宝oAu2.0接口
- obsidian安装第三方插件——无法加载插件
- kaggle如何使用utility script
- 3、函数指针和指针函数
- PTA question bank== > complex four operations, one for one, examination seat number (7-73)
- STM32标准固件库函数名(一)
猜你喜欢
Certik released the defi security report in 2021, disclosing key data of industry development (PDF download link attached)
ONNX+TensorRT:将预处理操作写入ONNX并完成TRT部署
没有从远程服务器‘‘映射到本地用户‘(null)/sa‘的远程用户‘sa‘及服务主密码解密错误的解决办法
Pychart connects to the remote server
Pycharm连接远程服务器
Makefile 分隔文件名与后缀
Yyds dry goods inventory software encryption lock function
Dangbei projection 4K laser projection X3 Pro received unanimous praise: 10000 yuan projector preferred
测试框架TestNG的使用(二):testNG xml的使用
Fabric. JS zoom canvas
随机推荐
Fabric.js 手动加粗文本iText
Pycharm连接远程服务器
[Hongke technology sharing] how to test DNS server: DNS performance and response time test
uni-app中使用computed解决了tab切换中data()值显示的异常
Using computed in uni app solves the abnormal display of data () value in tab switching
实现一个多进程并发的服务器
mongodb的认识
Yyds dry goods inventory software encryption lock function
途家木鸟美团夏日折扣对垒,门槛低就一定香吗?
buuctf-pwn write-ups (7)
Tencent cloud tstor unified storage passed the evaluation of the first batch of basic file storage capabilities of the ICT Institute
< schéma de développement de la machine d'exercice oral > machine d'exercice oral / trésor d'exercice oral / trésor de mathématiques pour enfants / lecteur LCD de calculatrice pour enfants IC - vk1621
QT new project
测试框架TestNG的使用(二):testNG xml的使用
kaggle如何使用utility script
Tujia muniao meituan has a discount match in summer. Will it be fragrant if the threshold is low?
1、编辑利器vim
Quick analysis: easy to share the Internet
PyQt5_QScrollArea内容保存成图片
There is no solution to the decryption error of the remote user 'sa' and the service master password mapped from the remote server 'to the local user' (null) /sa '