tech-toolchain archive

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

Re: (b)make: selecting every other element from a list



On Thu, Sep 03, 2015 at 11:25:42PM +0200, Joerg Sonnenberger wrote:
> On Thu, Sep 03, 2015 at 10:30:00PM +0100, David Laight wrote:
> > On Thu, Sep 03, 2015 at 06:37:32PM +0200, Edgar Fu? wrote:
> > > Thanks.
> > > 
> > > > l2:=
> > > Any particular reason for using := and not = in this place?
> > > 
> > > > .for _i _j in $(l)
> > > > l2+=$(_i)
> > > > .endfor
> > >
> > > Oops. I was sure this didn't work in older (NetBSD 4.0.1) versions of (b)make, 
> > > but I just checked it does work. I (wrongly) remembered this ending up in l2 
> > > being ${_i} ${_i} ${_i} after the loop, and subsequent expansion of ${l2} 
> > > repeating the last value ${_i}?was set to. Strange.
> > 
> > It used to be difficult to get the required delayed expansion of the loop
> > variables.
> > I fixed it a while ago by some magic transformation I can't quite remember.
> 
> You changed it into :U${current_value}.

Ah, yes, that left it having the syntax of a variable substitution.
It might have been better to do that only for command lines, and to
have just changed the symbol's value (probably via a sequence of
symbol tables) for lines that get fully expanded in pass 1.

	David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index