cvs commit: ponie write_makefile.pl
[email protected] (Nicholas Clark) 3 May 2005 10:55:34 -0000
| Newsgroups | perl.ponie.changes |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 05/05/03 03:55:34
Modified: . write_makefile.pl
Log:
Waah. We really need to build the full dependency tree to avoid build failures
due to prerequisite headers being missing.
Revision Changes Path
1.13 +50 -11 ponie/write_makefile.pl
Index: write_makefile.pl
===================================================================
RCS file: /cvs/public/ponie/write_makefile.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- write_makefile.pl 2 May 2005 22:12:06 -0000 1.12
+++ write_makefile.pl 3 May 2005 10:55:34 -0000 1.13
@@ -9,15 +9,15 @@
my $top = $FindBin::Bin;
-my @allPMCs
- = qw(cargo_cult base null pining pvmg_mess
- iv nv rv pv pviv pvnv pvmg pvbm pvgv pvlv pvav pvhv pvcv pvfm pvio);
+my @allPMCs = map {"Perl5$_"}
+ qw(cargo_cult base NULL Pining PVMG_mess
+ IV NV RV PV PVIV PVNV PVMG PVBM PVGV PVLV PVAV PVHV PVCV PVFM PVIO);
my $parrotdir = "$top/parrot";
sub all {
my $ext = shift;
- join ' ', map "perl5$_$ext", @_;
+ lc join ' ', map "$_$ext", @_;
}
my $allobjs = join ' ', all ($Config{_o}, @allPMCs), "perl5pmcs$Config{_o}";
my $alldumps = all (".dump", @allPMCs);
@@ -35,22 +35,61 @@
ar -r \$\@ \$\?
$Config{ranlib} \$\@
-perl5pmcs.c: $alldumps;
+perl5pmcs.c: $alldumps
\$(PERL) $parrotdir/build_tools/pmc2c.pl --library perl5pmcs --c $allpmcs
perl5pmcs$Config{_o}: perl5pmcs.c
perl5pmcs.h: perl5pmcs.c
+
EOM
foreach (@allPMCs) {
+ my $pmc = lc "$_.pmc";
+ my $dump = lc "$_.dump";
+ my $c = lc "$_.c";
+ my $h = lc "pmc_$_.h";
+ my $o = lc($_) . $Config{_o};
print <<"EOSNIP";
+$dump: $pmc
+ \$(PERL) $parrotdir/build_tools/pmc2c.pl --include=../src/pmc --dump $pmc
-perl5$_.dump: perl5$_.pmc
- \$(PERL) $parrotdir/build_tools/pmc2c.pl --include=../src/pmc --dump perl5$_.pmc
+$c $h: $dump
+ \$(PERL) $parrotdir/build_tools/pmc2c.pl --c $pmc
-perl5$_.c: $alldumps
- \$(PERL) $parrotdir/build_tools/pmc2c.pl --c perl5$_.pmc
+$o: $c
-perl5$_$Config{_o}: perl5$_.c
EOSNIP
}
+
+# Wah. We need to build the dump files in the correct order.
+
+my %deps;
+foreach my $type (@allPMCs) {
+ my $file = lc "src/pmc/$type.pmc";
+ local (*FH, $/);
+ open FH, $file or die "Can't open $file: $!";
+
+ my $data = <FH>;
+
+ if ($data =~
+ /pmclass $type((?: extends Perl5\S+)*) dynpmc group Perl5_group/i) {
+ my @extends = ($1 =~ /(Perl5\S+)/g);
+ if (@extends) {
+ $deps{$type} = \@extends;
+ print "\L$type\E.dump: ", join (" ", map {"\L$_\E.dump"} @extends), "\n";
+ }
+ }
+}
+
+sub get_all_deps {
+ my $type = shift;
+ my @deps = @{$deps{$type} || []};
+ @deps, map {get_all_deps($_)} @deps;
+}
+
+print "\n";
+
+foreach my $type (sort keys %deps) {
+ print "\L$type\E.c: ",
+ join (" ", map {"pmc_\L$_\E.h"} get_all_deps($type)), "\n";
+}