From: Michael G. <mg...@te...> - 2005-08-25 10:06:37
|
> i'm a newbie and need your help figuring out the problem with the=20 > makefile below. i tried to search through the archive for this problem=20 > and couldn't find it. sorry if this turns out to be duplicate. >=20 > makefile > ---------------------------------------------------- > ABC =3D a b c > =20 > define show > $(1): =20 > @echo $(1) > endef >=20 > $(foreach letter,$(ABC),$(eval $(call show,$(letter)))) > ---------------------------------------------------- >=20 > running mingw32-make on the above makefile produces the following output: > a >=20 > although i expected it to be: > a > b > c > ---------------------------------------------------- >=20 > thank you for your help and patience, I think you misunderstand what $(foreach ...) and $(eval ...) are doing. Your makefile is essentially the same as: =2D--------------------------------------------------- ABC =3D a b c =20 a: @echo $@ b: @echo $@ c: @echo $@ =2D--------------------------------------------------- or even: =2D--------------------------------------------------- ABC =3D a b c =20 $(ABC): @echo $@ =2D--------------------------------------------------- The make buildin function foreach in combination with eval does not execute any commands. It _creates_ new targets (and rules) dynamically. HTH, best, Michael =2D-=20 Vote against SPAM - see http://www.politik-digital.de/spam/ Michael Gerdau email: mg...@te... GPG-keys available on request or at public keyserver |