helper perl script to find file dependencies.
authorGengbin Zheng <gzheng@illinois.edu>
Sat, 27 Sep 2003 08:28:13 +0000 (08:28 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Sat, 27 Sep 2003 08:28:13 +0000 (08:28 +0000)
src/scripts/dep.pl [new file with mode: 0755]

diff --git a/src/scripts/dep.pl b/src/scripts/dep.pl
new file mode 100755 (executable)
index 0000000..5adc339
--- /dev/null
@@ -0,0 +1,50 @@
+# input set of strings to match
+@dontprint = @ARGV;
+@ARGV=();
+
+$n = @dontprint;
+
+# read from stdin
+
+while (<>) {
+# if line ends with : it is the start of a dependency
+  chop;
+  if ( ($target,$other) = /([a-zA-Z0-9_]*\.o:)(.*)$/ ) {
+    print $target;
+    $go=1;
+    $first=1;
+    while ($go) {
+       if ($first) {
+         $_ = $other;
+       } else {
+         $_ = <> || last;
+         chop;
+       }
+       $first = 0;
+
+       if ( /\\$/ ) {
+         chop;
+         $go = 1;
+       } else {
+         $go = 0;
+       }
+
+       @files = split;
+       foreach $word (@files) {
+         $bad = 0;
+         foreach $notword (@dontprint) {
+           if ( $word =~ /$notword/ ) {
+             $bad = 1;
+             last;
+           }
+         }
+         if ( ! $bad ) {
+             print " \\\n";
+             print "   ",$word;
+         }
+       }
+    }
+  }
+  print "\n";
+}
+