expand a variable upon evaluation not assignment
I am having trouble with some make variables, I have something like this:
SUFFIX := raw
FILEN开发者_Python百科AME = name.$(SUFFIX)
...
...
#much later, in a different makefile far away:
SUFFIX := img
echo $(FILENAME)
But FILENAME has the original raw suffix value (name.raw), not the more recently assigned "img" value.
Am I missing something simple here? Using latest released gmake.
I cannot reproduce this error with a series of includes; there is something else involved. I suggest you try the following and tell us the results:
@echo filename: $(FILENAME)
@echo origin: $(origin FILENAME)
@echo flavor: $(flavor FILENAME)
EDIT:
All right, now we know that FILENAME
is being defined simply (i.e. with :=
) somewhere. So try to trace the include chain, and find out where that happens. Here's a trick: put these lines in any makefile you're interested in
ifeq ($(flavor FILENAME),simple)
$(warning FILENAME is simply defined)
endif
精彩评论