Skip to content
Snippets Groups Projects
Commit 89f33a14 authored by Reid Spencer's avatar Reid Spencer
Browse files

Add a -flat option for generating the library dependencies in a flat

format with one library per line, similar to a makefile dependency list.

llvm-svn: 26873
parent d783c76c
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,16 @@ ...@@ -9,6 +9,16 @@
# Syntax: GenLibDeps.pl <directory_with_libraries_in_it> # Syntax: GenLibDeps.pl <directory_with_libraries_in_it>
# #
# Parse arguments...
while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
shift;
last if /^--$/; # Stop processing arguments on --
# List command line options here...
if (/^-flat$/) { $FLAT = 1; next; }
print "Unknown option: $_ : ignoring!\n";
}
# Give first option a name. # Give first option a name.
my $Directory = $ARGV[0]; my $Directory = $ARGV[0];
...@@ -58,7 +68,11 @@ sub gen_one_entry { ...@@ -58,7 +68,11 @@ sub gen_one_entry {
my $lib = $_[0]; my $lib = $_[0];
my $lib_ns = $lib; my $lib_ns = $lib;
$lib_ns =~ s/(.*)\.[oa]/$1/; $lib_ns =~ s/(.*)\.[oa]/$1/;
print " <dt><b>$lib</b</dt><dd><ul>\n"; if ($FLAT) {
print "$lib:";
} else {
print " <dt><b>$lib</b</dt><dd><ul>\n";
}
open UNDEFS, open UNDEFS,
"nm -u $Directory/$lib | grep ' U ' | sed -e 's/ U //' | sort | uniq |"; "nm -u $Directory/$lib | grep ' U ' | sed -e 's/ U //' | sort | uniq |";
open DEPENDS, open DEPENDS,
...@@ -80,7 +94,11 @@ sub gen_one_entry { ...@@ -80,7 +94,11 @@ sub gen_one_entry {
open DF, "<GenLibDeps.out"; open DF, "<GenLibDeps.out";
while (<DF>) { while (<DF>) {
chomp; chomp;
print " <li>$_</li>\n"; if ($FLAT) {
print " $_";
} else {
print " <li>$_</li>\n";
}
$suffix = substr($_,length($_)-1,1); $suffix = substr($_,length($_)-1,1);
$_ =~ s/(.*)\.[oa]/$1/; $_ =~ s/(.*)\.[oa]/$1/;
if ($suffix eq "a") { if ($suffix eq "a") {
...@@ -90,7 +108,11 @@ sub gen_one_entry { ...@@ -90,7 +108,11 @@ sub gen_one_entry {
} }
} }
close DF; close DF;
print " </ul></dd>\n"; if ($FLAT) {
print "\n";
} else {
print " </ul></dd>\n";
}
} }
# Make sure we flush on write. This is slower but correct based on the way we # Make sure we flush on write. This is slower but correct based on the way we
...@@ -98,7 +120,9 @@ sub gen_one_entry { ...@@ -98,7 +120,9 @@ sub gen_one_entry {
$| = 1; $| = 1;
# Print the definition list tag # Print the definition list tag
print "<dl>\n"; if (!$FLAT) {
print "<dl>\n";
}
open DOT, "| $DotPath -Tgif > libdeps.gif"; open DOT, "| $DotPath -Tgif > libdeps.gif";
...@@ -125,4 +149,6 @@ print DOT "}\n"; ...@@ -125,4 +149,6 @@ print DOT "}\n";
close DOT; close DOT;
# Print end tag of definition list element # Print end tag of definition list element
print "</dl>\n"; if (!$FLAT) {
print "</dl>\n";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment