I want to use dynamic variables in make file, e.g.:
all: ask
@echo "I want the $$ANSWER here too"
ask:
@read -p "please enter your answer: " ans && export ANSWER=$$ans
@echo "Your answer is $$ANSWER"
The above example does not work, the $ANSWER
is empty.
EDIT:
Asking question using read is only an example. My purpose is that the value must be dynamically obtained at runtime of the target, not calculated on top of the makefile, or passed in on command line of make
.