summaryrefslogtreecommitdiff
path: root/bin/DependencyGenerator
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2004-02-12 15:38:50 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2004-02-12 15:38:50 +0000
commitb1aaa17d3d425940278eccf814fbed9b253eb1cb (patch)
treeaf45c4f0ed1a6e9de9e070dd44ad9f4157bd7cbe /bin/DependencyGenerator
parent283573166ad100f7c341d9e13f701504296b2196 (diff)
downloadATCD-b1aaa17d3d425940278eccf814fbed9b253eb1cb.tar.gz
ChangeLogTag: Thu Feb 12 09:34:37 2004 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'bin/DependencyGenerator')
-rw-r--r--bin/DependencyGenerator/DependencyEditor.pm3
-rw-r--r--bin/DependencyGenerator/DependencyGenerator.pm30
-rw-r--r--bin/DependencyGenerator/GNUDependencyWriter.pm8
-rw-r--r--bin/DependencyGenerator/GNUObjectGenerator.pm6
-rw-r--r--bin/DependencyGenerator/NMakeObjectGenerator.pm2
-rw-r--r--bin/DependencyGenerator/ObjectGenerator.pm2
-rw-r--r--bin/DependencyGenerator/Preprocessor.pm55
7 files changed, 43 insertions, 63 deletions
diff --git a/bin/DependencyGenerator/DependencyEditor.pm b/bin/DependencyGenerator/DependencyEditor.pm
index df0ee99bc72..bbdcd92f043 100644
--- a/bin/DependencyGenerator/DependencyEditor.pm
+++ b/bin/DependencyGenerator/DependencyEditor.pm
@@ -67,8 +67,7 @@ sub process {
my($objgen) = ObjectGeneratorFactory::create($type);
## Sort the files so the dependencies are reproducible
foreach my $file (sort @$files) {
- my(@objects) = $objgen->process($file);
- print $fh $dep->process($file, \@objects) . "\n";
+ print $fh $dep->process($file, $objgen->process($file)) . "\n";
}
print $fh "# IF YOU PUT ANYTHING HERE IT WILL GO AWAY\n";
diff --git a/bin/DependencyGenerator/DependencyGenerator.pm b/bin/DependencyGenerator/DependencyGenerator.pm
index 423d2c8b8da..7561a19c028 100644
--- a/bin/DependencyGenerator/DependencyGenerator.pm
+++ b/bin/DependencyGenerator/DependencyGenerator.pm
@@ -53,27 +53,19 @@ sub process {
my($objects) = shift;
my($replace) = $self->{'replace'};
my($cwd) = $self->{'cwd'};
- my($files) = $self->{'pre'}->process($file, $self->{'noinline'});
-
- ## Go through each file
- foreach my $finc (@$files) {
- ## If we can remove the current working directory fromm the file
- ## then we do not need to check the repkeys array and that cuts
- ## the processing time for the ace directory almost in half.
- if ($finc =~ s/^$cwd//o) {
- }
- else {
- ## Modify those that have elements for replacement
- foreach my $rep (@{$self->{'repkeys'}}) {
- if ($finc =~ s/^$rep/$$replace{$rep}/) {
- last;
- }
- }
- }
- }
## Generate the dependency string
- return $self->{'dwrite'}->process($objects, $files);
+ my($depstr) = $self->{'dwrite'}->process(
+ $objects,
+ $self->{'pre'}->process($file, $self->{'noinline'}));
+
+ ## Perform the replacements on the dependency string
+ $depstr =~ s/$cwd//go;
+ foreach my $rep (@{$self->{'repkeys'}}) {
+ $depstr =~ s/$rep/$$replace{$rep}/g;
+ }
+
+ return $depstr;
}
diff --git a/bin/DependencyGenerator/GNUDependencyWriter.pm b/bin/DependencyGenerator/GNUDependencyWriter.pm
index bf10ead7da4..3064e3581ce 100644
--- a/bin/DependencyGenerator/GNUDependencyWriter.pm
+++ b/bin/DependencyGenerator/GNUDependencyWriter.pm
@@ -23,15 +23,9 @@ use vars qw(@ISA);
sub process {
my($objects) = $_[1];
my($files) = $_[2];
- my($dep) = "@$objects: \\\n";
## Sort the dependencies to make them reproducible
- foreach my $file (sort @$files) {
- $dep .= " $file \\\n";
- }
- $dep =~ s/ \\$//;
-
- return $dep;
+ return "@$objects: \\\n " . join(" \\\n ", sort @$files) . "\n";
}
diff --git a/bin/DependencyGenerator/GNUObjectGenerator.pm b/bin/DependencyGenerator/GNUObjectGenerator.pm
index 3adc931425d..25e1b8c4336 100644
--- a/bin/DependencyGenerator/GNUObjectGenerator.pm
+++ b/bin/DependencyGenerator/GNUObjectGenerator.pm
@@ -23,7 +23,7 @@ use vars qw(@ISA);
sub process {
my($noext) = basename($_[1]);
- my(@objects) = ();
+ my($objects) = [];
my(@exts) = ('o');
my(@dirs) = (defined $ENV{VDIR} ? $ENV{VDIR} : '');
$noext =~ s/\.[^\.]+$//o;
@@ -37,11 +37,11 @@ sub process {
foreach my $dirs (@dirs) {
foreach my $ext (@exts) {
- push(@objects, "$dirs$noext.$ext");
+ push(@$objects, "$dirs$noext.$ext");
}
}
- return @objects;
+ return $objects;
}
diff --git a/bin/DependencyGenerator/NMakeObjectGenerator.pm b/bin/DependencyGenerator/NMakeObjectGenerator.pm
index 6d81f1447b0..ac4f11fa902 100644
--- a/bin/DependencyGenerator/NMakeObjectGenerator.pm
+++ b/bin/DependencyGenerator/NMakeObjectGenerator.pm
@@ -21,7 +21,7 @@ use vars qw(@ISA);
# ************************************************************
sub process {
- return $_[1];
+ return [ $_[1] ];
}
diff --git a/bin/DependencyGenerator/ObjectGenerator.pm b/bin/DependencyGenerator/ObjectGenerator.pm
index 64af1d5ffaf..d7e92070642 100644
--- a/bin/DependencyGenerator/ObjectGenerator.pm
+++ b/bin/DependencyGenerator/ObjectGenerator.pm
@@ -25,7 +25,7 @@ sub new {
sub process {
#my($self) = shift;
#my($file) = shift;
- return ();
+ return [];
}
diff --git a/bin/DependencyGenerator/Preprocessor.pm b/bin/DependencyGenerator/Preprocessor.pm
index 604727d10c5..add462539bb 100644
--- a/bin/DependencyGenerator/Preprocessor.pm
+++ b/bin/DependencyGenerator/Preprocessor.pm
@@ -31,35 +31,6 @@ sub new {
}
-sub locateFile {
- my($self) = shift;
- my($file) = shift;
- my($loc) = shift;
-
- if (exists $self->{'ifound'}->{$file}) {
- return $self->{'ifound'}->{$file};
- }
- else {
- foreach my $dir (@{$self->{'ipaths'}}) {
- if (-r "$dir/$file") {
- $self->{'ifound'}->{$file} = "$dir/$file";
- return $self->{'ifound'}->{$file};
- }
- }
-
- ## If the file we're currently looking at contains a directory name
- ## then, we need to look for include files in that directory.
- if (-r "$loc/$file") {
- $self->{'ifound'}->{$file} = "$loc/$file";
- return $self->{'ifound'}->{$file};
- }
- }
-
- $self->{'ifound'}->{$file} = undef;
- return undef;
-}
-
-
sub process {
my($self) = shift;
my($file) = shift;
@@ -103,7 +74,31 @@ sub process {
}
elsif (!defined $zero[0] &&
/#\s*include\s+[<"]([^">]+)[">]/o) {
- my($inc) = $self->locateFile($1, $dir);
+ ## Locate the include file
+ my($inc) = undef;
+ if (exists $self->{'ifound'}->{$1}) {
+ $inc = $self->{'ifound'}->{$1};
+ }
+ else {
+ foreach my $dirp (@{$self->{'ipaths'}}) {
+ if (-r "$dirp/$1") {
+ $inc = "$dirp/$1";
+ last;
+ }
+ }
+
+ if (!defined $inc) {
+ ## If the file we're currently looking at contains a
+ ## directory name then, we need to look for include
+ ## files in that directory.
+ if (-r "$dir/$1") {
+ $inc = "$dir/$1";
+ }
+ }
+ $self->{'ifound'}->{$1} = $inc;
+ }
+
+ ## If we've found the include file, then process it too.
if (defined $inc) {
$inc =~ s/\\/\//go;
if (!$noinline ||