makefile - makefile 中的版本匹配
问题描述
我是新手。假设我有一个有目标的makefile,目标将根据版本启动不同的编译命令:从版本1.xx到版本3.xx,它将启动命令1。而版本4.xx或更高版本,它将启动命令 2。
run-%: %.txt
<if %.txt is in between 1.x.x and 3.x.x, kick off command 1 with %.txt as input>
<else kick off command 2 with %x.txt as input>
用户将像这样运行它:
make run-2.2.0
make 是否提供某种模式匹配?
解决方案
[1-3]
如果这就是您所说的“模式匹配”,那么没有什么比得上 glob 的了。不幸的是,您所能做的就是编写多个规则:
run-1.%: 1.%.txt
<command1>
run-2.%: 2.%.txt
<command1>
run-3.%: 3.%.txt
<command1>
run-%: %.txt
<command2>
推荐阅读
- java - 休眠 ManyToOne 不同的行为
- node.js - Dialogflow V1 API (Api.ai) 和 Dialogflow V2 API (Api.ai) 之间的区别?
- arrays - 如果在数组中找不到,perl 删除哈希项
- indexeddb - 浏览器版本更新时 indexdb 数据丢失
- javascript - 将 twitter 嵌入小部件样式设置为水平
- r - 如何使用 bquote() 在 scale_x_discrete() 中的 ggplot2 中动态创建标签?
- go - 在 for 循环中使用函数中的变量 - Golang
- symfony - 来自 symfony 4 的 webpack/encore 和 socket.io
- email - mutt or mail - 回复电子邮件或从电子邮件回复
- sql - 从历史表的一行中获取postgres / redshift的最小和最大日期?