From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 05:10:06 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 F261A16A4CE for ; Sun, 13 Feb 2005 05:10:06 +0000 (GMT) Received: from lakermmtao12.cox.net (lakermmtao12.cox.net [68.230.240.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6339943D2F for ; Sun, 13 Feb 2005 05:10:06 +0000 (GMT) (envelope-from mezz7@cox.net) Received: from mezz.mezzweb.com ([68.103.32.140]) by lakermmtao12.cox.net (InterMail vM.6.01.04.00 201-2131-117-20041022) with ESMTP id <20050213051004.DOSX6890.lakermmtao12.cox.net@mezz.mezzweb.com>; Sun, 13 Feb 2005 00:10:04 -0500 Date: Sat, 12 Feb 2005 23:11:12 -0600 To: "Kris Kennaway" References: <20050213023201.GB24426@xor.obsecurity.org> From: "Jeremy Messenger" Content-Type: text/plain; format=flowed; delsp=yes; charset=us-ascii MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <20050213023201.GB24426@xor.obsecurity.org> User-Agent: Opera M2/7.54 (Linux, build 955) cc: hackers@freebsd.org Subject: Re: 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 05:10:07 -0000 On Sat, 12 Feb 2005 18:32:01 -0800, Kris Kennaway wrote: > The following small makefile doesn't behave as one would naively > expect: This problem is known to me for pretty very long time when I reported to Brandon D. Valentine for linux-flashplugins6 issue.. You will see in the Makefile that the PLUGINSDIR doesn't work that has like this: ===================================== do-install: @${MKDIR} ${PREFIX}/lib/linux-flashplugin6 .for f in ${LIBFILES} @${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/lib/linux-flashplugin6 .if exists(${PLUGINSDIR}) @${LN} -sf ${PREFIX}/lib/linux-flashplugin6/${f} ${PREFIX}/${PLUGINSDIR} .endif .endfor ===================================== Cheers, Mezz > 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 -- mezz7@cox.net - mezz@FreeBSD.org FreeBSD GNOME Team http://www.FreeBSD.org/gnome/ - gnome@FreeBSD.org