From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 29 03:36:26 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B273C37B414 for ; Tue, 29 Apr 2003 03:36:26 -0700 (PDT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id C4E9243FB1 for ; Tue, 29 Apr 2003 03:36:24 -0700 (PDT) (envelope-from roam@ringlet.net) Received: (qmail 29720 invoked from network); 29 Apr 2003 10:30:40 -0000 Received: from office.sbnd.net (HELO straylight.ringlet.net) (217.75.140.130) by gandalf.online.bg with SMTP; 29 Apr 2003 10:30:40 -0000 Received: (qmail 10292 invoked by uid 1000); 29 Apr 2003 10:34:04 -0000 Date: Tue, 29 Apr 2003 13:34:04 +0300 From: Peter Pentchev To: freebsd-hackers Message-ID: <20030429103404.GA680@straylight.oblivion.bg> Mail-Followup-To: freebsd-hackers References: <20030425184400.GS13541@freepuppy.bellavista.cz> <20030426115336.GF761@straylight.oblivion.bg> <20030427124812.GU13541@freepuppy.bellavista.cz> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline In-Reply-To: <20030427124812.GU13541@freepuppy.bellavista.cz> User-Agent: Mutt/1.5.4i Subject: Re: make: variable expansion in .for/.endfor X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Apr 2003 10:36:27 -0000 --FCuugMFkClbJLl1L Content-Type: text/plain; charset=windows-1251 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 n= ot > > > if called with -DTWO. Should I treat it as a bug and file a PR? > > >=20 > > > LIST=3D foo bar baz > > >=20 > > > .if defined(ONE) > > > . for v in ${LIST} > > > . if !defined(WITHOUT_${v:U}) > > > WITH_${v:U}=3Dyes > > > . endif > > > . endfor > > > .endif > > >=20 > > > .if defined(TWO) > > > . for v in ${LIST} > > > V=3D${v:U} > > > . if !defined(WITHOUT_${V}) > > > WITH_${V}=3Dyes > > > . endif > > > . endfor > > > .endif > > >=20 > > > a: > > > @echo \$${WITH_FOO}: ${WITH_FOO} > > > @echo \$${WITH_BAR}: ${WITH_BAR} > > > @echo \$${WITH_BAZ}: ${WITH_BAZ} > > >=20 > > > .PHONY: a > >=20 > > 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. >=20 > I don't think this is covered. Can you point out the relevant text? Looking at: $FreeBSD: src/usr.bin/make/make.1,v 1.29.2.15 2002/12/17 19:01:18 seanc E= xp $ The rendered version reads, right at the end of the BUGS section: For loops are expanded before tests, so a fragment such as: .for TMACHINE in ${SHARED_ARCHS} .if ${TMACHINE} =3D ${MACHINE} ... .endif .endfor won't work, and should be rewritten the other way around. This particular part of the manual page seems to have been there for the past three years, since Tim Vanderhoek's merge from OpenBSD in rev. 1.23. At least, I think that this is similar (actually, nearly identical) to your Makefile fragment. G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@sbnd.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 The rest of this sentence is written in Thailand, on --FCuugMFkClbJLl1L Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+rlUc7Ri2jRYZRVMRAqDuAJ9/E6y3JxhXQAJ87PmkHlNmOxswEACgp8/S rZuPD5jWfXYazJ1p3KSUVUQ= =2mCL -----END PGP SIGNATURE----- --FCuugMFkClbJLl1L--