Makefile排列 [英] Makefile permutation

查看:64
本文介绍了Makefile排列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bash可能产生排列(笛卡尔积):

Bash can produce permutations (cartesian product):

$ echo {1,2}{a,b}
1a 1b 2a 2b

我想对makefile做类似的事情.这是一个例子生成文件:

I would like to do something similar with a makefile. Here is an example makefile:

all: 1a 1b 2a 2b

如果可能,我想要这样的东西:

I would like something like this if possible:

NOV = 1 2
OSC = a b
all: $(NOV)$(OSC)

但是,当我使用类似的示例时,它只是创建"1 2a b"而不是结合起来.这可能吗?

However when I use an example like that it just creates "1 2a b" instead of combining them. Is this possible?

推荐答案

不需要任何复杂的循环或从shell借用.比这简单得多.

No need for any complex loops or borrowing from shell. It is much simpler than that.

$(foreach p, $(NOV), $(addprefix $p, $(OSC)))

这篇关于Makefile排列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆