Subject: Re: new feature for bmake: read-only variables
To: None <tech-pkg@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-pkg
Date: 09/02/2005 22:14:08
On Fri, 02 Sep 2005, Roland Illig wrote:
> > TOOLS_PLATFORM_PAIRS+= cat /bin/cat
> > TOOLS_PLATFORM_PAIRS+= chgrp /usr/bin/chgrp
> > TOOLS_PLATFORM_PAIRS+= chmod /bin/chmod
> > # etc...
> > .for i j in ${TOOLS_PLATFORM_PAIRS}
> > TOOLS_PLATFORM.${i} ?= ${j}
> > .READONLY: ${i}
> > .endfor
>
> Looks good at first sight, but not at second. You cannot have
> white-space in the tool names. Not even with quoting them.
That's a bug in make(1). The code that handles modifiers (as in
${FOO:C/old/new/}) splits variables into words in a way that handles
quoting. The code that handles .for loops splits variables into words
in a way that does not handle quoting.
The "Make a list with the remaining words" code starting near line 222
of src/usr.bin.make/for.c needs to be changed to call brk_string()
instead of using its own ad-hoc parser.
--apb (Alan Barrett)