Skip to content

Commit

Permalink
Rerun mk_language_shell.pl
Browse files Browse the repository at this point in the history
Courtesy of fperrad
  • Loading branch information
bschmalhofer committed Mar 2, 2009
1 parent d7c71ae commit d50b283
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 44 deletions.
21 changes: 16 additions & 5 deletions .gitignore
@@ -1,8 +1,19 @@
.gitignore

Makefile
hq9plus.pbc
src/gen_actions.pir
src/gen_builtins.pir
src/gen_grammar.pir

*.pbc
*.c
*.o
*.obj
*.exe
*.iss
hq9plus
installable_hq9plus

*.tmp
man

src/gen_*.pir

t/basic_*.HQ9plus
t/basic_*.out
54 changes: 49 additions & 5 deletions Configure.pl
Expand Up @@ -5,13 +5,57 @@
use warnings;
use 5.008;

my $build_dir = '../..';
my $cmd = qq{$^X -Ilib tools/dev/reconfigure.pl --step=gen::languages --languages=hq9plus};
# Get a list of parrot-configs to invoke.
my @parrot_config_exe = (
'parrot/parrot_config',
'../../parrot_config',
'parrot_config',
);

print "Running '$cmd' in $build_dir\n";
# Get configuration information from parrot_config
my %config = read_parrot_config(@parrot_config_exe);
unless (%config) {
die "Unable to locate parrot_config.";
}

chdir $build_dir;
`$cmd`
# 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
Expand Down
137 changes: 103 additions & 34 deletions config/makefiles/root.in
@@ -1,43 +1,80 @@
## $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
O := @o@

# Various paths
PERL6GRAMMAR := $(LIB_DIR)/library/PGE/Perl6Grammar.pbc
NQP := $(LIB_DIR)/languages/nqp/nqp.pbc
PCT := $(LIB_DIR)/library/PCT.pbc

## Setup some commands
PERL = @perl@
RM_F = @rm_f@
PARROT = @build_dir@/parrot@exe@
CAT = $(PERL) -MExtUtils::Command -e cat
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@

## 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: hq9plus.pbc

SOURCES = hq9plus.pir \
SOURCES := \
src/gen_grammar.pir \
src/gen_actions.pir \
src/gen_builtins.pir \
hq9plus.pir

BUILTINS_PIR = \
BUILTINS_PIR := \
src/builtins/hello.pir \
src/builtins/quine.pir \
src/builtins/nintynine_bottles_of_beer.pir \
src/builtins/plus.pir \
src/builtins/plus.pir

DOCS := README

TEST_CLEANUPS := \
"t/*.HQ9plus" \
"t/*.out"

CLEANUPS := \
hq9plus.pbc \
"src/gen_*.pir" \
"*.c" \
"*$(O)" \
hq9plus@exe@ \
#IF(win32): parrot-hq9plus.exe \
#IF(win32): parrot-hq9plus.iss \
#IF(win32): "setup-parrot-*.exe" \
man \
installable_hq9plus@exe@

# the default target
hq9plus.pbc: $(PARROT) $(SOURCES)
build: hq9plus.pbc

all: build hq9plus@exe@ installable

hq9plus.pbc: $(SOURCES)
$(PARROT) $(PARROT_ARGS) -o hq9plus.pbc hq9plus.pir

hq9plus@exe@: hq9plus.pbc
$(PBC_TO_EXE) hq9plus.pbc

src/gen_grammar.pir: $(PERL6GRAMMAR) src/parser/grammar.pg
$(PARROT) $(PARROT_ARGS) $(PERL6GRAMMAR) \
--output=src/gen_grammar.pir \
Expand All @@ -48,7 +85,12 @@ src/gen_actions.pir: $(NQP) $(PCT) src/parser/actions.pm
--target=pir src/parser/actions.pm

src/gen_builtins.pir: $(BUILTINS_PIR)
$(CAT) $(BUILTINS_PIR) >src/gen_builtins.pir
$(CAT) $(BUILTINS_PIR) > src/gen_builtins.pir

installable: installable_hq9plus@exe@

installable_hq9plus@exe@: hq9plus.pbc
$(PBC_TO_EXE) hq9plus.pbc --install

# regenerate the Makefile
Makefile: config/makefiles/root.in
Expand All @@ -59,8 +101,13 @@ help:
@echo ""
@echo "Following targets are available for the user:"
@echo ""
@echo " all: hq9plus.pbc"
@echo " build: hq9plus.pbc"
@echo " This is the default."
@echo " hq9plus@exe@ Self-hosting binary not to be installed."
@echo " all: hq9plus.pbc hq9plus@exe@ installable"
@echo " installable: Create libs and self-hosting binaries to be installed."
@echo " install: Install the installable targets and docs."
@echo ""
@echo "Testing:"
@echo " test: Run the test suite."
@echo " testclean: Clean up test results."
Expand All @@ -74,25 +121,47 @@ help:
@echo " help: Print this help message."
@echo ""

test: all
test: build
$(PERL) t/harness

# this target has nothing to do
testclean:

CLEANUPS = \
hq9plus.pbc \
src/gen_grammar.pir \
src/gen_actions.pir \
src/gen_builtins.pir \
t/*.HQ9plus \
t/*.out
install: installable
$(CP) installable_hq9plus@exe@ $(BIN_DIR)/parrot-hq9plus@exe@
$(CHMOD) 0755 $(BIN_DIR)/parrot-hq9plus@exe@
-$(MKPATH) $(LIB_DIR)/languages/hq9plus
$(CP) hq9plus.pbc $(LIB_DIR)/languages/hq9plus/hq9plus.pbc
-$(MKPATH) $(MANDIR)/man1
$(POD2MAN) hq9plus.pir > $(MANDIR)/man1/parrot-hq9plus.1
-$(MKPATH) $(DOC_DIR)/languages/hq9plus
$(CP) $(DOCS) $(DOC_DIR)/languages/hq9plus

uninstall:
$(RM_F) $(BIN_DIR)/parrot-hq9plus@exe@
$(RM_RF) $(LIB_DIR)/languages/hq9plus
$(RM_F) $(MANDIR)/man1/parrot-hq9plus.1
$(RM_RF) $(DOC_DIR)/languages/hq9plus

win32-inno-installer: installable
-$(MKPATH) man/man1
$(POD2MAN) hq9plus.pir > man/man1/parrot-hq9plus.1
-$(MKPATH) man/html
pod2html --infile hq9plus.pir --outfile man/html/parrot-hq9plus.html
$(CP) installable_hq9plus@exe@ parrot-hq9plus.exe
$(PERL) $(LIB_DIR)/tools/dev/mk_inno_language.pl hq9plus
iscc parrot-hq9plus.iss

testclean:
$(RM_F) $(TEST_CLEANUPS)

clean:
$(RM_F) $(CLEANUPS)
$(RM_RF) $(TEST_CLEANUPS) $(CLEANUPS)

realclean: clean
$(RM_F) Makefile
realclean:
$(RM_RF) $(TEST_CLEANUPS) $(CLEANUPS) Makefile

distclean: realclean

# Local variables:
# mode: makefile
# End:
# vim: ft=make:

0 comments on commit d50b283

Please sign in to comment.