trick/bin/mis_dep

58 lines
1.4 KiB
Plaintext
Raw Normal View History

2015-02-26 15:02:31 +00:00
#! /usr/bin/perl
#
# Usage: mis_dep <src file>
#
# Description: Given a source file, this program will find all library
# dependencies that this source file's object will depend on.
# The dependency tree is built using the library dependencies
# from the TRICK HEADERs in the source files. TRICK_CFLAGS
# are used to actually find all files in the dependency tree.
use lib $ENV{"TRICK_HOME"} . "/bin/pm" ;
use Cwd ;
use File::Basename ;
use strict ;
use mis_dep ;
my ($all_mis_depends, %rcs_tags) ;
my ($k , $a) ;
my @all_depends ;
my %temp_hash ;
my $wd ;
# prepend current dir name if none given
$wd = cwd() ;
foreach (@ARGV) {
$_ = $wd . "/" . $_ if ( !/^\// ) ;
}
$all_mis_depends = mis_dep(\%rcs_tags , @ARGV) ;
print "\n" ;
foreach $a ( sort keys %$all_mis_depends ) {
traverse_tree($a, 0, %{$$all_mis_depends{$a}} );
print "\n" ;
}
foreach $a ( sort keys %$all_mis_depends ) {
print "$a\n";
@all_depends = () ;
# push all depends for all files onto one array
foreach $k ( sort keys %{$$all_mis_depends{$a}} ) {
if ( $k ne "last_look" ) {
push @all_depends , @{$$all_mis_depends{$a}{$k}} ;
}
}
# remove duplicate elements
%temp_hash = {};
@all_depends = grep ++$temp_hash{$_} < 2, @all_depends ;
foreach $k ( sort @all_depends ) {
print " $k\n";
}
}