Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 519
user449361 Avatar asked Nov 30 '25 04:11

user449361


1 Answers

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.

like image 50
MadScientist Avatar answered Dec 03 '25 19:12

MadScientist