make: variable expansion in .for/.endfor

Peter Pentchev roam at ringlet.net
Sat Apr 26 04:56:00 PDT 2003


On Fri, Apr 25, 2003 at 08:44:00PM +0200, Roman Neuhauser wrote:
> Try the following makefile: it works if called with -DONE, but does not
> if called with -DTWO. Should I treat it as a bug and file a PR?
> 
> LIST= foo bar baz
> 
> .if defined(ONE)
> .  for v in ${LIST}
> .    if !defined(WITHOUT_${v:U})
> WITH_${v:U}=yes
> .    endif
> .  endfor
> .endif
> 
> .if defined(TWO)
> .  for v in ${LIST}
> V=${v:U}
> .    if !defined(WITHOUT_${V})
> WITH_${V}=yes
> .    endif
> .  endfor
> .endif
> 
> a:
> 	@echo \$${WITH_FOO}: ${WITH_FOO}
> 	@echo \$${WITH_BAR}: ${WITH_BAR}
> 	@echo \$${WITH_BAZ}: ${WITH_BAZ}
> 
> .PHONY: a

I think this is a known bug, and it seems to even be documented
in the BUGS section of -STABLE's make(1) manual page.

G'luck,
Peter

-- 
Peter Pentchev	roam at ringlet.net    roam at sbnd.net    roam at FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
If I had finished this sentence,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20030426/3364c6da/attachment.bin


More information about the freebsd-hackers mailing list