user449361
user449361

Reputation: 63

multivariable for loop in gnu make (like in bmake)

bmake gives you the ability to use very useful for loop

LIST= \
  s1 t1 \
  s2 t2 \
  s3 t3

all:
.for s t in ${LIST}
    @echo ${s} ${t}
.endfor

effect will be:

# bmake
s1 t1
s2 t2
s3 t3

Is it possible to do something like this in gnu make? thx

Upvotes: 3

Views: 126

Answers (1)

MadScientist
MadScientist

Reputation: 100946

No. But you can do it differently, something like:

LIST = s1:t1 s2:t2 s3:t3

all: ; $(foreach L,$(LIST),echo $(subst :, ,$L) ;)

Choose a different delimiter if your list entries might have : in them.

Upvotes: 3

Related Questions