From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 02:32:02 2005 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 BE1B816A4CE for ; Sun, 13 Feb 2005 02:32:02 +0000 (GMT) Received: from obsecurity.dyndns.org (CPE0050040655c8-CM00111ae02aac.cpe.net.cable.rogers.com [69.199.47.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 824AC43D1F for ; Sun, 13 Feb 2005 02:32:02 +0000 (GMT) (envelope-from kris@obsecurity.org) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id DC33351485; Sat, 12 Feb 2005 18:32:01 -0800 (PST) Date: Sat, 12 Feb 2005 18:32:01 -0800 From: Kris Kennaway To: hackers@FreeBSD.org Message-ID: <20050213023201.GB24426@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IiVenqGWf+H9Y6IX" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Subject: Makefile .for and .if expansion 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: Sun, 13 Feb 2005 02:32:02 -0000 --IiVenqGWf+H9Y6IX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The following small makefile doesn't behave as one would naively expect: MANLANG?=foo "" all: .for i in ${MANLANG} .if empty(${i}) @echo foo ${i} .endif .endfor ports-i386%make foo foo foo 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. In order to get this to work I seem to have to do the following: MANLANG?=foo "" .for i in ${MANLANG} j= ${i} .if (${j} != "\"\"") .for l in ${j} k+= ${l} .endfor .endif .endfor all: @echo ${k} ports-i386%make foo If I remove the inner .for it breaks, and if I remove the j assignment it breaks. Also if I try and remove the use of k and put an echo inside the inner .for (with the all: preceding the whole loop) it breaks. This is extremely nasty. Am I missing an easier way to do this? Kris --IiVenqGWf+H9Y6IX Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCDrwhWry0BWjoQKURAqwtAJ42w/TqXmlfi53hPkwpP29G0xr/VACgnrn2 hjVDAhUPs1ye6PD1XFptDPo= =qVYS -----END PGP SIGNATURE----- --IiVenqGWf+H9Y6IX--