From 88f1bc8b55b9f5abf35fdf974310c1063fa41068 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 3 Mar 2012 18:45:08 +0000 Subject: Modify backslash/newline handling for POSIX. 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. --- tests/scripts/misc/bs-nl | 56 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 15 deletions(-) (limited to 'tests/scripts/misc') diff --git a/tests/scripts/misc/bs-nl b/tests/scripts/misc/bs-nl index 979abb5..e27a3f7 100644 --- a/tests/scripts/misc/bs-nl +++ b/tests/scripts/misc/bs-nl @@ -50,27 +50,53 @@ run_make_test("squote:;\@echo 'squ\\\n\t\t ote'\n", # Backslash-newlines in variable values # Simple -run_make_test(" -var = he\\\nllo -var:;\@echo '|\$(var)|'", +run_make_test(q! +var = he\ +llo +var:;@echo '|$(var)|'!, '', "|he llo|"); -# Preserve preceding space -run_make_test(" -var = he \\\nllo -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(" -var = he\\\n llo -var:;\@echo '|\$(var)|'", +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|"); -# One space per bs-nl -run_make_test(" -var = he\\\n\\\n\\\n llo -var:;\@echo '|\$(var)|'", +# 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; -- cgit v1.2.3