I have lots of variables called allow_xxx where xxx is a feature.
I would like to create a variable inside my makefile with all values that are allowed.
This is what I try to do:
allow_feat1 := 1
allow_feat2 := 1
allow_feat3 := 1
list_features := feat1 feat2 feat3
allowed := $(foreach V, $(list_features), $(ifeq ($(allow_$V),1),$V))
This does not work... Any idea how to do this properly?
Thanks !
There is no such thing as the ifeq
function, it is only a conditional directive. Use if
and filter
instead:
allowed := $(foreach V, $(list_features), $(if $(filter 1,$(allow_$V)),$V))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With