help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Did $(if $(myvar), ...) behavior change from make 3.81 to make 4.1?


From: David Drinnan
Subject: Re: Did $(if $(myvar), ...) behavior change from make 3.81 to make 4.1?
Date: Wed, 14 Jun 2017 17:58:15 -0500

Ah, interesting, good catch.

I used your workaround, and ran into another issue caused by the
workaround.

...

Turns out, after much pulling of hair, and after adding debug to check the
var values before and after on both make 4.1 and make 3.8, that - lo and
behold - the if conditional function doesn't work as expected in 3.8
either! The variable stays the same before and after. So 4.1 is working
better at least, to let you know it's not doing anything.

I will open a bug.

Best,
--David Drinnan

On Mon, Jun 12, 2017 at 8:49 PM, Paul Smith <address@hidden> wrote:

> On Mon, 2017-06-12 at 18:26 -0500, David Drinnan wrote:
> > I have a makefile that works just fine in make 3.81 on RHEL 6.8, but
> > quickly fails with make 4.1 on Ubuntu 16.04.
> >
> > It's failing on this line (details changed, but same logic):
> >
> > $(if $(myvar),myothervar := abc,myothervar := xyz)
> >
> > with error message:
> >
> > build.mk:3: *** empty variable name.  Stop.
>
> This is an issue in the parser.  I doesn't matter whether myvar is empty
> or not, that's not what it's complaining about.  The problem is that the
> parser is interpreting this as a target-specific variable assignment,
> not a normal variable assignment.  That is, instead of expanding to:
>
>   myothervar := abc
>
> it's expanding as if you'd written:
>
>   myothervar :   = abc
>
> which is a target-specific variable assignment with an empty variable
> name.
>
> This is a bug: it would be greatly helpful if you could file this on
> Savannah, here: https://savannah.gnu.org/bugs/?func=additem&group=make
>
>
> As for workarounds, the simplest one is to move the if-statement into
> the right-hand side; I'm not sure why you need to include the entire
> assignment in the if-statement.  Like this:
>
>     myothervar := $(if $(myvar),abc,xyz)
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]