help-make
[Top][All Lists]
Advanced

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

Re: Using foreach to define variables


From: Shaun Jackman
Subject: Re: Using foreach to define variables
Date: Mon, 5 Jul 2010 14:42:43 -0700

On Fri, 2010-07-02 at 19:40 -0700, J.T. Conklin wrote:
> Shaun Jackman <address@hidden> writes:
> > I'd like to use foreach to define variables like so:
> >
> > ==> Makefile <==
> > $(foreach i,a b c,$i=1)
> > all:
> >     echo $a $b $c
> >
> > But I receive this error:
> > $ make
> > Makefile:1: *** missing separator.  Stop.
> >
> > Can this be made to work?
> 
> Use $(eval ...), like:
> 
>     $(foreach i,a b c,$(eval $i = 1))
>     all:
>         echo $a $b $c
> 
> Hope this helps,
> 
>     --jtc

Worked like a charm. Thanks!




reply via email to

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