Skip to content

Commit

Permalink
Rerun mk_language_shell.pl. Courtesy of fperrad.
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Mar 2, 2009
1 parent 90167c8 commit 9021e34
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 41 deletions.
13 changes: 12 additions & 1 deletion .gitignore
@@ -1,2 +1,13 @@
Makefile
lazy.pbc

*.pbc
*.c
*.o
*.obj
*.iss
*.exe
lazy
installable_lazy

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

my $build_dir = '../..';
my $hll = 'lazy-k';
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
148 changes: 114 additions & 34 deletions config/makefiles/root.in
@@ -1,53 +1,133 @@
# $Id$
## $Id$

# Makefile for languages/lazy-k
## arguments we want to run parrot with
PARROT_ARGS :=

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

# Set up commands
PERL = @perl@
RM_F = @rm_f@
PARROT = $(BUILD_DIR)/parrot@exe@
#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@
# Set up extensions
O := @o@

# The default target
default: build
## 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 := ../../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@

help :
DOCS := README

build: lazy.pbc

all: build lazy@exe@ installable

lazy.pbc: lazy.pir
$(PARROT) $(PARROT_ARGS) -o lazy.pbc lazy.pir

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


installable: installable_lazy@exe@

installable_lazy@exe@: lazy.pbc
$(PBC_TO_EXE) lazy.pbc --install

# regenerate the Makefile
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: Build lazy.pbc."
@echo " This is the default target."
@echo " build: lazy.pbc"
@echo " This is the default."
@echo " lazy@exe@ Self-hosting binary not to be installed."
@echo " all: lazy.pbc lazy@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 " clean: Clean up."
@echo ""
@echo " realclean: Clean and remove Makefile."
@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 ""

# regenerate the Makefile
Makefile: config/makefiles/root.in
$(PERL) Configure.pl
test: build
$(PERL) t/harness

# Compilation:
build: lazy.pbc
install: installable
$(CP) installable_lazy@exe@ $(BIN_DIR)/parrot-lazy@exe@
$(CHMOD) 0755 $(BIN_DIR)/parrot-lazy@exe@
-$(MKPATH) $(LIB_DIR)/languages/lazy-k
$(CP) lazy.pbc $(LIB_DIR)/languages/lazy-k/lazy.pbc
-$(MKPATH) $(MANDIR)/man1
$(POD2MAN) lazy.pir > $(MANDIR)/man1/parrot-lazy.1
-$(MKPATH) $(DOC_DIR)/languages/lazy-k
$(CP) $(DOCS) $(DOC_DIR)/languages/lazy-k

lazy.pbc:
$(PARROT) -o lazy.pbc lazy.pir
uninstall:
$(RM_F) $(BIN_DIR)/parrot-lazy-k@exe@
$(RM_RF) $(LIB_DIR)/languages/lazy-k
$(RM_F) $(MANDIR)/man1/parrot-lazy-k.1
$(RM_RF) $(DOC_DIR)/languages/lazy-k

# cleaning up
clean:
$(RM_F) lazy.pbc
win32-inno-installer: installable
-$(MKPATH) man/man1
$(POD2MAN) lazy.pir > man/man1/parrot-lazy.1
-$(MKPATH) man/html
pod2html --infile lazy.pir --outfile man/html/parrot-lazy.html
$(CP) installable_lazy@exe@ parrot-lazy.exe
$(PERL) $(LIB_DIR)/tools/dev/mk_inno_language.pl lazy-k
iscc parrot-lazy-k.iss

realclean: clean
$(RM_F) Makefile
# clean intermediate test files
testclean:

CLEANUPS := \
lazy.pbc \
"*.c" \
"*$(O)" \
lazy@exe@ \
#IF(win32): parrot-lazy.exe \
#IF(win32): parrot-lazy-k.iss \
#IF(win32): "setup-parrot-*.exe" \
installable_lazy@exe@

clean: testclean
$(RM_F) $(CLEANUPS)

realclean: testclean
$(RM_F) $(CLEANUPS) Makefile

distclean: realclean

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

# testing
test: build
$(PERL) t/harness

0 comments on commit 9021e34

Please sign in to comment.