开发者

Force variable expansion in GNU Make

How do I force GNU Make variables to evaluate immediately? Consider the following example:

TARGET:=fred
wilma:
    mkdir -p $(TARGET)
TARGET:=barney
betty:
    mkdir -p $(TARGET)
all: one two
.PHON开发者_如何学CY: one two all

With make all, Make will only create "barney", because the recipe strings are evaluated only after the makefile was read and the final value ("barney") was assigned.

I need to create both "fred" and "barney" in this instance.


wilma: TARGET:=fred
betty: TARGET:=barney
wilma betty:
     mkdir -p $(TARGET)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜