From 3f441bd58ae91a38e1f0f872c80a126166e85338 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Thu, 5 Aug 2021 09:15:26 +0100 Subject: fix .parse-deps when input spans multiple lines .parse-deps breaks when inputs such as the following are passed: foo.o: \ foo.c \ foo.h There's 3 issues: 1. The first \ wouldn't be folded as the space prior to the \ would be removed by the removal of the target name. 2. Extra spaces would end up in front of every name in the final output. 3. \n in the pattern of the s command is not portable to non-gnu-sed. The new version's folding loop: 1. Removes any double forward slashes currently present in the pattern space. 2. Adds a double forward slash at the end of the line. 3. Removes the backslash, double forward slash, character following it (newline) and any spaces following that character. This solves all three problems. --- .parse-deps | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.parse-deps b/.parse-deps index cad20d9..e8dc74b 100755 --- a/.parse-deps +++ b/.parse-deps @@ -4,12 +4,14 @@ # collapse lines :loop /\\$/ { + s|///*|/|g + s|$|//| N - s/ \\\n// + s|\\//. *|| b loop } # split on unescaped spaces -s/\([^\]\) /\1\ +s/\([^\]\) */\1\ /g # unescape spaces s/\\ / /g -- cgit v1.2.3-54-g00ecf