Date: Thu, 3 Aug 2000 13:52:41 +0200 From: Neil Blakey-Milner <nbm@mithrandr.moria.org> To: Sheldon Hearn <sheldonh@uunet.co.za> Cc: hackers@FreeBSD.org Subject: Re: Berkeley make: evaluations inside for loops Message-ID: <20000803135241.A46679@mithrandr.moria.org> In-Reply-To: <76800.965302263@axl.ops.uunet.co.za>; from sheldonh@uunet.co.za on Thu, Aug 03, 2000 at 01:31:03PM %2B0200 References: <76800.965302263@axl.ops.uunet.co.za>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000803135241.A46679>