tech-userlevel archive

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

Re: make: new modifyer :Y



 >>with a more elegant
 >>
 >>  .if ${MKXXX:Y}
 >>  .endif

> I am not opposed to :Y, but I note that you can already get most of
> what you are looking for without changing make(1) at all.  For
> example, you could put a definition like this in a global include file
> like bsd.sys.mk:

I'm well aware of this kind of tricks. Alistair showed almost the same
code. You can find my response here.
http://mail-index.netbsd.org/tech-userlevel/2011/11/06/msg005720.html
See the last paragraph. bsd.sys.mk as a place where ISTRUE variable can be
defined is a good idea but I don't think ${FOO:${ISTRUE}} is as good as 
${FOO:Y}.
I'm surprised that 30 lines of code can cause objections. Again, take
into account how often we use boolean values in bmake-based projects
and how ugly long-standing practice ( !empty(FOO:M[Yy][Ee][Ss]) ) is.
Also, note that all these tricks do the check for only one value, either
YES or NO. What if FOO is set to an empty string. Will it be treated as
TRUE or FALSE? This depends on how we do the check, using
${FOO:${ISTRUE}} or ${FOO:${ISFALSE}}.

>       ISTRUE = Uno:M[Yy][Ee][Ss]

> and then you can use it like this:

>       demo:
>       .if ${FOO:${ISTRUE}}
>               @echo FOO is true
>       .else
>               @echo FOO is not true
>       .endif

> --apb (Alan Barrett)


-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index