Subject: Re: arithmetic in make
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: David Laight <david@l8s.co.uk>
List: tech-toolchain
Date: 02/25/2007 17:23:20
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

	David

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