google / kati

An experimental GNU make clone

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

an issue with parsing $$

kylcho opened this issue · comments

Kati does not seem to handle below case.

func = lib$(1)$(2)
bar := -lc -lm
$(eval foo := $(bar:-l%=$$(call func,%,.so)))
mylib:
@echo $(foo)

Expected output is
libc.so libm.so

Kati fails with following error.
makefile:3: *** unterminated call to function 'call': missing ')'.

make using using $(call func,c,.so) $(call func,m,.so) for foo, while ckati is parsing it as $(call func,c,.so $(call func,m,.so. I guess we'd need to do more parenthesis matching?

A workaround is to delay the evaluation of bar, which gives the same result on make and ckati:

$(eval foo := $$(bar:-l%=$$(call func,%,.so)))

Thank you Dan.

When kati is parsing $(bar ..., it looks it sees opening '(' and records its closing ')' as a terminator. Then when it sees '(' of $$(call ..., it should handle increasing paren_depth etc but it does not. This seems to lead to missing the closing ')' of $$(call ...

Delayed expansion of bar variable as a workaround sounds right. I will try it