Makefile Using ifeq inside a foreach loop

I have many variables called allow_xxx, where xxx is a function.

I would like to create a variable inside my makefile with all valid values.

This is what I am trying 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 it right?

Thanks!

+4
source share
1 answer

There is no such function 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)) 
+8
source

Source: https://habr.com/ru/post/1386292/


All Articles