[SUBDIRMK RFC v2 REPOST 2/4] README: v2: Line joining with &\

Ian Jackson ijackson at chiark.greenend.org.uk
Thu Dec 19 00:53:16 GMT 2019


make has a weird rule for line joining in recipes, where the \ is
retained.  This is very annoying espcially when writing little scripts
in other languages in recipes.  The GNU make documentation suggests
using a `define' block, in which the \ are still necessary, but
vanish.  But that separates out the recipe from the rule, and also
demands that the recipe text be given a name.

(Note that .ONESHELL offers an alternative but sadly is not available
on a per-rule basis.  This is even less sensible with non-recursive
make, where you might want different directories to have different
settings.)

So, provide &\ which does the other thing, swallowing the newline and
discarding the &\, even in rules.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 README | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README b/README
index fe9f5c3..593d164 100644
--- a/README
+++ b/README
@@ -250,6 +250,7 @@ So pathname syntax is a subset of:
 
 &\&		=>	&		general escaping mechanism
 &\$		=>	$
+&\NEWLINE				eats the newline and vanishes
 
 &$VARIABLE	$(sub/dir/VARIABLE)
 	VARIABLE is ASCII starting with a letter and matching \w+
-- 
2.11.0




More information about the sgo-software-discuss mailing list