Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
re-run mk_language_shell.pl
  • Loading branch information
fperrad authored and stefano committed Mar 2, 2009
1 parent 3592559 commit 91d25ef
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 30 deletions.
10 changes: 10 additions & 0 deletions .gitignore
@@ -1,7 +1,17 @@
Makefile

*.pbc
*.c
*.o
*.obj
*.iss
*.exe
arc
installable_arc

*.patch
*.tar
*.tar.gz

t/*.arc
t/*.out
56 changes: 50 additions & 6 deletions Configure.pl
Expand Up @@ -5,13 +5,57 @@
use warnings;
use 5.008;

my $build_dir = '../..';
my $hll = 'primitivearc';
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 "Running '$cmd' in $build_dir\n";
chdir $build_dir;
`$cmd`
# 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
Expand Down
12 changes: 6 additions & 6 deletions arc.pir
Expand Up @@ -89,9 +89,9 @@ error:
.return ($P1)
.end

.include 'languages/primitivearc/types.pir'
.include 'languages/primitivearc/symtable.pir'
.include 'languages/primitivearc/arcall.pir'
.include 'languages/primitivearc/compiler.pir'
.include 'languages/primitivearc/read.pir'
.include 'languages/primitivearc/builtins.pir'
.include 'types.pir'
.include 'symtable.pir'
.include 'arcall.pir'
.include 'compiler.pir'
.include 'read.pir'
.include 'builtins.pir'
117 changes: 99 additions & 18 deletions config/makefiles/root.in
@@ -1,10 +1,34 @@

## Setup some commands
PERL = @perl@
RM_F = @rm_f@
PARROT = ../../parrot@exe@
## arguments we want to run parrot with
PARROT_ARGS :=

## configuration settings
VERSION := @versiondir@
BIN_DIR := @bin_dir@
LIB_DIR := @lib_dir@$(VERSION)
DOC_DIR := @doc_dir@$(VERSION)
MANDIR := @mandir@$(VERSION)

# Set up extensions
O := @o@

SOURCES = \
## 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@

SOURCES := \
arc.pir \
arcall.pir \
builtins.pir \
Expand All @@ -13,12 +37,38 @@ SOURCES = \
symtable.pir \
types.pir

all: arc.pbc
DOCS := README

BUILD_CLEANUPS := \
arc.pbc \
"*.c" \
"*$(O)" \
arc@exe@ \
#IF(win32): parrot-arc.exe \
#IF(win32): parrot-primitivearc.iss \
#IF(win32): "setup-parrot-*.exe" \
installable_arc@exe@

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

# the default target
build: arc.pbc

all: build arc@exe@ installable

arc.pbc: $(SOURCES)
$(PARROT) -o arc.pbc arc.pir

# regenerate the Makefile
arc@exe@: arc.pbc
$(PBC_TO_EXE) arc.pbc

installable: installable_arc@exe@

installable_arc@exe@: arc.pbc
$(PBC_TO_EXE) arc.pbc --install

Makefile: config/makefiles/root.in
$(PERL) Configure.pl

Expand All @@ -27,10 +77,16 @@ help:
@echo ""
@echo "Following targets are available for the user:"
@echo ""
@echo " all: Compile all *.pbc"
@echo " build: primitivearc.pbc"
@echo " This is the default."
@echo " arc@exe@ Self-hosting binary not to be installed."
@echo " all: arc.pbc arc@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 " test-installable: Test self-hosting targets."
@echo " testclean: Clean up test results."
@echo ""
@echo "Cleaning:"
Expand All @@ -42,9 +98,13 @@ help:
@echo " help: Print this help message."
@echo ""

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

# basic run for missing libs
test-installable: installable
echo "1" | ./installable_primitivearc@exe@

codetest: codetest-make codetest-perl codetest-pir

T_MAKE = config//makefiles//root.in
Expand All @@ -71,24 +131,45 @@ codetest-pir:
- $(PERL) @build_dir@/t/codingstd/tabs.t $(T_PIR)
- $(PERL) @build_dir@/t/codingstd/trailing_space.t $(T_PIR)

TEST_CLEANUPS = \
"t/*.arc" \
"t/*.out"

install: installable
$(CP) installable_arc@exe@ $(BIN_DIR)/parrot-arc@exe@
$(CHMOD) 0755 $(BIN_DIR)/parrot-arc@exe@
-$(MKPATH) $(LIB_DIR)/languages/primitivearc
$(CP) arc.pbc $(LIB_DIR)/languages/primitivearc/arc.pbc
# -$(MKPATH) $(MANDIR)/man1
# $(POD2MAN) arc.pir > $(MANDIR)/man1/parrot-arc.1
-$(MKPATH) $(DOC_DIR)/languages/primitivearc
$(CP) $(DOCS) $(DOC_DIR)/languages/primitivearc

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

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

testclean:
$(RM_F) $(TEST_CLEANUPS)

CLEANUPS = "*.pbc"
clean:
$(RM_F) $(TEST_CLEANUPS) $(BUILD_CLEANUPS)

clean: testclean
$(RM_F) $(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 91d25ef

Please sign in to comment.