mirror of
https://github.com/mirror/make.git
synced 2025-01-10 20:30:20 +08:00
88f1bc8b55
We fixed Savannah 16670 but that broke previously-working makefiles that relied on the GNU make behavior. The POSIX behavior doesn't seem to me to be better, and can be obtained using GNU make as well, so put it back as the default behavior and require .POSIX to get the POSIX behavior. Add a new section to the manual discussing backslash/newline handling. Update the test suite.
103 lines
2.0 KiB
Perl
103 lines
2.0 KiB
Perl
# -*-perl-*-
|
|
$description = "Test backslash-newline handling.";
|
|
|
|
$details = "";
|
|
|
|
# TEST #1
|
|
# -------
|
|
|
|
# Backslash-newlines in recipes
|
|
|
|
# These are basic backslash-newlines with no tricks
|
|
run_make_test("fast:;\@echo fa\\\nst\n",
|
|
'', 'fast');
|
|
|
|
run_make_test("slow:;\@: no-op; echo sl\\\now\n",
|
|
'', 'slow');
|
|
|
|
run_make_test("dquote:;\@echo \"dqu\\\note\"\n",
|
|
'', 'dquote');
|
|
|
|
run_make_test("squote:;\@echo 'squ\\\note'\n",
|
|
'', "squ\\\note");
|
|
|
|
# Ensure that a leading prefix character is omitted
|
|
run_make_test("fast:;\@echo fa\\\n\tst\n",
|
|
'', 'fast');
|
|
|
|
run_make_test("slow:;\@: no-op; echo sl\\\n\tow\n",
|
|
'', 'slow');
|
|
|
|
run_make_test("dquote:;\@echo \"dqu\\\n\tote\"\n",
|
|
'', 'dquote');
|
|
|
|
run_make_test("squote:;\@echo 'squ\\\n\tote'\n",
|
|
'', "squ\\\note");
|
|
|
|
# Ensure that ONLY the leading prefix character is omitted
|
|
run_make_test("fast:;\@echo fa\\\n\t st\n",
|
|
'', 'fa st');
|
|
|
|
run_make_test("slow:;\@: no-op; echo sl\\\n\t\tow\n",
|
|
'', "sl ow");
|
|
|
|
run_make_test("dquote:;\@echo \"dqu\\\n\t ote\"\n",
|
|
'', 'dqu ote');
|
|
|
|
run_make_test("squote:;\@echo 'squ\\\n\t\t ote'\n",
|
|
'', "squ\\\n\t ote");
|
|
|
|
# Backslash-newlines in variable values
|
|
|
|
# Simple
|
|
run_make_test(q!
|
|
var = he\
|
|
llo
|
|
var:;@echo '|$(var)|'!,
|
|
'', "|he llo|");
|
|
|
|
# Condense trailing space
|
|
run_make_test(q!
|
|
var = he \
|
|
llo
|
|
var:;@echo '|$(var)|'!,
|
|
'', "|he llo|");
|
|
|
|
# Remove leading space
|
|
run_make_test(q!
|
|
var = he\
|
|
llo
|
|
var:;@echo '|$(var)|'!,
|
|
'', "|he llo|");
|
|
|
|
# Multiple bs/nl condensed
|
|
run_make_test(q!
|
|
var = he\
|
|
\
|
|
\
|
|
llo
|
|
var:;@echo '|$(var)|'!,
|
|
'', "|he llo|");
|
|
|
|
# POSIX: Preserve trailing space
|
|
run_make_test(q!
|
|
.POSIX:
|
|
x = y
|
|
var = he \
|
|
llo
|
|
var:;@echo '|$(var)|'!,
|
|
'', "|he llo|");
|
|
|
|
# POSIX: One space per bs-nl
|
|
run_make_test(q!
|
|
.POSIX:
|
|
x = y
|
|
var = he\
|
|
\
|
|
\
|
|
llo
|
|
var:;@echo '|$(var)|'!,
|
|
'', "|he llo|");
|
|
|
|
1;
|