Subject: bin/10264: make(1) .for does not handle vars in modifiers of iterators
To: None <gnats-bugs@gnats.netbsd.org>
From: Simon J. Gerraty <sjg@quick.com.au>
List: netbsd-bugs
Date: 06/02/2000 04:27:13
>Number:         10264
>Category:       bin
>Synopsis:       .for does not handle vars in modifiers of iterators
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 02 04:28:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Simon J. Gerraty
>Release:        NetBSD 2000-06-02
>Organization:
Zen Programming...
>Environment:
	
System: NetBSD zen.quick.com.au 1.4.2 NetBSD 1.4.2 (ZEN) #2: Wed Mar 22 01:07:26 EST 2000 root@zen.quick.com.au:/u3/NetBSD/1.4.X/src/sys/arch/i386/compile/ZEN i386


>Description:
	
The recent change to the implementation of .for - using a separate context
which is only searched for iterator variables so that normal code paths
through Var_Parse etc can be used, breaks makefiles which use a variable
to modify an iterator as in the example below.

GLOBAL=.gz
.for f in foo.txt foo.ps
${f:S/$/${GLOBAL}/}:	${f}
	@echo "$f -> ${.TARGET}"
.endfor

$ touch foo.ps
$ make foo.ps.gz
make: don't know how to make foo.ps.gz. Stop

instead of:
$ make foo.ps.gz
foo.ps -> foo.ps.gz

More complex Makefiles bomb with a "graph cycles through ..." error.

>How-To-Repeat:
	
Use make(1) with for.c v1.9 and var.c v1.4[67]

>Fix:
	
Don't have one.  It might be possible to be a bit more clever with Var_Find
when expanding variables from VAR_FOR, but I can't say.  The new code looks
cleaner, so if it can be made to work great.

>Release-Note:
>Audit-Trail:
>Unformatted: