Am 16.09.25 um 6:34 PM schrieb Jakub Jelinek:
On Tue, Sep 16, 2025 at 06:19:41PM +0200, Joerg Boehmer wrote:
-/* Apply Make quoting to STR, TRAIL. Note that it's not possible to
- quote all such characters - e.g. \n, %, *, ?, [, \ (in some
- contexts), and ~ are not properly handled. It isn't possible to
- get this right in any current version of Make. (??? Still true?
- Old comment referred to 3.76.1.) */
+/* Apply Make quoting to STR, TRAIL. GNU make supports escape sequences in
+ rules for characters that are special to make. Note that it's not possible
+ to quote all such characters and some are not properly handled. The current
+ status with version 4.4.1 of GNU make is:
+ <newline> - No escape possible. The character always introduces a line
break
+ or a continuation line.
+ <space>, :, # - Escaped spaces are properly handled in targets and
+ prerequisites.
+ <tab> - Escaped tab-characters sometimes decay to a space in targets and
+ prerequisites.
+ =, ; - No escape possible. These characters always retain their special
+ meaning.
Can't one use e.g.
$(shell echo =)
for =, or $(shell echo ';') ?
Or perhaps better
$(firstword =)
or
$(firstword ;)
?
Jakub
Good idea.
It seems to work for the case $(firstword =);
it doesn't work for (firstword ;).
But supporting filenames with characters from the non-portable filename
character set is only a voluntary feature of (GNU) Make. Therefore, I
would only support characters that Make can handle directly through
quoting. An expansion hack doesn't seem appropriate here.
Joerg