diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2004-11-07 20:33:32 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2004-11-07 20:33:32 +0000 |
commit | b95733310900e86679fce5cbc37e2e18d299f9ca (patch) | |
tree | 182883e16c6d905e4132dbe6dce2f112281766ae /scandeps | |
parent | 5e41fb8a121c441a8765a1962a892e93906cde83 (diff) | |
download | nstheme-b95733310900e86679fce5cbc37e2e18d299f9ca.tar.gz nstheme-b95733310900e86679fce5cbc37e2e18d299f9ca.tar.bz2 |
[project @ 2004-11-07 20:33:32 by jmb]
Use scandeps for dependency checking
Fixup include path in riscos/options.h
Lose commented out include in riscos/gui.c (It broke scandeps <- we may wish to fix this too ;)
svn path=/import/nstheme/; revision=2437
Diffstat (limited to 'scandeps')
-rw-r--r-- | scandeps | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/scandeps b/scandeps new file mode 100644 index 0000000..e60c5b8 --- /dev/null +++ b/scandeps @@ -0,0 +1,48 @@ +#!/usr/bin/perl -W
+
+%include = ();
+
+die "Usage: scandeps prefix object_dirs -- sources" if (@ARGV < 4);
+
+$prefix = shift @ARGV;
+$prefix = $prefix; # silence warning
+
+@objdirs = ();
+while (($z = shift @ARGV) ne "--") {
+ push @objdirs, $z;
+}
+
+# scan all files for relevant #include lines
+foreach my $file (@ARGV) {
+ open FILE, "<$file" or die "Failed to open $file: $!";
+ while (my $line = <FILE>) {
+ if ($line =~ m|#include "$prefix/?([^"]+)"|) {
+ $include{$file}{$1} = 1;
+ }
+ }
+ close FILE;
+}
+
+# output dependencies
+foreach my $file (@ARGV) {
+ next unless $file =~ m|([^/]+)[.]c$|;
+ %deps = ();
+ search_deps($file);
+ foreach my $z (@objdirs) {
+ print "$z/$1.o ";
+ }
+ print ": $file ";
+ foreach my $z (sort keys %deps) { print "$z " }
+ print "\n";
+}
+
+
+sub search_deps {
+ my $file = shift;
+ return unless exists $include{$file};
+ foreach my $z (keys %{$include{$file}}) {
+ next if exists $deps{$z};
+ $deps{$z} = 1;
+ search_deps($z);
+ }
+}
|