|
|
|
@ -28,7 +28,8 @@ |
|
|
|
|
# |
|
|
|
|
# Usage: |
|
|
|
|
# javaDependencies.pl -classpath <cp> [-dependdir <depdir> [-subdir <subdir>]] |
|
|
|
|
# <classfile> |
|
|
|
|
# [-depfile <depfile>] |
|
|
|
|
# <classfiles> |
|
|
|
|
# |
|
|
|
|
# cp: colon separated paths to the java files we should depend on. |
|
|
|
|
# depdir: if set, use this path as path to the java files when printing |
|
|
|
@ -36,7 +37,8 @@ |
|
|
|
|
# useful, if you want to make use of VPATH settings in Makefile. |
|
|
|
|
# subdir: if set, this is the path from depdir to the current directory. |
|
|
|
|
# Use it to remove unneccessary ../../$subdir/ |
|
|
|
|
# class: The class file (not an inner class) for which the dependencies |
|
|
|
|
# depfile: the name of the dependency file, default is "Makefile.dep". |
|
|
|
|
# class: The class files (not inner classes) for which the dependencies |
|
|
|
|
# should be generated. We will also look for inner and anon |
|
|
|
|
# classes. |
|
|
|
|
|
|
|
|
@ -62,12 +64,20 @@ sub readUTF () { |
|
|
|
|
unpack("a$ulength", $buff); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$clazz = pop; |
|
|
|
|
$clazz =~ /(.*)\.class/ or die "not a class file"; |
|
|
|
|
$base = $1; |
|
|
|
|
my ($filename, %done); |
|
|
|
|
%done=(); |
|
|
|
|
for $filename ($clazz, glob("$base\\\$*.class")) { |
|
|
|
|
$depfile = "Makefile.dep" if (!defined($depfile)); |
|
|
|
|
open DEPFILE, ">$depfile"; |
|
|
|
|
print DEPFILE <<EOF; |
|
|
|
|
# This dependency file is automatically created by $0 from class files. |
|
|
|
|
# Do not edit. |
|
|
|
|
|
|
|
|
|
EOF |
|
|
|
|
foreach $clazz (@ARGV) { |
|
|
|
|
next if $clazz =~ (/^.*\$.*\.class/); |
|
|
|
|
$clazz =~ /([^\$]*)(\$.*)?\.class/ or die "not a class file"; |
|
|
|
|
$base = $1; |
|
|
|
|
my ($filename, %done); |
|
|
|
|
%done=(); |
|
|
|
|
for $filename ($clazz, glob("$base\\\$*.class")) { |
|
|
|
|
open FILE, $filename; |
|
|
|
|
binmode FILE; |
|
|
|
|
|
|
|
|
@ -167,7 +177,8 @@ for $filename ($clazz, glob("$base\\\$*.class")) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (@deplist) { |
|
|
|
|
print "# Dependencies of $filename\n"; |
|
|
|
|
print "$clazz: " . join (" ", @deplist) . "\n"; |
|
|
|
|
print DEPFILE "$clazz: " . join (" ", @deplist) . "\n"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
close DEPFILE; |
|
|
|
|