Re: Quoting special characters (was: Re: Possible solution for special characters in makefile paths)
Eli Zaretskii <[email protected]>
| Newsgroups | gmane.comp.gnu.make.devel |
|---|---|
| Message-ID | <[email protected]> |
> Date: Tue, 25 Feb 2014 17:09:30 +0100 > From: Frank Heckenbach <[email protected]> > Cc: [email protected] > > - In the makefile (as in this example): Take it literally, including > any quotes. > > - As a result of $(wildcard) or similar functions: Make must insert > quoting as necessary (so the shell will interpret it as the actual > filenames). As discussed, there are several ways to do this, > either backslash every character, or single-quote the whole > string, escaping embedded single-quotes. I'd prefer the latter for > readability, but that's an implementation detail. > > - Targets from the command-line: Same as $(wildcard). > > - Values from the command-line or environment variables (I think the > two are equivalent): Now that's a little problem. One might like > to quote them like the previous items, so something like > make FOO="my file name" > would work as intended. But that would break compatibility when a > variable is actually meant to contain a list of filenames, or see > my LOG_START example for another case that must not be turned into > a single word. So I'd say since make has no way of knowing what a > variable is meant to be, it must assume separate words and store > it as is (also for backward-compatibility). If something else is > intended, the user will need to do additional quoting: > make FOO="'my file name'" BAR="file1 file2 file3" I think we will need to provide a quoting function, something like a wrapper for the gnulib's quotearg module, since programming quoting in Make-ish is not easy, if at all possible.