我想简化以下GNU制作规则:
lib/dir1/org/eclipse/jetty/jetty-http/9.3.0.M2/jetty-http-9.3.0.M2.jar:
mkdir -p $(dir $@) && curl -o $@ "http://central.maven.org/maven2/org/eclipse/jetty/jetty-http/9.3.0.M2/jetty-http-9.3.0.M2.jar"
lib/dir1/org/eclipse/jetty/jetty-util/9.3.0.M2/jetty-util-9.3.0.M2.jar:
mkdir -p $(dir $@) && curl -o $@ "http://central.maven.org/maven2/org/eclipse/jetty/jetty-util/9.3.0.M2/jetty-util-9.3.0.M2.jar"
lib/dir1/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar:
mkdir -p $(dir $@) && curl -o $@ "http://central.maven.org/maven2/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar"
lib/dir1/org/slf4j/slf4j-api/1.7.10/slf4j-api-1.7.10.jar:
mkdir -p $(dir $@) && curl -o $@ "http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.10/slf4j-api-1.7.10.jar"
如何删除前缀' lib / dir1'在curl URL中获取一个简单的规则,如:
$(addsuffix lib/dir1/,org/eclipse/jetty/jetty-http/9.3.0.M2/jetty-http-9.3.0.M2.jar org/eclipse/jetty/jetty-util/9.3.0.M2/jetty-util-9.3.0.M2.jar javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar org/slf4j/slf4j-api/1.7.10/slf4j-api-1.7.10.jar):
mkdir -p $(dir $@) && curl -o $@ \
"http://central.maven.org/maven2/$(something $@)"
类似于' substring-after' ...
答案 0 :(得分:2)
$(patsubst lib/dir1/%,%,$@)
不起作用吗?