Make编译学习笔记(四)常用函数

Makefile 中可以使用函数来处理变量,调用方式如下

$(foo a, b, c)

其中 foo 是函数名 a, b, c 是函数参数

make 编译中常用函数如下

字符串操作函数

函数名 原型
字符串替换函数 $(subst <from>, <to>, <text>)
模式字符串替换函数 $(patsubst <pattern>, <replacement>, <text>)
字符串去空格函数 $(strip <string>)
字符串查找函数 $(findstring <find>, <in>)
字符串过滤函数 $(filter <pattern...>, <text>)
字符串反过滤函数 $(filter-out <pattern...>, <text>)
字符串排序函数 $(sort <list>)
取单词串函数 $(wordlist <s>, <e>, <text>)
统计单词数函数 $(words <text>)
取首单词函数 $(firstword <text>)

1. 字符串替换函数是将 < text > 字符串中的 < from > 子串替换为 < to > 串并返回,例如

$(subst .c, .o, foo.c bar.c.c)

此时函数的返回值为 foo.o bar.o.o
2. 模式字符串替换函数是查找 < text >中的单词符合模式 < pattern >的子串替换为 < replacement >

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值