NetBSD Problem Report #10204
Received: (qmail 26688 invoked from network); 27 May 2000 04:31:43 -0000
Message-Id: <200005270428.OAA04426@zen.quick.com.au>
Date: Sat, 27 May 2000 14:28:00 +1000 (EST)
From: "Simon J. Gerraty" <sjg@quick.com.au>
Reply-To: sjg@quick.com.au
To: gnats-bugs@gnats.netbsd.org
Subject: .for loop in rules does not handle ${.TARGET}
X-Send-Pr-Version: 3.95
>Number: 10204
>Category: bin
>Synopsis: .for loop in rules does not handle ${.TARGET}
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: sjg
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat May 27 04:32:00 +0000 2000
>Closed-Date: Tue Jun 06 11:42:08 +0000 2000
>Last-Modified: Tue Jun 06 11:42:08 +0000 2000
>Originator: Simon J. Gerraty
>Release: 1.4.2
>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:
variables which are local to rules for a given target eg ${.TARGET} are
not processed correctly within .for loop.
>How-To-Repeat:
In the makefile below the output for the target bad,
should be the same as for the target ok. Ie.
$ make ok
t=/path/one/foo-bar.tgz
t:T=foo-bar.tgz
t:R=/path/one/foo-bar
t:R:T=foo-bar
t:R:T:S/foo-//=bar
t=/path/one/foo-bar-debug.tgz
t:T=foo-bar-debug.tgz
t:R=/path/one/foo-bar-debug
t:R:T=foo-bar-debug
t:R:T:S/foo-//=bar-debug
rather than:
$ make bad
t=/path/one/foo-bar.tgz
t:T=/path/one/foo-bar.tgz
t:R=
t:R:T=
t:R:T:S/foo-//=
t=/path/one/foo-bar-debug.tgz
t:T=/path/one/foo-bar-debug.tgz
t:R=/path/one/foo-bar-debug
t:R:T=/path/one/foo-bar-debug
t:R:T:S/foo-//=/path/one/foo-bar-debug
Makefile:
foo=/path/one/foo-bar.tgz
all bad: ${foo}
# this should produce the same output as 'ok' below, but does not.
${foo}:
.for t in ${.TARGET} ${.TARGET:R}-debug.tgz
@echo t=$t
@echo t:T=${t:T}
@echo t:R=${t:R}
@echo t:R:T=${t:R:T}
@echo t:R:T:S/foo-//=${t:R:T:S/foo-//}
.endfor
ok:
.for t in ${foo} ${foo:R}-debug.tgz
@echo t=$t
@echo t:T=${t:T}
@echo t:R=${t:R}
@echo t:R:T=${t:R:T}
@echo t:R:T:S/foo-//=${t:R:T:S/foo-//}
.endfor
>Fix:
I'll see what I can come up with. This PR is so I don't forget.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->sjg
Responsible-Changed-By: sjg
Responsible-Changed-When: Fri May 26 21:33:38 PDT 2000
Responsible-Changed-Why:
I might as well fix it.
State-Changed-From-To: open->closed
State-Changed-By: sjg
State-Changed-When: Tue Jun 6 04:37:45 PDT 2000
State-Changed-Why:
The ::= modifier provides a viable work around.
foo:
.for i in ${.TARGET}
@: ${t::=$i}
@echo now we can pretend that t is the iterator, and modifiers will work.
.endfor
Fixing .for "the right way" is not worth it for a corner case.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.