Make:动态子目录的静态配方
Make: Static recipes for dynamic subdirectories
给定(简化)形式的层次结构
A
source
target
B
source
target
...
其中每个子目录中具体有一个target
,要从其中的一个source
构建。我想通过 make 来实现。
当然是
这样的makefile
%target: %source
...
可以完成这项工作,但这也可以匹配 A/wrong_target
。但是,删除 %
是行不通的; target
似乎只匹配 .
但不匹配子目录。
有什么好的方法可以实现吗?
当您说 "a hierarchy" 时,您指的是目录层次结构吗?
你为什么不通过包含“/”来强制目录,就像这样:
%/target: %/source
....
给定(简化)形式的层次结构
A
source
target
B
source
target
...
其中每个子目录中具体有一个target
,要从其中的一个source
构建。我想通过 make 来实现。
当然是
这样的makefile%target: %source
...
可以完成这项工作,但这也可以匹配 A/wrong_target
。但是,删除 %
是行不通的; target
似乎只匹配 .
但不匹配子目录。
有什么好的方法可以实现吗?
当您说 "a hierarchy" 时,您指的是目录层次结构吗?
你为什么不通过包含“/”来强制目录,就像这样:
%/target: %/source
....