aboutsummaryrefslogtreecommitdiff
path: root/showdeps
blob: 56d355f371306f0906101f6c0b9e95b9c663894f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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";
}