help-make
[Top][All Lists]
Advanced

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

Re: Wierd if function behaviour


From: Lee Shallis
Subject: Re: Wierd if function behaviour
Date: Sat, 30 Jul 2016 23:26:50 +0100

On 30 July 2016 at 22:55, Paul Smith <address@hidden> wrote:

> Please always reply to the mailing list, not to me personally.
>

​Sorry didn't realise I was, still not used to using mailing lists.​



> On Sat, 2016-07-30 at 22:39 +0100, Lee Shallis wrote:
> > On 30 July 2016 at 13:47, Paul Smith <address@hidden> wrote:
> > > The strange formatting makes this hard to read, but:
> > >
> > >   $(info $(0)_CALL=(if ifeq ...
> > >                   ^^^
> > >                   missing $
> > >
> >
> > No that was deliberate, it's meant to tell me which value I'm looking
> > at in the output.
> > As for the if not having a $ that was so I could see what the previous
> > statement looked like was before it was fully evaluated.
> >
> > It's just this bit I need you to analyse:
> > > $(eval $(0)_CALL=$(if ifeq "$($(0)_PREVMOD)"
> "$($(0)_LASTMOD)",_UPTODATE,_UPDATECC))
> >                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Well, $(if ifeq ...) is always true, because the result of expanding
> that value will never be the empty string.
>
> You seem to be under the impression that the "condition" passed to the
> if-function is related to the ifeq/ifneq/ifdef/ifndef conditional
> syntax; it's not.
>

​Ah that, I saw ​it in another thread on stackoverflow while I was looking
for something else and assume it was correct method of usage, thank you for
correcting me


> You probably want to use filter-out to see if the value of the first is
> identical to the second; something like:
>
>    $(if $(filter-out <first>,<second>),<run-if-not-equal>,<run-if-equal>)
>
> Note the reversal of the then- and else-arguments: here if the values
> are equal then the filter-out returns an empty string, which means the
> condition is considered false.
>
​
​Thank you, I expanded on your advice to create this:

if_eql=$(if $(filter-out $(1),$(2)),$(4),$(3))​

if_neq=$(if $(filter-out $(1),$(2)),$(3),$(4))
>

​which​ helped me get the result I was expecting


-- 
We will die a permanent death unless we trust in Jesus Christ our saviour
and repent our sinful ways


reply via email to

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