Re: Output quoting (was: Re: Possible solution for special characters in makefile paths)
Tim Murphy <[email protected]> Thu, 10 Apr 2014 12:24:49 +0100
| Newsgroups | gmane.comp.gnu.make.devel |
|---|---|
| Message-ID | <CACJSg6=DDBrDaqPW8QpWFbFBcjnCZ3HwPbu5GQBtCQ1dCP-gyA@mail.gmail.com> |
On 10 April 2014 11:56, Frank Heckenbach <[email protected]> wrote: > Paul Smith wrote: >> FILENAME = foo\ bar biz\ baz >> >> $(file >$(FILENAME),hi) >> >> Does this create a file 'foo bar biz baz'? Or give an error because two >> words were provided where one was expected? Or something else? > > I'd say an error. We should be clear about what a string means and > if a given string (like the above, or however else it will be > written) is meant to contain multiple words and used in a > single-word context, that's simply wrong and we should just tell the > user so. Trying to interpret things differently depending on context > is partly what got make into this predicament (WRT backslash > handling), and 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? $(file) requires > or << to start an argument and , as a delimiter. So there is already a kind of context or type marker in this call. Why not make > or >> generally the start of a filename and < or << generally the end? or $(filename f) or any other pattern you choose. Then you'd be doing little worse than the $(file) function does. BTW $(file) has a bug and segfaults on blank input. Regards, Tim -- You could help some brave and decent people to have access to uncensored news by making a donation at: http://www.thezimbabwean.co.uk/friends/