Christian Rishøj Jensen wrote:
Say I have a list with some elements:
FACTORS = form pos cluster
I would like to enumerate the elements in the list, i.e. for each element,
create a variable with the element's name and the list index as the value.
I have tried this:
i=0 ; for f in $(FACTORS); do \
((i = i + 1)) ; \
$(f) := $(i) ; \
done
...but without luck: This for-loop is evaluated by the shell and does not affect Make variables.
How can I achieve the desired effect?
/ Christian
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make
Do you mean this:
FACTORS = form pos cluster
#set to factor_i:=x if you want to start index from 1
factor_i:=
$(foreach factor,$(FACTORS), \
$(eval $(factor):=$(words $(factor_i))) \
$(eval factor_i+=x))
$(info form=$(form))
$(info pos=$(pos))
$(info cluster=$(cluster))
Chris
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make