tools/static_dependencies.pl
changeset 22 76c5e260003e
parent 16 58fdbe891c31
child 25 f213623e3c86
equal deleted inserted replaced
21:4a02a61ca23a 22:76c5e260003e
    12 #
    12 #
    13 # Description: 
    13 # Description: 
    14 # This script generates a list of static dependencies for files in a ROM
    14 # This script generates a list of static dependencies for files in a ROM
    15 
    15 
    16 use strict;
    16 use strict;
       
    17 use Getopt::Long;
       
    18 
       
    19 my $inverted_table = 0;
       
    20 GetOptions(
       
    21   "i|invert" => \$inverted_table,   # add the inverted table
       
    22   );
    17 
    23 
    18 my %romfiles;
    24 my %romfiles;
    19 my @contents;
    25 my @contents;
    20 
    26 
    21 my $line;
    27 my $line;
    33 
    39 
    34 sub print_dependency($$@)
    40 sub print_dependency($$@)
    35 	{
    41 	{
    36 	my ($romfile,$hostfile,@dependencies) = @_;
    42 	my ($romfile,$hostfile,@dependencies) = @_;
    37 	print "$romfile\t$hostfile\t", join(":",@dependencies), "\n";
    43 	print "$romfile\t$hostfile\t", join(":",@dependencies), "\n";
       
    44 	
       
    45 	next unless $inverted_table;
    38 	
    46 	
    39 	# Create inverted table 
    47 	# Create inverted table 
    40 	foreach my $dependent (@dependencies)
    48 	foreach my $dependent (@dependencies)
    41 		{
    49 		{
    42 		next if ($dependent =~ /^sid=/);
    50 		next if ($dependent =~ /^sid=/);
   131 		}
   139 		}
   132 
   140 
   133 	# Assume that the rest don't depend on anything, and leave them out.
   141 	# Assume that the rest don't depend on anything, and leave them out.
   134 	}
   142 	}
   135 
   143 
   136 print "\n";
   144 if ($inverted_table)
   137 foreach my $inverted (sort keys %dependents)
       
   138 	{
   145 	{
   139 	print "x\t$inverted\t$dependents{$inverted}\n";
   146 	print "\n";
       
   147 	foreach my $inverted (sort keys %dependents)
       
   148 		{
       
   149 		print "x\t$inverted\t$dependents{$inverted}\n";
       
   150 		}
   140 	}
   151 	}