Subject: unnecessary .undef after .for loops
To: None <tech-pkg@netbsd.org>
From: Roland Illig <roland.illig@gmx.de>
List: tech-pkg
Date: 05/16/2005 11:04:48
Hi,

I have seen many code snippets that use the following pattern:

.for i in foo bar baz
# ...
.endfor
.undef i

I have tried the following snippet with bmake (pkgsrc), /usr/bin/make 
(NetBSD 1.6.2) and /usr/bin/make (NetBSD 2.99.15). All three 
automatically undefine i after the loop.

.for i in foo bar baz
.endfor
.if defined(i)
EXITCODE=1
.else
EXITCODE=0
.endif

all:
	(exit ${EXITCODE})
# EOF

Can anyone of you show me an example of a (NetBSD) make that does not 
undefine i? If not, these .undef lines can simply be removed.

Roland