Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2003 20:44:00 +0200
From:      Roman Neuhauser <neuhauser@bellavista.cz>
To:        freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   make: variable expansion in .for/.endfor
Message-ID:  <20030425184400.GS13541@freepuppy.bellavista.cz>

next in thread | raw e-mail | index | archive | help
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

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030425184400.GS13541>