<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,13 +5,57 @@ use strict;
 use warnings;
 use 5.008;
 
-my $build_dir = '../..';
-my $hll       = 'gil';
-my $cmd       = qq{$^X -Ilib tools/dev/reconfigure.pl --step=gen::languages --languages=$hll};
+#  Get a list of parrot-configs to invoke.
+my @parrot_config_exe = (
+    'parrot/parrot_config',
+    '../../parrot_config',
+    'parrot_config',
+);
 
-print &quot;Running '$cmd' in $build_dir\n&quot;;
-chdir $build_dir;
-`$cmd`
+#  Get configuration information from parrot_config
+my %config = read_parrot_config(@parrot_config_exe);
+unless (%config) {
+    die &quot;Unable to locate parrot_config.&quot;;
+}
+
+#  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, '-|', &quot;$exe --dump&quot;) {
+            print &quot;Reading configuration information from $exe\n&quot;;
+            while (&lt;$PARROT_CONFIG&gt;) {
+                $config{$1} = $2 if (/(\w+) =&gt; '(.*)'/);
+            }
+            close $PARROT_CONFIG;
+            last if %config;
+        }
+    }
+    %config;
+}
+
+
+#  Generate Makefiles from a configuration
+sub create_makefiles {
+    my %config = @_;
+    my %makefiles = (
+        'config/makefiles/root.in' =&gt; 'Makefile',
+#        'config/makefiles/pmc.in'  =&gt; 'src/pmc/Makefile',
+#        'config/makefiles/ops.in'  =&gt; '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 &quot;Creating $makefile\n&quot;;
+        system($config{perl}, $build_tool, $template, $makefile);
+    }
+}
 
 # Local Variables:
 #   mode: cperl</diff>
      <filename>Configure.pl</filename>
    </modified>
    <modified>
      <diff>@@ -1,40 +1,66 @@
 ## $Id$
 
 ## arguments we want to run parrot with
-PARROT_ARGS   =
+PARROT_ARGS   :=
 
 ## configuration settings
-BUILD_DIR     = @build_dir@
+VERSION       := @versiondir@
+BIN_DIR       := @bin_dir@
+LIB_DIR       := @lib_dir@$(VERSION)
+DOC_DIR       := @doc_dir@$(VERSION)
+MANDIR        := @mandir@$(VERSION)
+
+# Set up extensions
+LOAD_EXT      := @load_ext@
+O             := @o@
+
+# Various paths
+PERL6GRAMMAR  := $(LIB_DIR)/library/PGE/Perl6Grammar.pbc
+NQP           := $(LIB_DIR)/languages/nqp/nqp.pbc
+PCT           := $(LIB_DIR)/library/PCT.pbc
+PMC_DIR       := src/pmc
+OPS_DIR       := src/ops
 
 ## Setup some commands
-PERL          = @perl@
-RM_F          = @rm_f@
-CP            = @cp@
-PARROT        = ../../parrot@exe@
-CAT           = $(PERL) -MExtUtils::Command -e cat
-
-## places to look for things
-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
-
-all: gil.pbc
-
-SOURCES = \
+MAKE          := @make_c@
+PERL          := @perl@
+CAT           := @cat@
+CHMOD         := @chmod@
+CP            := @cp@
+MKPATH        := @mkpath@
+RM_F          := @rm_f@
+RM_RF         := @rm_rf@
+POD2MAN       := pod2man
+#IF(parrot_is_shared and not(cygwin or win32)):export LD_RUN_PATH := @blib_dir@:$(LD_RUN_PATH)
+PARROT        := ../../parrot@exe@
+PBC_TO_EXE    := ../../pbc_to_exe@exe@
+#IF(darwin):
+#IF(darwin):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X compilation/linking
+#IF(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@
+
+SOURCES := \
   src/gen_grammar.pir \
   src/gen_actions.pir \
   src/gen_builtins.pir \
   gil.pir
 
-BUILTINS_PIR = \
+BUILTINS_PIR := \
   src/builtins/say.pir \
   src/builtins/math.pir
 
+DOCS := README
+
 # the default target
-gil.pbc: $(PARROT) $(SOURCES)
+build: gil.pbc
+
+all: build gil@exe@ installable
+
+gil.pbc: $(SOURCES)
 	$(PARROT) $(PARROT_ARGS) -o gil.pbc gil.pir
 
+gil@exe@: gil.pbc
+	$(PBC_TO_EXE) gil.pbc
+
 src/gen_grammar.pir: $(PERL6GRAMMAR) src/parser/grammar.pg
 	$(PARROT) $(PARROT_ARGS) $(PERL6GRAMMAR) \
 	    --output=src/gen_grammar.pir \
@@ -47,6 +73,11 @@ src/gen_actions.pir: $(NQP) $(PCT) src/parser/actions.pm
 src/gen_builtins.pir: $(BUILTINS_PIR)
 	$(CAT) $(BUILTINS_PIR) &gt; src/gen_builtins.pir
 
+installable: installable_gil@exe@
+
+installable_gil@exe@: gil.pbc
+	$(PBC_TO_EXE) gil.pbc --install
+
 # regenerate the Makefile
 Makefile: config/makefiles/root.in
 	$(PERL) Configure.pl
@@ -56,8 +87,12 @@ help:
 	@echo &quot;&quot;
 	@echo &quot;Following targets are available for the user:&quot;
 	@echo &quot;&quot;
-	@echo &quot;  all:               gil.pbc&quot;
+	@echo &quot;  build:             gil.pbc&quot;
 	@echo &quot;                     This is the default.&quot;
+	@echo &quot;  all:               gil.pbc gil@exe@ installable Makefile&quot;
+	@echo &quot;  installable:       Create libs and self-hosting binaries to be installed.&quot;
+	@echo &quot;  install:           Install the installable targets and docs.&quot;
+	@echo &quot;&quot;
 	@echo &quot;Testing:&quot;
 	@echo &quot;  test:              Run the test suite.&quot;
 	@echo &quot;  testclean:         Clean up test results.&quot;
@@ -71,22 +106,55 @@ help:
 	@echo &quot;  help:              Print this help message.&quot;
 	@echo &quot;&quot;
 
-test: all
+test: build
 	$(PERL) t/harness
 
-# this target has nothing to do
+install: installable
+	$(CP) installable_gil@exe@ $(BIN_DIR)/parrot-gil@exe@
+	$(CHMOD) 0755 $(BIN_DIR)/parrot-gil@exe@
+	-$(MKPATH) $(LIB_DIR)/languages/gil
+	$(CP) gil.pbc $(LIB_DIR)/languages/gil/gil.pbc
+#	-$(MKPATH) $(MANDIR)/man1
+#	$(POD2MAN) doc/running.pod &gt; $(MANDIR)/man1/parrot-gil.1
+#	-$(MKPATH) $(DOC_DIR)/languages/gil
+#	$(CP) $(DOCS) $(DOC_DIR)/languages/gil
+
+uninstall:
+	$(RM_F) $(BIN_DIR)/parrot-gil@exe@
+	$(RM_RF) $(LIB_DIR)/languages/gil
+#	$(RM_F) $(MANDIR)/man1/parrot-gil.1
+#	$(RM_RF) $(DOC_DIR)/languages/gil
+
+win32-inno-installer: installable
+#	-$(MKPATH) man/man1
+#	$(POD2MAN) doc/running.pod &gt; man/man1/parrot-gil.1
+#	-$(MKPATH) man/html
+#	pod2html --infile doc/running.pod --outfile man/html/parrot-gil.html
+	$(CP) installable_gil@exe@ parrot-gil.exe
+	cd @build_dir@ &amp;&amp; $(PERL) tools/dev/mk_inno_language.pl gil
+	cd @build_dir@ &amp;&amp; iscc parrot-gil.iss
+
 testclean:
 
 CLEANUPS = \
+  gil.pbc \
   &quot;src/gen_*.pir&quot; \
-  gil.pbc
+  &quot;*.c&quot; \
+  &quot;*$(O)&quot; \
+  gil@exe@ \
+#IF(win32):  parrot-gil.exe \
+  installable_gil@exe@
 
-clean:
+clean: testclean
 	$(RM_F) $(CLEANUPS)
 
-realclean: clean
-	$(RM_F) Makefile
+realclean: testclean
+	$(RM_F) $(CLEANUPS) Makefile
 
 distclean: realclean
 
+# Local variables:
+#   mode: makefile
+# End:
+# vim: ft=make:
 </diff>
      <filename>config/makefiles/root.in</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ff4ad148414b0cc5a85d584a733a810d87818d76</id>
    </parent>
  </parents>
  <author>
    <name>Francois Perrad</name>
    <email>francois.perrad@gadz.org</email>
  </author>
  <url>http://github.com/tene/gil/commit/0f51ef08345118634c6cdaa7a36c9ece48c93d8d</url>
  <id>0f51ef08345118634c6cdaa7a36c9ece48c93d8d</id>
  <committed-date>2009-03-16T16:38:06-07:00</committed-date>
  <authored-date>2009-02-24T11:29:24-08:00</authored-date>
  <message>re-run tools/dev/mk_language_shell.pl

Signed-off-by: Stephen Weeks &lt;tene@allalone.org&gt;</message>
  <tree>cd5fdaffb33363b0035737587dddd68ad0aca016</tree>
  <committer>
    <name>Stephen Weeks</name>
    <email>tene@allalone.org</email>
  </committer>
</commit>
