Author: coke
Date: Mon Mar 31 18:00:42 2008
New Revision: 26679

Modified:
   trunk/config/auto/pmc.pm

Log:
[build]

Resolve #52316 ([BUG] undeclared dependency between role and namespace PMCs).

cotto++ for diagnosis.



Modified: trunk/config/auto/pmc.pm
==============================================================================
--- trunk/config/auto/pmc.pm    (original)
+++ trunk/config/auto/pmc.pm    Mon Mar 31 18:00:42 2008
@@ -113,6 +113,28 @@
     return;
 }
 
+# Given a PMC file name, get a list of all the includes it specifies
+sub get_includes {
+    my $file = shift;
+    open( my $fh, '<', $file ) or die "Can't read '$file': $!\n";
+
+    my @retval;
+    local $_;
+    while (<$fh>) {
+        next unless /^\s*#include\s+["<](.*)[">]\s+$/;
+        my $include = $1;
+        if ($include =~ m{^(\.|parrot/)}) { # main parrot include dir
+          $include = "include/" . $include;
+        } elsif ($include =~ m/^pmc_|\.str$/) { # local pmc header
+          $include = "src/pmc/" . $include;
+        } # else it's probably a system header, don't depend on it.
+        push @retval, $include;  
+    }
+
+    return join(' ', @retval);
+}
+
+
 sub runstep {
     my ( $self, $conf ) = @_;
 
@@ -170,6 +192,7 @@
         my $pmc_fname = catfile('src', 'pmc', "$pmc.pmc");
         my $pccmethod_depend =
             contains_pccmethod($pmc_fname) ? 'lib/Parrot/Pmc2c/PCCMETHOD.pm' : 
'';
+        my $include_headers = get_includes($pmc_fname);
 
         $TEMP_pmc_build .= <<END
 src/pmc/$pmc.c : src/pmc/$pmc.dump
@@ -181,7 +204,7 @@
 src/pmc/pmc_$pmc.h: src/pmc/$pmc.c
 
 src/pmc/$pmc\$(O): src/pmc/$pmc.str \$(NONGEN_HEADERS) \\
-    $parent_headers
+    $parent_headers $include_headers
 
 END
     }

Reply via email to