开发者

Using a pattern match in a makefile rule

开发者 https://www.devze.com 2023-02-14 14:50 出处:网络
I have a makefile with rules that look like this: data/foo-trunk.xml: svn log -v --xml http://www.example.com/svn/foo/trunk > $@

I have a makefile with rules that look like this:

data/foo-trunk.xml:
    svn log -v --xml http://www.example.com/svn/foo/trunk > $@

data/bar-trunk.xml:
    svn log -v --xml http://www.example.com/svn/bar/trunk > $@

data/baz-trunk.xml:
    svn log -v --xml http://www.example.com/svn/baz/trunk > $@

How could I abstract this into a rule? For example, is there a way to do something like this (i.开发者_开发问答e., what would replace the ???)

data/%-trunk.xml:
    svn log -v --xml http://www.example.com/svn/???/trunk > $@


Assuming GNU Make, ??? should be $*.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号