Date: Sat, 12 Feb 2005 18:45:24 -0800 From: Kris Kennaway <kris@obsecurity.org> To: Kris Kennaway <kris@obsecurity.org> Cc: hackers@FreeBSD.org Subject: Re: Makefile .for and .if expansion Message-ID: <20050213024524.GA24740@xor.obsecurity.org> In-Reply-To: <20050213023201.GB24426@xor.obsecurity.org> References: <20050213023201.GB24426@xor.obsecurity.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--mYCpIKhGyMATD0i+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Feb 12, 2005 at 06:32:01PM -0800, Kris Kennaway wrote: > The following small makefile doesn't behave as one would naively > expect: >=20 > MANLANG?=3Dfoo "" > all: > .for i in ${MANLANG} > .if empty(${i}) > @echo foo ${i} > .endif > .endfor >=20 > ports-i386%make > foo foo > foo >=20 > I think this is because the .if evaluation is happening too early, and > it's not being done after the .for loop is expanded and the i variable > is set. Actually it looks like it's happening too late: For: Iterator i List foo "" For: end for 1 Global:i =3D "" --- i =3D "" =2Eif empty(i) @echo foo "" =2Eendif ---- at line 3 Global:delete i Global:i =3D foo --- i =3D foo =2Eif empty(i) @echo foo foo =2Eendif ---- at line 3 Global:delete i i.e. the series of .if statements are expanded out by .for and then the variable i is deleted, so by the time the .if is evaluated the unset variable evaluates to empty. Kris --mYCpIKhGyMATD0i+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCDr9EWry0BWjoQKURAlFhAJ9E3wZ31rE+8mFXIYYamxaGqvhBhwCg/5bq WAYdKl9f2212Gw7rCT8KShg= =nIdg -----END PGP SIGNATURE----- --mYCpIKhGyMATD0i+--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050213024524.GA24740>