GNU make's SECONDEXPANSION and recursion



我正在尝试使用GNU make的SECONDEXPAND(使用3.81,3.80和更早版本不支持SECONDEXPAND(,如文档中所述,通过隐式规则在目标层次结构中递归。层次结构由宏/变量定义:

.SECONDEXPANSION :
top00.subblocks := mid00 mid01
mid00.subblocks := bottom00
wanted : top00.recurse ;
works_but_not_wanted : top00.onelevel ;
%.recurse : %.report $$(addsuffix .recurse,$$($$*.subblocks)) ;
%.onelevel : %.report $$(addsuffix .report,$$($$*.subblocks)) ;
%.report :
    @echo REPORT: $*

如果我尝试make wanted,它会给出:

make: *** No rule to make target `top00.recurse', needed by `wanted'.  Stop.

如果我尝试make works_but_not_wanted它会给出:

REPORT: top00
REPORT: mid00
REPORT: mid01

这不是我想要的,因为它没有报告 bottom00,由于明显的原因只会递归一个级别。但目标wanted失败了。似乎GNU make在递归行为方面遇到了问题。

有什么建议吗?

这是

记录在案的行为:

没有一个隐式规则可以在链中多次出现。

最新更新