[svn:languages] r52 - in c99/trunk: . src/cpp

fperrad at svn.parrot.org fperrad at svn.parrot.org
Wed Mar 11 16:28:48 UTC 2009


Author: fperrad
Date: Wed Mar 11 16:28:47 2009
New Revision: 52
URL: https://trac.parrot.org/languages/changeset/52

Log:
[C99] add a Configure.pl

Added:
   c99/trunk/Configure.pl   (contents, props changed)
Deleted:
   c99/trunk/src/cpp/Makefile
Modified:
   c99/trunk/MANIFEST

Added: c99/trunk/Configure.pl
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ c99/trunk/Configure.pl	Wed Mar 11 16:28:47 2009	(r52)
@@ -0,0 +1,67 @@
+# 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/cpp.in' => 'src/cpp/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:
+

Modified: c99/trunk/MANIFEST
==============================================================================
--- c99/trunk/MANIFEST	Wed Mar 11 16:20:37 2009	(r51)
+++ c99/trunk/MANIFEST	Wed Mar 11 16:28:47 2009	(r52)
@@ -1,3 +1,4 @@
+Configure.pl                                  [c99]
 MAINTAINER                                    [c99]
 c99.pir                                       [c99]
 config/makefiles/cpp.in                       [c99]

Deleted: c99/trunk/src/cpp/Makefile
==============================================================================
--- c99/trunk/src/cpp/Makefile	Wed Mar 11 16:28:47 2009	(r51)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,106 +0,0 @@
-# ex: set ro:
-# DO NOT EDIT THIS FILE
-# Generated by Parrot::Configure::Compiler from languages/c99/config/makefiles/cpp.in
-
-# Copyright (C) 2008-2009, Parrot Foundation.
-## $Id$
-
-## arguments we want to run parrot with
-PARROT_ARGS   =
-
-## configuration settings
-BUILD_DIR     = /home/allison/projects/svn/parrot
-LOAD_EXT      = .so
-O             = .o
-
-## Setup some commands
-PERL          = /usr/bin/perl
-RM_F          = $(PERL) -MExtUtils::Command -e rm_f
-CP            = $(PERL) -MExtUtils::Command -e cp
-CAT           = $(PERL) -MExtUtils::Command -e cat
-PARROT        = ../../../../parrot
-BUILD_DYNPMC  = $(PERL) $(BUILD_DIR)/tools/build/dynpmc.pl
-RECONFIGURE   = $(PERL) $(BUILD_DIR)/tools/dev/reconfigure.pl
-
-## places to look for things
-PARROT_DYNEXT = $(BUILD_DIR)/runtime/parrot/dynext
-PGE_LIBRARY   = $(BUILD_DIR)/runtime/parrot/library/PGE
-PERL6GRAMMAR  = $(PGE_LIBRARY)/Perl6Grammar.pbc
-NQP           = $(BUILD_DIR)/compilers/nqp/nqp.pbc
-PCT           = $(BUILD_DIR)/runtime/parrot/library/PCT.pbc
-
-PMC_DIR       = src/pmc
-
-all: cpp.pbc
-
-SOURCES = cpp.pir \
-  src/gen_grammar.pir \
-  src/gen_actions.pir \
-  src/gen_builtins.pir
-
-BUILTINS_PIR = \
-  src/builtins/say.pir
-
-# the default target
-cpp.pbc: $(PARROT) $(SOURCES)
-	$(PARROT) $(PARROT_ARGS) -o cpp.pbc cpp.pir
-	$(CP) cpp.pbc ../../cpp.pbc
-
-src/gen_grammar.pir: $(PERL6GRAMMAR) src/parser/grammar.pg
-	$(PARROT) $(PARROT_ARGS) $(PERL6GRAMMAR) \
-	    --output=src/gen_grammar.pir \
-	    src/parser/grammar.pg
-
-src/gen_actions.pir: $(NQP) $(PCT) src/parser/actions.pm
-	$(PARROT) $(PARROT_ARGS) $(NQP) --output=src/gen_actions.pir \
-	    --target=pir src/parser/actions.pm
-
-src/gen_builtins.pir: $(BUILTINS_PIR)
-	$(CAT) $(BUILTINS_PIR) >src/gen_builtins.pir
-
-# regenerate the Makefile
-Makefile: ../../config/makefiles/cpp.in
-	cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=c99
-
-# 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:               c.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) t/harness
-
-# this target has nothing to do
-testclean:
-
-CLEANUPS = \
-  cpp.pbc \
-  "src/gen_*.pir"
-
-clean:
-	$(RM_F) $(CLEANUPS)
-
-realclean: clean
-	$(RM_F) Makefile
-
-distclean: realclean
-
-# Local variables:
-#   mode: makefile
-# End:
-# vim: ft=make:


More information about the parrot-commits mailing list