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

Eli Zaretskii <[email protected]> Sun, 13 Apr 2014 08:26:30 +0300
Newsgroups gmane.comp.gnu.make.devel
Message-ID <[email protected]>
> From: Paul Smith <[email protected]>
> Cc: [email protected]
> Date: Sat, 12 Apr 2014 18:36:13 -0400
> 
>    FOO = foo\ bar
>    BAR = case '$(FOO)' in (foo\ bar) echo $@;; esac
> 
>    $(FOO) : ; $(BAR)
> 
> When expanding $(BAR) in the recipe, make cannot determine that it
> should remove the backslash inside '$(FOO)' but not the one in
> '(foo\ bar)', and if it removes the latter the script will have a syntax
> error.  And there are a TON of scripts like this out there (any
> automake-generated makefile has numerous examples).

Aren't these very problems solved every day in Unix shells, Lisp, and
even in Make itself?  You just double any literal backslash on
encoding, and that's it.  What am I missing?

> If we say we're going to remove all backslashes (or even just all
> backslashes that quote characters special to make) as part of our
> "decode" step then we're telling users they cannot use backslashes in
> their recipes: they must choose a different quoting method, because make
> will be messing with any backslashes that appear in recipes.

Not if we find a way of knowing which backslashes were introduced by
encoding.