aboutsummaryrefslogtreecommitdiff
path: root/showdeps
diff options
context:
space:
mode:
Diffstat (limited to 'showdeps')
-rw-r--r--showdeps28
1 files changed, 28 insertions, 0 deletions
diff --git a/showdeps b/showdeps
new file mode 100644
index 0000000..f59aeca
--- /dev/null
+++ b/showdeps
@@ -0,0 +1,28 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+my @targets;
+my @keys;
+my %prereqs;
+
+$ENV{LANGUAGE} = "en_US";
+for (`make --debug=b -n`) {
+ next if not /Prerequisite `([^']+)' is newer than target `([^']+)'/;
+
+ # Don't consider prerequisites that are targets.
+ unless ($ARGV[0] and $ARGV[0] eq '-a') {
+ push @targets, $2 if not grep { $_ eq $2 } @targets;
+ next if grep { $_ eq $1 } @targets;
+ }
+
+ push @keys, $1 if not grep { $_ eq $1 } @keys;
+ push @{$prereqs{$1}}, $2 if not grep { $_ eq $2 } @{$prereqs{$1}};
+}
+
+if (@keys) {
+ print "---\n";
+ print "$_ -> @{$prereqs{$_}}\n" for @keys;
+ print "---\n";
+}