Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[C99] add a Configure.pl

  • Loading branch information...
commit 86d2d483747e94419039bb1c2500ef6492bf5351 1 parent 58b341d
@fperrad fperrad authored
Showing with 68 additions and 106 deletions.
  1. +67 −0 Configure.pl
  2. +1 −0  MANIFEST
  3. +0 −106 src/cpp/Makefile
View
67 Configure.pl
@@ -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:
+
View
1  MANIFEST
@@ -1,3 +1,4 @@
+Configure.pl [c99]
MAINTAINER [c99]
c99.pir [c99]
config/makefiles/cpp.in [c99]
View
106 src/cpp/Makefile
@@ -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:
Please sign in to comment.
Something went wrong with that request. Please try again.