Subject: Re: arithmetic in make
To: None <tech-toolchain@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-toolchain
Date: 02/25/2007 18:35:52
On Sun, Feb 25, 2007 at 05:23:20PM +0000, David Laight wrote:
> On Sun, Feb 25, 2007 at 05:06:51PM +0100, Manuel Bouyer wrote:
> > Hi,
> > does anyone know if there's a way to do some arithmetic in make ?
> > Here's my problem: I have a variable with a list of files (with arbitrary
> > names) that I'd like to copy as file1 file2 file3 ...:
> > .for file in ${MYFILES}
> > 	cp ${file} dir/file{$n}
> > .endfor
> > is it possible ?
> 
> Easy peasy:
> 
> .for file in ${MYFILES}${n::=n}
> 	cp ${file} dir/${file}${n:[#]}${n::=$n n}
> .endfor

Well, I don't claim to understand it but it seems to work. I'll use it if my
build.sh gives the expected result.
Thanks !

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--