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 ce991a2 commit ba41e71
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 42 deletions.
14 changes: 13 additions & 1 deletion .gitignore
@@ -1,5 +1,17 @@
/Makefile
*.pbc

/*.pbc
/*.c
/*.o
/*.obj
/*.exe
/*.iss
/m4
/installable_m4

/man
/*.tmp

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

my $build_dir = '../..';
my $hll = 'm4';
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: 113 additions & 35 deletions config/makefiles/root.in
@@ -1,33 +1,83 @@
# $Id$
## $Id$

# Makefile for languages/m4
## arguments we want to run parrot with
PARROT_ARGS :=

# Setup of some commands
PARROT = @build_dir@/parrot@exe@
PERL = @perl@
RM_RF = @rm_rf@
TOUCH = $(PERL) -MExtUtils::Command -e touch
## 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@

## 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@

default: all
all: build
SOURCES := \
src/m4.pir \
src/builtin.pir \
src/freeze.pir \
src/input.pir \
src/macro.pir \
src/output.pir

DOCS := README INSTALL

TEST_CLEANUPS := \
"t/*/*.m4" \
"t/*/*.pir_out" \
"t/*/*.gnu_out" \
"t/*/*.pir"

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

build: m4.pbc

all: build m4@exe@ installable

help:
@echo ""
@echo "Following targets are available for the user:"
@echo ""
@echo " all: m4.pbc"
@echo " build: m4.pbc"
@echo " This is the default."
@echo " m4@exe@ Self-hosting binary not to be installed."
@echo " all: m4.pbc m4@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-gnu-m4: Run the test suite on the installed GNU m4."
@echo ""
@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 " distclean: Removes also anything built, in theory"
@echo ""
@echo "Misc:"
@echo " help: Print this help message."
Expand All @@ -39,41 +89,69 @@ help:
Makefile: config/makefiles/root.in
$(PERL) Configure.pl


test: build
$(PERL) -Ilib -I../../lib t/harness

test-gnu-m4: build
PARROT_M4_TEST_PROG='m4' $(PERL) -Ilib -I../../lib t/harness

build: m4.pbc
m4.pbc: $(SOURCES)
$(PARROT) -o m4.pbc src/m4.pir

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

m4.pbc: src/m4.pir
$(PARROT) -o m4.pbc src/m4.pir
installable: installable_m4@exe@

src/m4.pir: src/builtin.pir src/freeze.pir src/input.pir src/macro.pir src/output.pir
$(TOUCH) $@
installable_m4@exe@: m4.pbc
$(PBC_TO_EXE) m4.pbc --install

install: installable
$(CP) installable_m4@exe@ $(BIN_DIR)/parrot-m4@exe@
$(CHMOD) 0755 $(BIN_DIR)/parrot-m4@exe@
-$(MKPATH) $(LIB_DIR)/languages/m4
$(CP) m4.pbc $(LIB_DIR)/languages/m4/m4.pbc
-$(MKPATH) $(MANDIR)/man1
$(POD2MAN) doc/running.pod > $(MANDIR)/man1/parrot-m4.1
-$(MKPATH) $(DOC_DIR)/languages/m4
$(CP) $(DOCS) $(DOC_DIR)/languages/m4
$(CP) doc/*.pod $(DOC_DIR)/languages/m4

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

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

html:
mkdir doc/html
pod2html doc/*.pod -o doc/html

html:
mkdir docs/html
pod2html docs/*.pod -o docs/html

perlcritic:
$(PERL) tools/scrutinize.pl


testclean:
$(RM_F) $(TEST_CLEANUPS)

clean:
$(RM_RF) \
m4.pbc \
"*.pdb" \
"*.obj" \
"src/*.pbc" \
"src/*~" \
"t/*/*.m4" \
"t/*/*.pir_out" \
"t/*/*.gnu_out" \
"t/*/*.pir"

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

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

distclean: realclean

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

0 comments on commit ba41e71

Please sign in to comment.