# New Ticket Created by Leopold Toetsch # Please include the string: [perl #24208] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24208 >
This is an updated version of #24155 and another one I can't find now. The patch enables the new PMC compiler per default, though NEW_PMC can be undefed to use the old one. The Makefile has for sure some gnuish syntax, but its simple enough, so that it could be adapted for other makes. Please give it a try. Thanks, leo -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/66041/49354/986662/pmc2c-make-2.patch
--- parrot/config/gen/makefiles/classes.in Sat Sep 13 13:40:18 2003 +++ parrot-leo/config/gen/makefiles/classes.in Fri Oct 10 12:12:49 2003 @@ -7,6 +7,7 @@ O_FILES = ${pmc_o} +DUMP_FILES = ${pmc_dumps} #DO NOT ADD C COMPILER FLAGS HERE #Add them in Configure.pl--look for the @@ -18,17 +19,58 @@ CC = ${cc} PERL = ${perl} MAKE_F=${make} + +NEW_PMC = 1 + +ifdef NEW_PMC + +all : dumps $(O_FILES) fin + +VERB = --verb +PMC2CD=$(PERL) pmc2c2.pl --dump +PMC2CC=$(PERL) pmc2c2.pl --c $(VERB) + +dumps: ../vtable.dump $(DUMP_FILES) + +../vtable.dump: ../vtable.tbl + $(PERL) pmc2c2.pl --vt $(VERB) + +%.c pmc_%.h : %.pmc $(NONGEN_HEADERS) + $(PMC2CC) $< + +%.dump : %.pmc + $(PMC2CD) *.pmc + +else + +all : $(O_FILES) fin + PMC2C=$(PERL) pmc2c.pl -.c$(O): - $(CC) $(CFLAGS) ${cc_o_out}$@ -c $< +pmc_%.h %.c : %.pmc $(NONGEN_HEADERS) + $(PMC2C) $< + +.PRECIOUS: %.c %.dump + +endif + +.PRECIOUS: %.c + +# main depends on $(O_FILES) +# when 1 is recompiled each other is out of data, but not +# to the rules inside here, so we touch all O_FILES at the +# end and avoid getting called ever and ever +fin: + touch $(O_FILES) + +%.o : %.c + $(CC) $(CFLAGS) -o $@ -c $< -all : $(O_FILES) ${pmc_build} clean: progclean - $(RM_F) *.c *.h + $(RM_F) *.c *.h *.dump progclean: $(RM_F) *$(O) --- parrot/config/inter/pmc.pl Thu Oct 2 14:06:03 2003 +++ parrot-leo/config/inter/pmc.pl Fri Oct 10 11:55:20 2003 @@ -35,7 +35,7 @@ my @parents = ($pmc); push @parents, pmc_parent($parents[-1]) until $parents[-1] eq 'default'; shift(@parents); - push (@parents, 'perlhash') if ($pmc eq 'OrderedHash'); + push (@parents, 'perlhash') if ($pmc =~ m'OrderedHash'i); return @parents; } @@ -66,11 +66,18 @@ # names of class files for classes/Makefile (my $pmc_o = $pmc_list) =~ s/\.pmc/\$(O)/g; + (my $pmc_dumps = $pmc_list) =~ s/\.pmc/.dump/g; # calls to pmc2c.pl for classes/Makefile my $pmc_build = <<"E_NOTE"; # the following part of the Makefile was built by 'config/inter/pmc.pl' +# please note that dependencies are still static: +# if e.g. a PMC gets another parent (extends some) or if you +# add a new PMC - you have to run Configure.pl to update this list +# +# it would be better to create this list on the fly and include +# it in the Makefile (if include is generally supported at least) E_NOTE @@ -80,13 +87,14 @@ # make each pmc depend upon its parent. my $parent = pmc_parent($pmc).".pmc"; $parent = "perlhash.pmc $parent" if ($pmc eq 'orderedhash'); - 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"; + my $parent_dumps = join " ", map {"$_.dump" } pmc_parents($pmc); + my $parent_hs = join " ", map {"pmc_$_.h" } pmc_parents($pmc); + my $parent_pmcs = join " ", map {"$_.pmc" } pmc_parents($pmc); + $pmc_build .= <<"EOT"; +$pmc.c pmc_$pmc.h: $pmc.pmc $parent_pmcs $parent_hs + +EOT + } # build list of libraries for link line in Makefile @@ -125,6 +133,7 @@ pmc => $pmc_list, pmc_names => join(" ", @names), pmc_o => $pmc_o, + pmc_dumps => $pmc_dumps, pmc_build => $pmc_build, pmc_classes_o => $pmc_classes_o, pmc_classes_pmc => $pmc_classes_pmc,