Skip to content
Browse files

[ook] re-run mk_language_shell.pl

  • Loading branch information...
1 parent 2b36df5 commit 81ad2eb58e828dfa465de7c395ce81144250f693 @fperrad fperrad committed Mar 15, 2009
Showing with 176 additions and 33 deletions.
  1. +66 −0 Configure.pl
  2. +110 −33 config/makefiles/root.in
View
66 Configure.pl
@@ -0,0 +1,66 @@
+# 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
143 config/makefiles/root.in
@@ -1,60 +1,137 @@
# Copyright (C) 2003-2009, Parrot Foundation.
# $Id$
-# Makefile for languages/ook
+## arguments we want to run parrot with
+PARROT_ARGS :=
-# Set up of commands
-PARROT = ../../parrot
-PERL = @perl@
-RM_F = @rm_f@
-RECONFIGURE = $(PERL) @build_dir@/tools/dev/reconfigure.pl
-#CONDITIONED_LINE(darwin):
-#CONDITIONED_LINE(darwin):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X compilation/linking
-#CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@
+## configuration settings
+VERSION := @versiondir@
+BIN_DIR := @bin_dir@
+LIB_DIR := @lib_dir@$(VERSION)
+DOC_DIR := @doc_dir@$(VERSION)
+MANDIR := @mandir@$(VERSION)
-# Set up directories
-BUILD_DIR = @build_dir@
+# Set up extensions
+LOAD_EXT := @load_ext@
+O := @o@
-default: all
+## Setup some commands
+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 := $(BIN_DIR)/parrot@exe@
+PBC_TO_EXE := $(BIN_DIR)/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@
-help :
+DOCS := README
+
+BUILD_CLEANUPS := \
+ ook.pbc \
+ "*.c" \
+ "*$(O)" \
+ ook@exe@ \
+#IF(win32): parrot-ook.exe \
+#IF(win32): parrot-ook.iss \
+#IF(win32): "setup-parrot-*.exe" \
+ installable_ook@exe@
+
+TEST_CLEANUPS := \
+ "*.out" \
+
+# the default target
+build: ook.pbc
+
+all: build ook@exe@ installable
+
+ook.pbc: ook.pasm
+ $(PARROT) $(PARROT_ARGS) -o ook.pbc ook.pasm
+
+ook@exe@: ook.pbc
+ $(PBC_TO_EXE) ook.pbc
+
+installable: installable_ook@exe@
+
+installable_ook@exe@: ook.pbc
+ $(PBC_TO_EXE) ook.pbc --install
+
+Makefile: config/makefiles/root.in
+ $(PERL) Configure.pl
+
+# 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 " build: Create ook.pbc"
+ @echo " build: ook.pbc"
@echo " This is the default."
+ @echo " ook@exe@ Self-hosting binary not to be installed."
+ @echo " all: ook.pbc ook@exe@ installable"
+ @echo " installable: Create libs and self-hosting binaries to be installed."
+ @echo " install: Install the installable targets and docs."
@echo ""
- @echo " test: run the test suite,"
+ @echo "Testing:"
+ @echo " test: Run the test suite."
+ @echo " test-installable: Test self-hosting targets."
+ @echo " testclean: Clean up test results."
@echo ""
- @echo " clean: clean up temporary files"
+ @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 " realclean: clean up generated files"
+ @echo "Misc:"
+ @echo " help: Print this help message."
@echo ""
- @echo " help: print this help message"
-# regenerate the Makefile
-Makefile: config/makefiles/root.in
- cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=ook
+test: build
+ $(PERL) -I$(LIB_DIR)/tools/lib t/harness
-all: build
+install: installable
+ $(CP) installable_ook@exe@ $(BIN_DIR)/parrot-ook@exe@
+ $(CHMOD) 0755 $(BIN_DIR)/parrot-ook@exe@
+ -$(MKPATH) $(LIB_DIR)/languages/ook
+ $(CP) ook.pbc $(LIB_DIR)/languages/ook/ook.pbc
+# -$(MKPATH) $(MANDIR)/man1
+# $(POD2MAN) doc/running.pod > $(MANDIR)/man1/parrot-ook.1
+ -$(MKPATH) $(DOC_DIR)/languages/ook
+ $(CP) $(DOCS) $(DOC_DIR)/languages/ook
-test: build
- $(PERL) -I../../lib t/harness
+uninstall:
+ $(RM_F) $(BIN_DIR)/parrot-ook@exe@
+ $(RM_RF) $(LIB_DIR)/languages/ook
+# $(RM_F) $(MANDIR)/man1/parrot-ook.1
+ $(RM_RF) $(DOC_DIR)/languages/ook
+
+win32-inno-installer: installable
+# -$(MKPATH) man/man1
+# $(POD2MAN) doc/running.pod > man/man1/parrot-ook.1
+# -$(MKPATH) man/html
+# pod2html --infile doc/running.pod --outfile man/html/parrot-ook.html
+ $(CP) installable_ook@exe@ parrot-ook.exe
+ $(PERL) -I$(LIB_DIR)/tools/lib $(LIB_DIR)/tools/dev/mk_inno_language.pl ook
+ iscc parrot-ook.iss
-build: ook.pasm
- $(PARROT) -o ook.pbc ook.pasm
+testclean:
+ $(RM_F) $(TEST_CLEANUPS)
clean:
- $(RM_F) core \
- "*.pbc" \
- "*~" \
- "hello.out" \
- "foo.p*"
+ $(RM_F) $(TEST_CLEANUPS) $(BUILD_CLEANUPS)
-realclean: clean
- $(RM_F) Makefile
+realclean:
+ $(RM_F) $(TEST_CLEANUPS) $(BUILD_CLEANUPS) Makefile
+
+distclean: realclean
# Local variables:
# mode: makefile
# End:
# vim: ft=make:
+

0 comments on commit 81ad2eb

Please sign in to comment.
Something went wrong with that request. Please try again.