这是一个不起作用的例子
say-hello := greeting
say-bye := farewell
greeting:
@echo "Hello"
farewell:
@echo "Bye"
.SECONDEXPANSION:
%-guvnah: $$(say-$*)
@echo "Target was: $(say-$*)"
命令
make hello-guvnah
应该产生
hello
Target was: greeting
但仅显示
Target was: greeting
答案 0 :(得分:2)
如果您在先决条件中双重逃避$*
,那么它将在二次扩展而不是第一次传递期间展开:
.SECONDEXPANSION:
%-guvnah: $$(say-$$*)
@echo "Target was: $(say-$*)"