aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2021-08-05 09:15:26 +0100
committerTomasz Kramkowski <tk@the-tk.com>2021-08-05 09:37:09 +0100
commit3f441bd58ae91a38e1f0f872c80a126166e85338 (patch)
tree31bbd91786c77a98bbe6f76beee4959327f8f056
parent7ece26f7f86c099d0e483a749dbe77db73b2cb9c (diff)
downloadpack-3f441bd58ae91a38e1f0f872c80a126166e85338.tar.gz
pack-3f441bd58ae91a38e1f0f872c80a126166e85338.tar.xz
pack-3f441bd58ae91a38e1f0f872c80a126166e85338.zip
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.
-rwxr-xr-x.parse-deps6
1 files 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