# New Ticket Created by Leopold Toetsch
# Please include the string: [perl #24155]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24155 >
Attached is a patch for easier testing of the new pmc compiler.
It probably requires gnu make, because it currently uses
ifdef/else/endif to allow switching the old and new pmc compilers.
For now it should be rather simple to adjust these few lines. And
finally they can go away.
Further changes:
- see the comment in Makefile.in WRT the fin: target
- removed some dependencies on generated pmc_*.h files
Comments welcome
leo
-- attachment 1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/65800/49132/410abe/pmc2c-make.patch
--- parrot/classes/pmc2c2.pl Tue Oct 7 17:40:32 2003
+++ parrot-leo/classes/pmc2c2.pl Tue Oct 7 18:04:33 2003
@@ -268,6 +268,7 @@
gen_super_meths($class, $vt);
my $Dumper = Data::Dumper->new([$class], [qw(class)]);
$Dumper->Indent(1);
+ print "Writing $dump\n" if $opt{verbose};
open PMD, ">$dump" or die "Can't write '$dump";
print PMD $Dumper->Dump;
close PMD;
--- parrot/config/gen/makefiles/classes.in Sat Sep 13 13:40:18 2003
+++ parrot-leo/config/gen/makefiles/classes.in Tue Oct 7 21:48:36 2003
@@ -18,7 +18,46 @@
CC = ${cc}
PERL = ${perl}
MAKE_F=${make}
+
+NEW_PMC = 1
+
+all : $(O_FILES) fin
+
+# main depends on $(O_FILES)
+# when 1 is recompiled each other is out of data, but not
+# to the rules insided here, so we touch al O_FILES at the
+# end and avoid getting called ever and ever
+fin:
+ touch $(O_FILES)
+
+ifdef NEW_PMC
+
+PMC2CD=$(PERL) pmc2c2.pl --dump --verb
+PMC2CC=$(PERL) pmc2c2.pl --c --verb
+
+pmc_%.h %.c : %.dump
+ $(PMC2CC) $<
+
+../vtable.dump: ../vtable.tbl
+ cd .. ; perl classes/pmc2c2.pl --vt
+
+%.dump : %.pmc ../vtable.dump
+ $(PMC2CD) $<
+
+else
+
PMC2C=$(PERL) pmc2c.pl
+
+pmc_%.h %.c : %.pmc
+ $(PMC2C) $<
+
+endif
+
+.PRECIOUS: %.c %.dump
+
+
+%.o : %.c
+ $(CC) $(CFLAGS) -o $@ -c $<
.c$(O):
$(CC) $(CFLAGS) ${cc_o_out}$@ -c $<
--- parrot/config/inter/pmc.pl Thu Oct 2 14:06:03 2003
+++ parrot-leo/config/inter/pmc.pl Tue Oct 7 21:39:22 2003
@@ -83,10 +83,7 @@
my $parent_headers = '';
$parent_headers .= "pmc_$_.h " foreach (pmc_parents($pmc));
$pmc_build .= "$pmc.c pmc_$pmc.h: $parent $pmc.pmc\n";
- $pmc_build .= "\t\$(PMC2C) perlhash.pmc\n" if ($pmc eq 'orderedhash');
- $pmc_build .= "\t\$(PMC2C) $pmc.pmc\n";
$pmc_build .= "\n";
- $pmc_build .= "$pmc\$(O): \$(NONGEN_HEADERS) $parent_headers pmc_$pmc.h\n";
}
# build list of libraries for link line in Makefile