0

In a makefile, the value of variable is a the name of another variable. How do I get it inside target?

For example:

my_variable := Hello

target: @var_name="my_variable" ;
result=$($(var_name)) ;
echo $$result

The result should be Hello.

Or another example:

VALUES123 := 1 2 3
CLIENTS_1_IP := 10.100
CLIENTS_2_IP := 10.100
CLIENTS_3_IP := 10.100

cll: @for value in ${VALUES123}; do
var_name="CLIENTS_$${value}_IP";
echo $$var_name;
$(eval CLIENT := $(value $$(var_name)))
echo $$CLIENT;
done

I need something instead of

$(eval CLIENT := $(value $$(var_name)))

which will work.

AdminBee
  • 22,803
Yevhen
  • 1

0 Answers0