Re: Output quoting (was: Re: Possible solution for special characters in makefile paths)

Frank Heckenbach <[email protected]> Thu, 10 Apr 2014 19:47:32 +0200
Newsgroups gmane.comp.gnu.make.devel
Message-ID <[email protected]>
Tim Murphy wrote:

> On 10 April 2014 12:37, Frank Heckenbach <[email protected]> wrote:
> > Tim Murphy wrote:
> >
> >> On 10 April 2014 11:56, Frank Heckenbach <[email protected]> wrote:
> >> > it can be quite confusing, e.g.:
> >> >
> >> > $(FILENAME): ; $(file >$(FILENAME),hi)
> >> >
> >> > Define rules for two targets ("foo bar" and "biz baz") which
> >> > actually create a totally different file ("foo bar biz baz")?
> >> > No, better just error out.
> >>
> >> Then how does one tell $(file) to create a filename with spaces in it?
> >> how does one create a target with spaces in it?
> >
> > By quoting the space (the details of which are just being discussed).
> 
> Paul wrote that this:
>    FILENAME = foo\ bar biz\ baz
> 
>    $(file >$(FILENAME),hi)
> should return an error.

Because it contains an unquoted space which would be a word-separator.

If you want a single file name, write:

    FILENAME = foo\ bar\ biz\ baz

> I was suggesting >> as an argument why start/end delimiters  such as
> $[ and ] are
> not so bad because make already has delimiters for function parameters
> such as those
> of $file - whether or not it uses them.

Unfortunately, that's not enough. Consider a function such as
$(filter). It has 2 arguments (separated by a comma). Each of those
arguments can be a list of strings, separated by whitespace. So each
of those strings cannot contain a comma or whitespace yet. When we
we want to change that, we'll need some way of quoting or escaping,
whether \, $[] or whatever.