From owner-freebsd-hackers Thu Aug 3 4:52:52 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from ns1.sunesi.net (ns1.sunesi.net [196.15.192.194]) by hub.freebsd.org (Postfix) with ESMTP id 800BB37B8EA for ; Thu, 3 Aug 2000 04:52:44 -0700 (PDT) (envelope-from nbm@sunesi.net) Received: from nbm by ns1.sunesi.net with local (Exim 3.03 #1) id 13KJYH-000CAJ-00; Thu, 03 Aug 2000 13:52:41 +0200 Date: Thu, 3 Aug 2000 13:52:41 +0200 From: Neil Blakey-Milner To: Sheldon Hearn Cc: hackers@FreeBSD.org Subject: Re: Berkeley make: evaluations inside for loops Message-ID: <20000803135241.A46679@mithrandr.moria.org> References: <76800.965302263@axl.ops.uunet.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <76800.965302263@axl.ops.uunet.co.za>; from sheldonh@uunet.co.za on Thu, Aug 03, 2000 at 01:31:03PM +0200 Organization: Sunesi Clinical Systems X-Operating-System: FreeBSD 3.3-RELEASE i386 X-URL: http://rucus.ru.ac.za/~nbm/ Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu 2000-08-03 (13:31), Sheldon Hearn wrote: > Can anyone explain to me why the first Makefile works and yet the second > Makefile doesn't? The second Makefile produces the following error > messages on ``make test'' > > | "Makefile", line 1: Malformed conditional (widget == ${BAZ}) > | "Makefile", line 1: Need an operator > | "Makefile", line 3: if-less endif > | "Makefile", line 3: Need an operator > | "Makefile", line 9: Need an operator > | make: fatal errors encountered -- cannot continue > > #Makefile1: > FOO= widget > BAZ= widget > BAR= > .if ${FOO} == ${BAZ} > BAR= equal > .endif > > test: > echo BAR=${BAR} > > #Makefile2: > BAZ= widget > .for FOO in ${BAZ} > .if ${FOO} == ${BAZ} > BAR= equal > .endif > .endfor > > test: > echo BAR=${BAR} Makefile2 expands to: BAZ= widget .if widget == ${BAZ} BAR= equal .endif And '.if' only takes "expressions", which can be comparisons (ie, "!=", "=="), which in turn must have a variable on the left hand side. (don't ask me why) Therefore, you should use: .if ${BAZ} == ${FOO} instead. Neil -- Neil Blakey-Milner Sunesi Clinical Systems nbm@mithrandr.moria.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message