Date: Thu, 12 Jun 2003 10:24:40 +0200 From: Roman Neuhauser <neuhauser@bellavista.cz> To: freebsd-hackers <freebsd-hackers@freebsd.org> Subject: Re: make: variable expansion in .for/.endfor Message-ID: <20030612082440.GK381@freepuppy.bellavista.cz> In-Reply-To: <20030516123001.GD2047@sunbay.com> References: <20030425184400.GS13541@freepuppy.bellavista.cz> <20030426115336.GF761@straylight.oblivion.bg> <20030427124812.GU13541@freepuppy.bellavista.cz> <20030429103404.GA680@straylight.oblivion.bg> <20030429130143.GK13541@freepuppy.bellavista.cz> <20030516123001.GD2047@sunbay.com>
next in thread | previous in thread | raw e-mail | index | archive | help
# ru@freebsd.org / 2003-05-16 15:30:01 +0300: > > > On Sun, Apr 27, 2003 at 02:48:12PM +0200, Roman Neuhauser wrote: > > > > # roam@ringlet.net / 2003-04-26 14:53:36 +0300: > > > > > 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. > > > > > > > > I don't think this is covered. Can you point out the relevant text? > Yes, BUGS section talks about a different problem (...) > FWIW, the code snippet above works perfectly under 5.x make(1). > I recall this problem was fixed (perhaps, it was even me, not > sure). Sorry, but I don't have enough time to invest into > backporting the bugfix into RELENG_4, the latter is becoming > less priority for me as 5.x evolves. > > If you'll be able to extract it from HEAD (there is a huge > backlog of non-backported fixes for make(1) there), I will > happily commit it for you. > > $ uname -r > 5.1-BETA > $ make -DONE > ${WITH_FOO}: yes > ${WITH_BAR}: yes > ${WITH_BAZ}: yes > $ make -DTWO > ${WITH_FOO}: yes > ${WITH_BAR}: yes > ${WITH_BAZ}: yes I've spent two hours in cvsweb but haven't noticed a commit message that would indicate a relation to this problem, and the source code is obviously over my head. But it looks like the problem is in the order of processing loops, and applying modifiers... or something: roman@freepuppy ~ 1024:0 > cat tmp/scratch4 LIST= foo bar baz .for v in ${LIST} V= ${v:U} V_${v}= ${V} v_${v}= ${v} .endfor all: .for v in ${LIST} @echo \$${V_${v}}: ${V_${v}} .endfor .for v in ${LIST} @echo \$${v_${v}}: ${v_${v}} .endfor .PHONY: all roman@freepuppy ~ 1025:0 > make -f tmp/scratch4 ${V_foo}: BAZ ${V_bar}: BAZ ${V_baz}: BAZ ${v_foo}: foo ${v_bar}: bar ${v_baz}: baz roman@freepuppy ~ 1026:0 > uname -a FreeBSD freepuppy.bellavista.cz 4.8-STABLE FreeBSD 4.8-STABLE #2: Thu Jun 5 12:57:47 CEST 2003 root@freepuppy.bellavista.cz:/usr/obj/usr/src/sys/FREEPUPPY2_5 i386 Does this help identifying the responsible code? I'd really like to continue using 4.x for some time, and this bitrot in make is quite unfortunate for me. -- 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?20030612082440.GK381>