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
.PHONY: 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.
1 Answer