Skip to content

Commit

Permalink
Move closer to building against an installed parrot.
Browse files Browse the repository at this point in the history
Apply patch from allisonrandal++ from #74.



git-svn-id: http://partcl.googlecode.com/svn/trunk@328 6cb8db7d-f34b-0410-8f57-4f83c6281724
  • Loading branch information
wcoleda committed Apr 24, 2009
1 parent e6063a3 commit 72b645a
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 70 deletions.
1 change: 1 addition & 0 deletions CREDITS
Expand Up @@ -20,6 +20,7 @@ E: amos@coscom.net
N: Allison Randal N: Allison Randal
E: allison@parrot.org E: allison@parrot.org
D: Track function renames in parrot D: Track function renames in parrot
D: Build partcl against installed parrot


N: Jerry Gay a.k.a. particle N: Jerry Gay a.k.a. particle
E: Jerry.Gay@gmail.com E: Jerry.Gay@gmail.com
Expand Down
42 changes: 40 additions & 2 deletions Configure.pl
Expand Up @@ -3,5 +3,43 @@
use strict; use strict;
use warnings; use warnings;


chdir '../..'; my $perlbin = `parrot_config perl`;
`$^X -Ilib tools/dev/reconfigure.pl --step=gen::languages --languages=tcl`; my $libdir = `parrot_config libdir`;
my $versiondir = `parrot_config versiondir`;
my $slash = `parrot_config slash`;
my $make = `parrot_config make`;

chomp($perlbin);
chomp($libdir);
chomp($versiondir);
chomp($slash);
chomp($make);

my $build_tool = $perlbin . " "
. $libdir
. $versiondir
. $slash
. "tools"
. $slash
. "dev"
. $slash
. "gen_makefile.pl";

my %makefiles = (
"config/makefiles/root.in" => "Makefile",
"config/makefiles/pmc.in" => "src/pmc/Makefile",
"config/makefiles/ops.in" => "src/ops/Makefile",
);

foreach my $template (keys %makefiles) {
my $makefile = $makefiles{$template};
print "Creating $makefile\n";
system("$build_tool $template $makefile");
}

print <<"END";
You can now use '$make' to build Partcl.
END

exit;
74 changes: 74 additions & 0 deletions config/makefiles/ops.in
@@ -0,0 +1,74 @@
PERL = @perl@
RM_F = @rm_f@
CHMOD = @chmod@
CP = @cp@
VERSION_DIR = @versiondir@
INCLUDE_DIR = @includedir@$(VERSION_DIR)
LIB_DIR = @libdir@$(VERSION_DIR)
INSTALL_DIR = ..@slash@..@slash@dynext
O = @o@
LOAD_EXT = @load_ext@
CC = @cc@ -c
LD = @ld@
LDFLAGS = @ldflags@ @ld_debug@ @rpath_blib@ @linkflags@
LD_LOAD_FLAGS = @ld_load_flags@
CFLAGS = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
CC_OUT = @cc_o_out@
LD_OUT = @ld_out@
#IF(parrot_is_shared):LIBPARROT = @libparrot_ldflags@
#ELSE:LIBPARROT =

BUILD_TOOLS_DIR = $(LIB_DIR)@slash@tools@slash@build
OPS2C = $(PERL) $(BUILD_TOOLS_DIR)@slash@ops2c.pl

INCLUDES = -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)@slash@pmc
LINKARGS = $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT)

OPS_FILE = tcl.ops

OPS_TARGETS := \
#IF(cg_flag): tcl_ops_cg$(LOAD_EXT) \
#IF(cg_flag): tcl_ops_cgp$(LOAD_EXT) \
tcl_ops$(LOAD_EXT) \
tcl_ops_switch$(LOAD_EXT) \


all : $(OPS_TARGETS)
#IF(cygwin or hpux): CHMOD 0775 "*$(LOAD_EXT)"
$(CP) "*$(LOAD_EXT)" $(INSTALL_DIR)

tcl_ops$(LOAD_EXT): tcl_ops$(O)
$(LD) $(LD_OUT) tcl_ops$(LOAD_EXT) tcl_ops$(O) $(LINKARGS)

tcl_ops$(O): tcl_ops.c
$(CC) $(CC_OUT) tcl_ops$(O) $(INCLUDES) $(CFLAGS) tcl_ops.c

tcl_ops.c: $(OPS_FILE)
$(OPS2C) C --dynamic $(OPS_FILE)

tcl_ops_switch$(LOAD_EXT): tcl_ops_switch$(O)
$(LD) $(LD_OUT) tcl_ops_switch$(LOAD_EXT) tcl_ops_switch$(O) $(LINKARGS)

tcl_ops_switch$(O): tcl_ops_switch.c
$(CC) $(CC_OUT) tcl_ops_switch$(O) $(INCLUDES) $(CFLAGS) tcl_ops_switch.c

tcl_ops_switch.c: $(OPS_FILE)
$(OPS2C) CSwitch --dynamic $(OPS_FILE)

tcl_ops_cg$(LOAD_EXT): tcl_ops_cg$(O)
$(LD) $(LD_OUT) tcl_ops_cg$(LOAD_EXT) tcl_ops_cg$(O) $(LINKARGS)

tcl_ops_cg$(O): tcl_ops_cg.c
$(CC) $(CC_OUT) tcl_ops_cg$(O) $(INCLUDES) $(CFLAGS) tcl_ops_cg.c

tcl_ops_cg.c: $(OPS_FILE)
$(OPS2C) CGoto --dynamic $(OPS_FILE)

tcl_ops_cgp$(LOAD_EXT): tcl_ops_cgp$(O)
$(LD) $(LD_OUT) tcl_ops_cgp$(LOAD_EXT) tcl_ops_cgp$(O) $(LINKARGS)

tcl_ops_cgp$(O): tcl_ops_cgp.c
$(CC) $(CC_OUT) tcl_ops_cgp$(O) $(INCLUDES) $(CFLAGS) tcl_ops_cgp.c

tcl_ops_cgp.c: $(OPS_FILE)
$(OPS2C) CGP --dynamic $(OPS_FILE)
109 changes: 109 additions & 0 deletions config/makefiles/pmc.in
@@ -0,0 +1,109 @@
PERL = @perl@
RM_F = @rm_f@
CHMOD = @chmod@
CP = @cp@
VERSION_DIR = @versiondir@
INCLUDE_DIR = @includedir@$(VERSION_DIR)
LIB_DIR = @libdir@$(VERSION_DIR)
SRC_DIR = @srcdir@$(VERSION_DIR)
INSTALL_DIR = ../../dynext
O = @o@
LOAD_EXT = @load_ext@
CC = @cc@ -c
LD = @ld@
LDFLAGS = @ldflags@ @ld_debug@
LD_LOAD_FLAGS = @ld_load_flags@
CFLAGS = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
CC_OUT = @cc_o_out@
LD_OUT = @ld_out@
#IF(parrot_is_shared):LIBPARROT = @libparrot_ldflags@
#ELSE:LIBPARROT =

BUILD_TOOLS_DIR = $(LIB_DIR)@slash@tools@slash@build
PMC2C_INCLUDES = --include $(SRC_DIR) --include $(SRC_DIR)@slash@pmc
PMC2C = $(PERL) $(BUILD_TOOLS_DIR)@slash@pmc2c.pl
PMC2CD = $(PMC2C) --dump $(PMC2C_INCLUDES)
PMC2CC = $(PMC2C) --c $(PMC2C_INCLUDES)

INCLUDES = -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)@slash@pmc
LINKARGS = $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT)

PMC_SOURCES = \
tclobject.pmc \
tclstring.pmc \
tclint.pmc \
tclfloat.pmc \
tcllist.pmc \
tcldict.pmc


TCL_GROUP = tcl_group

all : $(TCL_GROUP)$(LOAD_EXT)
#IF(cygwin or hpux): CHMOD 0775 "*$(LOAD_EXT)"
$(CP) "*$(LOAD_EXT)" $(INSTALL_DIR)


$(TCL_GROUP)$(LOAD_EXT): tclobject$(O) tclstring$(O) tclint$(O) tclfloat$(O) tcllist$(O) tcldict$(O) lib-$(TCL_GROUP)$(O)
$(LD) $(LD_OUT) $(TCL_GROUP)$(LOAD_EXT) lib-$(TCL_GROUP)$(O) tclobject$(O) tclstring$(O) tclint$(O) tclfloat$(O) tcllist$(O) tcldict$(O) $(LINKARGS)

lib-$(TCL_GROUP)$(O): $(TCL_GROUP).c
$(CC) $(CC_OUT) lib-$(TCL_GROUP)$(O) $(INCLUDES) $(CFLAGS) $(TCL_GROUP).c

$(TCL_GROUP).c: $(PMC_SOURCES)
$(PMC2C) --library $(TCL_GROUP) --c $(PMC_SOURCES)

tclobject.dump: tclobject.pmc
$(PMC2CD) tclobject.pmc

tclobject.c: tclobject.dump
$(PMC2CC) tclobject.pmc

tclobject$(O): tclobject.c
$(CC) $(CC_OUT) tclobject$(O) $(INCLUDES) $(CFLAGS) tclobject.c

tclstring.dump: tclstring.pmc
$(PMC2CD) tclstring.pmc

tclstring.c: tclstring.dump
$(PMC2CC) tclstring.pmc

tclstring$(O): tclstring.c
$(CC) $(CC_OUT) tclstring$(O) $(INCLUDES) $(CFLAGS) tclstring.c

tclint.dump: tclint.pmc
$(PMC2CD) tclint.pmc

tclint.c: tclint.dump
$(PMC2CC) tclint.pmc

tclint$(O): tclint.c
$(CC) $(CC_OUT) tclint$(O) $(INCLUDES) $(CFLAGS) tclint.c

tclfloat.dump: tclfloat.pmc
$(PMC2CD) tclfloat.pmc

tclfloat.c: tclfloat.dump
$(PMC2CC) tclfloat.pmc

tclfloat$(O): tclfloat.c
$(CC) $(CC_OUT) tclfloat$(O) $(INCLUDES) $(CFLAGS) tclfloat.c

tcllist.dump: tcllist.pmc
$(PMC2CD) tcllist.pmc

tcllist.c: tcllist.dump
$(PMC2CC) tcllist.pmc

tcllist$(O): tcllist.c
$(CC) $(CC_OUT) tcllist$(O) $(INCLUDES) $(CFLAGS) tcllist.c

tcldict.dump: tcldict.pmc
$(PMC2CD) tcldict.pmc

tcldict.c: tcldict.dump
$(PMC2CC) tcldict.pmc

tcldict$(O): tcldict.c
$(CC) $(CC_OUT) tcldict$(O) $(INCLUDES) $(CFLAGS) tcldict.c

63 changes: 20 additions & 43 deletions config/makefiles/root.in
@@ -1,18 +1,19 @@
RM_F = @rm_f@ RM_F = @rm_f@
PERL = @perl@ PERL = @perl@
PARROT = ../../parrot@exe@


BUILD_DIR = @build_dir@ VERSION_DIR = @versiondir@
RECONFIGURE = $(PERL) $(BUILD_DIR)/tools/dev/reconfigure.pl INCLUDE_DIR = @includedir@$(VERSION_DIR)
PBC_TO_EXE = $(BUILD_DIR)/pbc_to_exe@exe@ LIB_DIR = @libdir@$(VERSION_DIR)
BIN_DIR = @bindir@
PARROT = $(BIN_DIR)/parrot@exe@
TOOLS_DIR = @libdir@$(VERSION_DIR)@slash@tools
RECONFIGURE = $(PERL) $(LIB_DIR)/tools/dev/gen_makefile.pl
PBC_TO_EXE = $(BIN_DIR)/pbc_to_exe@exe@
#CONDITIONED_LINE(darwin): #CONDITIONED_LINE(darwin):
#CONDITIONED_LINE(darwin):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X compilation/linking #CONDITIONED_LINE(darwin):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X compilation/linking
#CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@ #CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@


TCL_LIB = library TCL_LIB = library
PMCBUILD = $(PERL) @build_dir@/tools/build/dynpmc.pl
OPSBUILD = $(PERL) @build_dir@/tools/build/dynoplibs.pl
DESTDIR = @build_dir@/runtime/parrot/dynext
O = @o@ O = @o@
PMCDIR = src/pmc PMCDIR = src/pmc
OPSDIR = src/ops OPSDIR = src/ops
Expand All @@ -25,19 +26,8 @@ CC_SHARED = @cc_shared@
CFLAGS = @ccflags@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ $(CC_SHARED) CFLAGS = @ccflags@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ $(CC_SHARED)
CC = @cc@ CC = @cc@



TGE_DIR = $(LIB_DIR)/languages/tge
TGE_DIR = ../../compilers/tge PERL6GRAMMAR = $(LIB_DIR)/library/PGE/Perl6Grammar.pbc
PERL6GRAMMAR = ../../runtime/parrot/library/PGE/Perl6Grammar.pbc

# can't use $(wildcard) and friends for PMCS, as these have to be in
# dependency order; with no duplicates.
PMCS = \
tclobject \
tclstring \
tclint \
tclfloat \
tcllist \
tcldict


RUNTIME_PIR = runtime/builtin/after.pir runtime/builtin/linsert.pir \ RUNTIME_PIR = runtime/builtin/after.pir runtime/builtin/linsert.pir \
runtime/builtin/append.pir runtime/builtin/list.pir \ runtime/builtin/append.pir runtime/builtin/list.pir \
Expand Down Expand Up @@ -127,25 +117,13 @@ CLASSES = \
$(CLASSDIR)/tracearray.pir $(CLASSDIR)/tracearray.pir


pmcs: pmcs:
@cd $(PMCDIR) && $(PMCBUILD) generate $(PMCS) $(MAKE) $(PMCDIR)
@cd $(PMCDIR) && $(PMCBUILD) compile $(PMCS)
@cd $(PMCDIR) && $(PMCBUILD) linklibs $(PMCS)
@cd $(PMCDIR) && $(PMCBUILD) copy "--destination=$(DESTDIR)" $(PMCS)

# THIS WAS COPIED FROM THE ROOT MAKEFILE
# Passing an empty argument in @ARGV to cc_flags.pl to indicate where extra -Is
# (etc) should go. Otherwise it will insert them after the first space, which
# makes life go horribly wrong if $(CC) contains spaces but can't have -I
# arguments (etc) injected in the middle.
# There is probably a better way to do this, but I can't work it out right now.
.c$(O) : .c$(O) :
@$(PERL) ../../tools/dev/cc_flags.pl ../../CFLAGS $(CC) "" $(CFLAGS) -I@build_dir@@slash@include @cc_o_out@$@ -c $< $(CC) $(CFLAGS) -I$(INCLUDE_DIR) @cc_o_out@$@ -c $<


ops: src/binary$(O) ops: src/binary$(O)
@cd $(OPSDIR) && $(OPSBUILD) generate tcl $(MAKE) $(OPSDIR)
@cd $(OPSDIR) && $(OPSBUILD) compile tcl
@cd $(OPSDIR) && $(OPSBUILD) linklibs tcl ../binary$(O)
@cd $(OPSDIR) && $(OPSBUILD) copy "--destination=$(DESTDIR)" tcl


runtime/builtins.pir: $(DEPS) tools/gen_builtins.pl runtime/builtins.pir: $(DEPS) tools/gen_builtins.pl
$(PERL) tools/gen_builtins.pl > runtime/builtins.pir $(PERL) tools/gen_builtins.pl > runtime/builtins.pir
Expand All @@ -159,11 +137,8 @@ tclsh@exe@: tcl.pbc $(PBC_TO_EXE)
$(PBC_TO_EXE) tcl.pbc $(PBC_TO_EXE) tcl.pbc
$(RENAME) tcl@exe@ tclsh@exe@ $(RENAME) tcl@exe@ tclsh@exe@


$(PBC_TO_EXE):
$(MAKE) $(BUILD_DIR) ./pbc_to_exe@exe@

test: tcl.pbc test: tcl.pbc
$(PERL) t/harness $(PERL) -I$(TOOLS_DIR)/lib t/harness


spectest: tcl.pbc spectest: tcl.pbc
$(PERL) tools/tcl_test.pl $(PERL) tools/tcl_test.pl
Expand Down Expand Up @@ -215,7 +190,9 @@ realclean: clean


distclean: realclean distclean: realclean


# regenerate the Makefile # regenerate the Makefiles
Makefile: config/makefiles/root.in Makefile: config/makefiles/root.in config/makefiles/pmc.in config/makefiles/ops.in
cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=tcl $(RECONFIGURE) config/makefiles/root.in Makefile
$(RECONFIGURE) config/makefiles/pmc.in $(PMCDIR)/Makefile
$(RECONFIGURE) config/makefiles/ops.in $(OPSDIR)/Makefile


1 change: 1 addition & 0 deletions dynext/README
@@ -0,0 +1 @@
This directory holds dynamic extensions for Partcl.
4 changes: 2 additions & 2 deletions runtime/conversions.pir
Expand Up @@ -431,15 +431,15 @@ do_wrapper:
pir.'emit'(".HLL 'Tcl'") pir.'emit'(".HLL 'Tcl'")
pir.'emit'(".loadlib 'tcl_ops'") pir.'emit'(".loadlib 'tcl_ops'")
pir.'emit'('.namespace %0', namespace) pir.'emit'('.namespace %0', namespace)
pir.'emit'(".include 'languages/tcl/src/returncodes.pasm'") pir.'emit'(".include 'src/returncodes.pasm'")
pir.'emit'(".sub '_anon' :anon") pir.'emit'(".sub '_anon' :anon")
pir .= result pir .= result
pir.'emit'(' .return(%0)', ret) pir.'emit'(' .return(%0)', ret)
pir.'emit'('.end') pir.'emit'('.end')
pir.'emit'(<<"END_PIR") pir.'emit'(<<"END_PIR")


.sub '_init' :init .sub '_init' :init
load_bytecode 'languages/tcl/runtime/tcllib.pir' load_bytecode 'runtime/tcllib.pir'
.end .end
END_PIR END_PIR


Expand Down

0 comments on commit 72b645a

Please sign in to comment.