chiark / gitweb /
Syntax: Line joining with &\
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 18 Dec 2019 21:44:15 +0000 (21:44 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 29 Dec 2019 16:04:44 +0000 (16:04 +0000)
commitdd094d4ab324fc5ea1d611edeaad85e68d20da71
tree452fd1c81ed20b44c27c76bbd172f8846f251a42
parent9f681120dc97ea063c3fd13b550ddc19e66e9403
Syntax: Line joining with &\

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.

Add a test case too.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
README
generate
tests/filter/sub/dir/Subdir.mk.expected
tests/filter/sub/dir/Subdir.sd.mk