Permalink
Browse files

[punie] re-run mk_language_shell.pl

work with an installed parrot
  • Loading branch information...
1 parent df9ba98 commit 637940d54624856580f7d269fe1d1d063fe0398c @fperrad fperrad committed Mar 9, 2009
Showing with 238 additions and 166 deletions.
  1. +65 −0 Configure.pl
  2. +0 −82 Makefile
  3. +170 −81 config/makefiles/root.in
  4. +3 −3 punie.pir
View
@@ -0,0 +1,65 @@
+# Copyright (C) 2009, Parrot Foundation.
+# $Id$
+
+use strict;
+use warnings;
+use 5.008;
+
+# Get a list of parrot-configs to invoke.
+my @parrot_config_exe = (
+ 'parrot/parrot_config',
+ '../../parrot_config',
+ 'parrot_config',
+);
+
+# Get configuration information from parrot_config
+my %config = read_parrot_config(@parrot_config_exe);
+unless (%config) {
+ die "Unable to locate parrot_config.";
+}
+
+# Create the Makefile using the information we just got
+create_makefiles(%config);
+
+sub read_parrot_config {
+ my @parrot_config_exe = @_;
+ my %config = ();
+ for my $exe (@parrot_config_exe) {
+ no warnings;
+ if (open my $PARROT_CONFIG, '-|', "$exe --dump") {
+ print "Reading configuration information from $exe\n";
+ while (<$PARROT_CONFIG>) {
+ $config{$1} = $2 if (/(\w+) => '(.*)'/);
+ }
+ close $PARROT_CONFIG;
+ last if %config;
+ }
+ }
+ %config;
+}
+
+
+# Generate Makefiles from a configuration
+sub create_makefiles {
+ my %config = @_;
+ my %makefiles = (
+ 'config/makefiles/root.in' => 'Makefile',
+# 'config/makefiles/pmc.in' => 'src/pmc/Makefile',
+# 'config/makefiles/ops.in' => 'src/ops/Makefile',
+ );
+ my $build_tool = $config{libdir} . $config{versiondir}
+ . '/tools/dev/gen_makefile.pl';
+
+ foreach my $template (keys %makefiles) {
+ my $makefile = $makefiles{$template};
+ print "Creating $makefile\n";
+ system($config{perl}, $build_tool, $template, $makefile);
+ }
+}
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
View
@@ -1,82 +0,0 @@
-# ex: set ro:
-# DO NOT EDIT THIS FILE
-# Generated by Parrot::Configure::Compiler from languages/punie/config/makefiles/root.in
-
-# Copyright (C) 2005-2009, Parrot Foundation.
-# $Id: root.in 36833 2009-02-17 20:09:26Z allison $
-
-# Setup some commands
-LN_S = /bin/ln -s
-PERL = /usr/bin/perl
-RM_F = $(PERL) -MExtUtils::Command -e rm_f
-PARROT = ../../parrot
-BUILD_DIR = /home/allison/projects/svn/parrot
-RECONFIGURE = $(PERL) /home/allison/projects/svn/parrot/tools/dev/reconfigure.pl
-PGE_DIR = ../../compilers/pge
-NQP_DIR = ../../compilers/nqp
-CP = $(PERL) -MExtUtils::Command -e cp
-
-PARROT_LIBRARY = ../../runtime/parrot/library
-PGE_LIBRARY = ../../runtime/parrot/library/PGE
-
-# the default target
-all: punie.pbc
-
-SOURCES = punie.pir \
- src/parser/grammar.pg \
- src/parser/actions.pm \
- src/builtins/builtins.pir \
-
-# the default target
-punie.pbc: $(PARROT) $(NQP_DIR)/nqp.pbc $(PGE_LIBRARY)/Perl6Grammar.pir $(SOURCES)
- $(PARROT) $(PGE_LIBRARY)/Perl6Grammar.pir --output=src/gen_punie.pir src/parser/grammar.pg
- $(PARROT) $(NQP_DIR)/nqp.pbc --target=pir --output=src/gen_punie-actions.pir src/parser/actions.pm
- $(PARROT) -o punie.pbc punie.pir
-
-# This is a listing of all targets, that are meant to be called by users
-help:
- @echo ""
- @echo "Following targets are available for the user:"
- @echo ""
- @echo " all: punie.pbc"
- @echo " This is the default."
- @echo "Testing:"
- @echo " test: Run the test suite."
- @echo " testclean: Clean up test results."
- @echo ""
- @echo "Cleaning:"
- @echo " clean: Basic cleaning up."
- @echo " realclean: Removes also files generated by 'Configure.pl'"
- @echo " distclean: Removes also anything built, in theory"
- @echo ""
- @echo "Misc:"
- @echo " help: Print this help message."
- @echo ""
-
-test: all
- $(PERL) -Ilib -I../../lib t/harness
-
-# regenerate the Makefile
-Makefile: config/makefiles/root.in
- cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=punie
-
-testclean:
- $(RM_F) "t/*.p1" "t/*.out" "t/*.pir"
-
-CLEANUPS = \
- punie.pbc \
- src/gen_punie.pir \
- src/gen_punie-actions.pir \
-
-clean: testclean
- $(RM_F) $(CLEANUPS)
-
-realclean: clean
- $(RM_F) Makefile
-
-distclean: realclean
-
-# Local variables:
-# mode: makefile
-# End:
-# vim: ft=make:
Oops, something went wrong.

0 comments on commit 637940d

Please sign in to comment.