aboutsummaryrefslogtreecommitdiff
path: root/src/tools/msvc/Project.pm
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/msvc/Project.pm')
-rw-r--r--src/tools/msvc/Project.pm37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm
index f1c93a3fa32..aec922279df 100644
--- a/src/tools/msvc/Project.pm
+++ b/src/tools/msvc/Project.pm
@@ -47,10 +47,19 @@ sub AddFile
{
my ($self, $filename) = @_;
+ $self->FindAndAddAdditionalFiles($filename);
$self->{files}->{$filename} = 1;
return;
}
+sub AddDependantFiles
+{
+ my ($self, $filename) = @_;
+
+ $self->FindAndAddAdditionalFiles($filename);
+ return;
+}
+
sub AddFiles
{
my $self = shift;
@@ -63,6 +72,34 @@ sub AddFiles
return;
}
+# Handle Makefile rules by searching for other files which exist with the same
+# name but a different file extension and add those files too.
+sub FindAndAddAdditionalFiles
+{
+ my $self = shift;
+ my $fname = shift;
+ $fname =~ /(.*)(\.[^.]+)$/;
+ my $filenoext = $1;
+ my $fileext = $2;
+
+ # For .c files, check if either a .l or .y file of the same name
+ # exists and add that too.
+ if ($fileext eq ".c")
+ {
+ my $file = $filenoext . ".l";
+ if (-e $file)
+ {
+ $self->AddFile($file);
+ }
+
+ $file = $filenoext . ".y";
+ if (-e $file)
+ {
+ $self->AddFile($file);
+ }
+ }
+}
+
sub ReplaceFile
{
my ($self, $filename, $newname) = @_;