在makefile中解析数字
我想在makefile中解析版本的数字。 我将版本从一个变量中获取,该变量读取ver = 10.11.12-0.1.2
现在我希望每个单独的数字在不同的变量中,例如a = 10,b = 11,等等。 我尝试了SED和尴尬的组合,但我想要的完全不起作用。.似乎管道输出在Makefile中不起作用。
a = $(shell echo $ {ver} | awk -f。“ {print $ 1}”)
任何输入?
I want to parse digits of a version in a Makefile.
I am getting the version in a variable, that variable reads VER=10.11.12-0.1.2
Now I want each individual digits in different variables let's say A=10, B=11 and so on..
I have tried combinations of sed and awk but not getting it work exactly I want.. also it seems piped output doesn't work in Makefile.
A=$(shell echo ${VER} | awk -F . "{print $1}")
Any inputs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是使用GNU制作的一种方法:
Here's one way of doing it with Gnu make: