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
[EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to