当前位置:网站首页>Makefile 分隔文件名与后缀
Makefile 分隔文件名与后缀
2022-07-02 11:21:00 【Ayka】
参考Get filename without extension within makefile - Stack Overflow
https://stackoverflow.com/questions/13995906/get-filename-without-extension-within-makefile与GNU make 8.3 Functions for File Names
https://www.gnu.org/software/make/manual/make.html#File-Name-Functions最小样例如下:
SRCNAME = $(basename bar_1.foo.c)
SRCTYPE = $(suffix bar_1.foo.c)其结果为 SRCNAME 是 bar_1.foo,SRCTYPE 是 .c(注意这里的后缀名是包含句点的)。
实用样例如下:
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
注意这里的第二个和第三个 all target 不可添加缩进, 参考conditional - How do you conditionally call a target based on a target variable (Makefile)? - Stack Overflow
注意 ifeq 条件的逗号前后不可添加空格,结尾只添加一个 endif。
例如若在命令行中执行
make SRC=rv32_fib.s则会输出
ASM
边栏推荐
- Using computed in uni app solves the abnormal display of data () value in tab switching
- 每日学习3
- 4、数组指针和指针数组
- 《可供方案开发》口算训练机/数学宝/儿童口算宝/智能数学宝 LCD液晶显示驱动IC-VK1622(LQFP64封装),原厂技术支持
- Method of creating linked server for cross server data access
- Certik released the defi security report in 2021, disclosing key data of industry development (PDF download link attached)
- 抓包工具fiddler学习
- Openharmony notes --------- (4)
- C crystal report printing
- Fabric. JS free drawing ellipse
猜你喜欢
![[development environment] 010 editor tool (tool download | binary file analysis template template installation | shortcut key viewing and setting)](/img/de/7d70f513577e93f1bde1969935a29e.jpg)
[development environment] 010 editor tool (tool download | binary file analysis template template installation | shortcut key viewing and setting)

TeamTalk源码分析之win-client

复用和分用

Design and implementation of car query system based on php+mysql

YOLOv3&YOLOv5输出结果说明

Pychart connects to the remote server

Development and design of animation surrounding mall sales website based on php+mysql

MySQL 45 lecture - learning the actual battle of MySQL in Geek time 45 Lecture Notes - 05 | easy to understand index (Part 2)

每日学习2
![[development environment] StarUML tool (download software | StarUML installation | StarUML creation project)](/img/08/9f25515e600a3174340b2589c81b0e.jpg)
[development environment] StarUML tool (download software | StarUML installation | StarUML creation project)
随机推荐
[development environment] 010 editor tool (tool download | binary file analysis template template installation | shortcut key viewing and setting)
Quarkus learning IV - project development to deployment
Start to write a small demo - three piece chess
Fabric. JS upper dash, middle dash (strikethrough), underline
3. Function pointers and pointer functions
千元投影小明Q1 Pro和极米NEW Play谁更好?和哈趣K1比哪款配置更高?
Quarkus学习四 - 项目开发到部署
TeamTalk源码分析之win-client
P1908 reverse sequence pair
抓包工具fiddler学习
[development environment] Dell computer system reinstallation (download Dell OS recovery tool | use Dell OS recovery tool to make USB flash disk system | install system)
Understanding of mongodb
Penetrate the remote connection database through the Intranet
Pycharm连接远程服务器
给Android程序员的一些面试建议「建议收藏」
Fabric. JS manual bold text iText
PyQt5_ Qscrollarea content is saved as a picture
Borui data integrated intelligent observable platform was selected into the "Yunyuan production catalogue" of China Academy of communications in 2022
实现一个多进程并发的服务器
< schematic diagram of oral arithmetic exercise machine program development> oral arithmetic exercise machine / oral arithmetic treasure / children's math treasure / children's calculator LCD LCD driv