(Note -- this is similar to my previous question, but it seems to have a different cause, so I'm posting a new question here).
I'm debugging some makefiles which are littered with some very convoluted eval's. I'd like to be able to accurately dump what the eval's are expanding to, and then call the evals. I need to do this such that I can easily turn on/off the debugging, but I'm finding some odd behaviour with eval from within a function. I have:
FOO := a:=foo
$(eval $(FOO))
$(info a=$(a)) #a=foo -- OK
define eval_dbg
$(info eval_dbg: running [$1]) # $1 is "a:=bar"
$(eval $(1)) # fails - missing seperator...
endef
$(call eval_dbg,a:=bar) #causes error...
$(info a=$a)
But, I get:
a=foo
eval_dbg: running [a:=bar]
test2.mk:17: *** missing separator. Stop.
Is it possible to eval a call parameter?
** minimal reproducable example: **
tmp> more test3.mk
FOO := a:=foo
$(eval $(FOO))
$(info a=$(a))
define eval_dbg
$(info eval_dbg: running [$1])
$(eval $(1))
endef
$(call eval_dbg,a:=bar)
$(info a=$a)
all:
@echo running $@
tmp> make -f test3.mk
a=foo
eval_dbg: running [a:=bar]
test3.mk:10: *** missing separator. Stop.
tmp> make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-unknown-linux-gnu