开发者

expand a variable upon evaluation not assignment

开发者 https://www.devze.com 2023-02-08 10:08 出处:网络
I am having trouble with some make variables, I have something like this: SUFFIX := raw FILEN开发者_Python百科AME = name.$(SUFFIX)

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
0

精彩评论

暂无评论...
验证码 换一张
取 消