# This file was written by Eric Kidd, and is placed into the public domain.
#
+use 5.006;
use strict;
use warnings;
# Read our dependency information.
while (<>) {
chomp;
- my ($module, $dependency_str) = /^([^:]*): ?(.*)$/;
+ my ($module, $dependency_str) = /^\s*([^:]+):\s*(.*)\s*$/;
die "Malformed data: $_" unless defined $dependency_str;
my @dependencies = split(/ /, $dependency_str);
$DEPS{$module} = \@dependencies;
# Print out the finished cycles, with their dependencies.
my @output;
+my $cycles_found = 0;
foreach my $cycle (@CYCLES) {
my @modules = sort keys %{$cycle};
# Warn about possible linker problems.
my @archives = grep(/\.a$/, @modules);
if (@archives > 1) {
+ $cycles_found = $cycles_found + 1;
print STDERR "find-cycles.pl: Circular dependency between *.a files:\n";
print STDERR "find-cycles.pl: ", join(' ', @archives), "\n";
- print STDERR "find-cycles.pl: Some linkers may have problems.\n";
push @modules, @archives; # WORKAROUND: Duplicate *.a files. Ick.
+ } elsif (@modules > 1) {
+ $cycles_found = $cycles_found + 1;
+ print STDERR "find-cycles.pl: Circular dependency between *.o files:\n";
+ print STDERR "find-cycles.pl: ", join(' ', @modules), "\n";
+ push @modules, @modules; # WORKAROUND: Duplicate *.o files. Ick.
}
# Add to our output. (@modules is already as sorted as we need it to be.)
}
print sort @output;
+exit $cycles_found;
#==========================================================================
# Depedency Cycle Support