Subject: Re: arithmetic in make
To: Manuel Bouyer <>
From: David Laight <>
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}


David Laight: