Commit 68e5a490c1 for perl
commit 68e5a490c17dd259be9a5a889f3880ec81e3c349
Author: Karl Williamson <khw@cpan.org>
Date: Tue Nov 17 09:48:00 2026 -0700
makedependfile.SH: Avoid some work
This script only outputs pre-processor control lines. That means
anything we do is wasted on the vast majority of lines which aren't of
this type. So, after we have resolved all the continuations and
comments, if it is one of the latter, we can just skip it.
diff --git a/makedependfile.SH b/makedependfile.SH
index 742421335a..6f038b0f26 100644
--- a/makedependfile.SH
+++ b/makedependfile.SH
@@ -94,7 +94,7 @@ $echo "Finding dependencies for $filebase$_o"
#
# sed labels here use 7 characters max due to a solaris restriction
( $echo "#line 2 \"$file\""; \
- $sed -n <$file \
+ $sed <$file \
-e "/^${filebase}_init(/q" \
\
-e ': tstcont' \
@@ -189,14 +189,16 @@ $echo "Finding dependencies for $filebase$_o"
-e '# of the lines joined with their continuations' \
-e 's/\\\n//g' \
\
+ -e '# We only output preprocessor control lines; now that the' \
+ -e '# current line has no continuations or multi-line comments,' \
+ -e '# we know enough to skip non-preprocessor lines' \
+ -e '/^[ ]*#/!d' \
+ \
-e '# Delete two styles of lines that specify the line number' \
-e '/^#line/d' \
-e '/^#[ ]+[0-9][0-9]* /d' \
\
- -e '/^[ ]*#/{' \
- -e 's/.\{255\}/&\\\n/g' \
- -e p \
- -e '}' \
+ -e 's/.\{255\}/&\\\n/g' \
| $grep -v ":" \
) >UU/$file.c