如何在 Makefile 中 patsubst 多个路径?

How to patsubst multiple paths in Makefile?

我已经定义了一个路径列表

paths = /src/nam1 /src/name2

我正在尝试用这样的多个路径替换它们中的每一个

/src/nam1 -> /dist/nam1.foo /dist/nam1.bar
/src/nam2 -> /dist/nam2.foo /dist/nam2.bar

patsubst 只允许我对 1:1 映射

$(patsubst src/%,dist/%.foo,$(paths))

是否可以在不重复整个事情的情况下也为 .bar 进行映射?

怎么样:

$(foreach x,foo bar,$(patsubst src/%,dist/%.$(x),$(paths)))