tech-userlevel archive

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

Re: make: new modifyer :Y



On Mon, Nov 07, 2011 at 01:20:40AM +0300, Aleksey Cheusov wrote:
>  >> with more elegant
>  >> 
>  >>   .if ${MKXXX:Y}
>  >>   .endif
>  >> 
>  >> Find the patch in the attachment. Objections?
> 
> > Yeah, I'm not a fan of "Y" - it's too terse, and seems to be an obscure
> > idiom for a longer sequence.
> ...
> > Unfortunately, the other side of the coin wrt brevity is comprehension,
> 
> I believe :Y name is self-explanatory. "Y" here means "Yes". Just like
> "M" in ":M" means Match, "O" means Order in :O, "S" means "Substitute"
> in :S and so on.
> 
> So, the following statement in bmake
> 
>     .if ${VARNAME:Y}
> 
> means 
> 
>     if VARNAME is set to Yes
> 
> The above bmake statement is almost as clear as in pure English sentense.
> 
> Another reason to make this modifier single-letter is that we check
> variables for boolean true/false very often, hundreds and hundreds of
> times in pkgsrc and base system. Some other single-letter modifiers like
> :D and :L are used very rarely.

Thanks, that was exactly what I was missing -- an indication of what the
letter 'Y' represents. I am much obliged. :-P
 
> > I'm not sure what the 'Y' modifier in other
> > make programs does,
> 
> Nothing. FreeBSD and OpenBSD make do not provide :Y.
> NetBSD make is way ahead of them.
> 
> > but I'm fairly sure it's not this - the NetBSD make(1)
> > program is used in many places you would not even think of.
> :Y doesn't break backward compatibility.
> So, it cannot break an existing code.

No, there are other make programs out there, and our make used to bring
in some of their modifiers for compatibility.

Seriously, though, if you want to impose this upon us all (and I think
that this "all" goes a lot further than any of the BSD operating
systems), we'd need to have an idea of what it gains for us.  It seems
like this is for the convenience of a few/one, with very little gain
for anyone else. The commonly used notation for this kind of choice
is "yn". That doesn't translate to almost any other language - most
of the germanic languages start the affirmative with a "j", and it used
to be that the best thing to check on for anything multi-languaged was
"!= 'n'".

So I don't buy the "it makes sense from a language" argument, and it
seems needlessly complicated to have a make modifier for this.

Can't you just use a make definition?

Script started on Sun Nov  6 14:36:19 2011
[14:36:19] agc@netbsd-vm1 ~/y [13] >cat Makefile
YES=[Yy][Ee][Ss]

MKLOVE?=yes

.if ${MKLOVE:M${YES}}
all:
        @echo "MKLOVE set to yes"
.else
all:
        @echo "MKLOVE set to no"
.endif
[14:36:24] agc@netbsd-vm1 ~/y [14] > make
MKLOVE set to yes
[14:36:27] agc@netbsd-vm1 ~/y [15] > make MKLOVE=no
MKLOVE set to no
[14:36:35] agc@netbsd-vm1 ~/y [16] > exit
exit

Script done on Sun Nov  6 14:36:44 2011

(typescript cleaned up slightly to remove control characters)

Regards,
Alistair


Home | Main Index | Thread Index | Old Index