Subject: Re: bsd.lib.mk should use MKUPDATE instead of UPDATE ?
To: Luke Mewburn <lukem@netbsd.org>
From: Darrin B.Jewell <dbj@netbsd.org>
List: tech-toolchain
Date: 09/13/2006 11:02:00
Luke Mewburn <lukem@NetBSD.org> writes:
> I'm not sure how well the "${empty(PRESERVE):?" syntax works
> in make(1); maybe it's better than it used to be.

Well, the construct used in that makefile works, but I did
spend some time scratching my head over the :? syntax.
It turns out that the major problem I encountered is that
the `:' modifier parsing happens first, and then the conditional
is evaluated.  This implies that you cannot use a modifier
inside the parenthesis in the predicate like this:

   ${empty(FOO:Mbar):?baz:quux}

Because it will first get separated into
     "empty(FOO" with :M matching the pattern "bar)"
with the :? operator trying to match on the result.

I also wasn't able to get just about any other
predicate in the :? operator to work, I tried unsuccessfully
various ways of using == != > < etc. like this:

    ${FOO=="bar":?baz:quux}
 or this
    ${${FOO}=="bar":?baz:quux}

But after some experimentation and watching make debug
output, I still couldn't find a useful way to use any
of these other operators.

I also just tried a plain variable in the predicate like this:
   ${FOO:?baz:quux}

Since the man page indicates that conditional expressions
without a relational operator are compared against 0 or the empty
string, but it seems to always return the true consequent
no matter what values for $FOO I tried.

I'd like to see some clear use cases for :?

It would definitely be useful if it worked, but for the most part I
couldn't make it do what I wanted.  I ended up settling on the one
construct that I could get expected behavior out of.

Darrin