[llvm-commits] [RFC] Extend GenLibDeps.pl for other library sets.

Óscar Fuentes ofv at wanadoo.es
Wed Mar 30 20:13:54 PDT 2011


Currently GenLibDeps.pl is hard-coded for working on the set of
libraries generated by LLVM. The patch below extends it for dumping
other groups of libraries (i.e. clang). It's quite simple and it works
for me but, as my Perl knowledge is nonexistent, I'll like to get it
reviewed & approved first.

It adds a new command-line option `-libset NAME', which indicates that
the operation must be performed on libraries named libNAME* (instead of
libLLVM*)

--- a/utils/GenLibDeps.pl
+++ b/utils/GenLibDeps.pl
@@ -15,12 +15,14 @@ my $FLAT = 0;
 my $WHY = 0;
 my $PEROBJ = 0;
 my $PEROBJINCL = 0;
+my $LIBSET = "LLVM";
 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
   shift;
   last if /^--$/;  # Stop processing arguments on --
 
   # List command line options here...
   if (/^-flat$/)     { $FLAT = 1; next; }
+  if (/^-libset$/)   { $LIBSET = $ARGV[0]; shift; next }
   if (/^-why/)       { $WHY = 1; $FLAT = 1; next; }
   if (/^-perobj$/)    { $PEROBJ = 1; next; }
   if (/^-perobjincl/) { $PEROBJINCL = 1; next;}
@@ -69,10 +71,10 @@ if ($PEROBJ) {
 opendir DIR,$Directory;
 my @files = readdir DIR;
 closedir DIR;
-my @libs = grep(/libLLVM.*\.(dylib|so|a)$/,sort(@files));
+my @libs = grep(/lib$LIBSET.*\.(dylib|so|a)$/,sort(@files));
 # Omit the all-of-llvm shared library.
- at libs = grep(!/libLLVM-\d\.\d(svn)?\.(dylib|so)/, @libs);
-my @objs = grep(/LLVM.*\.o$/,sort(@files));
+ at libs = grep(!/lib$LIBSET(-\d\.\d)?(svn)?\.(dylib|so)/, @libs);
+my @objs = grep(/$LIBSET.*\.o$/,sort(@files));
 
 # Declare the hashes we will use to keep track of the library and object file
 # symbol definitions.
@@ -86,7 +88,7 @@ if ($PEROBJ) {
   foreach my $lib (@libs ) {
     `$ranlibPath $Directory/$lib`;
     my $libpath = $lib;
-    $libpath =~ s/^libLLVM(.*)\.a/$1/;
+    $libpath =~ s/^lib$LIBSET(.*)\.a/$1/;
     $libpath =~ s/(.+)CodeGen$/Target\/$1/;
     $libpath =~ s/(.+)AsmPrinter$/Target\/$1\/AsmPrinter/;
     $libpath =~ s/(.+)AsmParser$/Target\/$1\/AsmParser/;
@@ -128,7 +130,7 @@ if ($PEROBJ) {
   }
   foreach my $lib (@libs ) {
     my $libpath = $lib;
-    $libpath =~ s/^libLLVM(.*)\.a/$1/;
+    $libpath =~ s/^lib$LIBSET(.*)\.a/$1/;
     $libpath =~ s/(.+)CodeGen$/Target\/$1/;
     $libpath =~ s/(.+)AsmPrinter$/Target\/$1\/AsmPrinter/;
     $libpath =~ s/(.+)AsmParser$/Target\/$1\/AsmParser/;




More information about the llvm-commits mailing list