我无法理解 makefile 中 patsubst 的输出
I can not understand the output of patsubst in a makefile
这是有罪的 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
。 The manual有备注:
A final caution: be careful when adding whitespace to the arguments to call. As with other functions, any whitespace contained in the second and subsequent arguments is kept; this can cause strange effects. It’s generally safest to remove all extraneous whitespace when providing parameters to call.
事实上,如果你更换
$(info $(call this, why_this_does) ?)
来自
$(info $(call this,why_this_does) ?)
你得到你想要的。
这是有罪的 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
。 The manual有备注:
A final caution: be careful when adding whitespace to the arguments to call. As with other functions, any whitespace contained in the second and subsequent arguments is kept; this can cause strange effects. It’s generally safest to remove all extraneous whitespace when providing parameters to call.
事实上,如果你更换
$(info $(call this, why_this_does) ?)
来自
$(info $(call this,why_this_does) ?)
你得到你想要的。