这是有罪的makefile:
$ cat -n example.mak
1 define this
2 $(patsubst $(1)/%.o,%.o,why_this_does/that.o)
3 $(patsubst butnot/%.o,%.o, butnot/but_not_that.o)
4 endef
5
6 why:
7 $(info $(call this, why_this_does) ?)
这是我的问题:
$ make -f example.mak
why_this_does/that.o
but_not_that.o ?
make: 'why' is up to date.
根本原因不在,patsubst
而是在call
。该手册有一个注释:
最后的警告:将空白添加到要调用的参数时要小心。与其他函数一样,保留第二个及后续参数中的所有空格;这可能会导致奇怪的影响。提供调用参数时,通常最安全的方法是删除所有多余的空格。
实际上,如果您更换
$(info $(call this, why_this_does) ?)
通过
$(info $(call this,why_this_does) ?)
你得到你想要的。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句