help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Enumerating list elements


From: Christian Rishøj Jensen
Subject: Enumerating list elements
Date: Fri, 11 Mar 2011 12:42:32 +0100

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]