Permalink
Browse files

Move closer to building against an installed parrot.

Apply patch from allisonrandal++ from #74.



git-svn-id: http://partcl.googlecode.com/svn/trunk@328 6cb8db7d-f34b-0410-8f57-4f83c6281724
  • Loading branch information...
1 parent e6063a3 commit 72b645af342855c0b074f3b8884f73495229d5f9 wcoleda committed Apr 24, 2009
Showing with 270 additions and 70 deletions.
  1. +1 −0 CREDITS
  2. +40 −2 Configure.pl
  3. +74 −0 config/makefiles/ops.in
  4. +109 −0 config/makefiles/pmc.in
  5. +20 −43 config/makefiles/root.in
  6. +1 −0 dynext/README
  7. +2 −2 runtime/conversions.pir
  8. +19 −19 runtime/tcllib.pir
  9. +1 −1 src/macros.pir
  10. +2 −2 src/tclsh.pir
  11. +1 −1 tools/gen_builtins.pl
View
@@ -20,6 +20,7 @@ E: amos@coscom.net
N: Allison Randal
E: allison@parrot.org
D: Track function renames in parrot
+D: Build partcl against installed parrot
N: Jerry Gay a.k.a. particle
E: Jerry.Gay@gmail.com
View
@@ -3,5 +3,43 @@
use strict;
use warnings;
-chdir '../..';
-`$^X -Ilib tools/dev/reconfigure.pl --step=gen::languages --languages=tcl`;
+my $perlbin = `parrot_config perl`;
+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;
View
@@ -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)
View
@@ -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
+
View
@@ -1,18 +1,19 @@
RM_F = @rm_f@
PERL = @perl@
-PARROT = ../../parrot@exe@
-BUILD_DIR = @build_dir@
-RECONFIGURE = $(PERL) $(BUILD_DIR)/tools/dev/reconfigure.pl
-PBC_TO_EXE = $(BUILD_DIR)/pbc_to_exe@exe@
+VERSION_DIR = @versiondir@
+INCLUDE_DIR = @includedir@$(VERSION_DIR)
+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):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X compilation/linking
#CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@
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@
PMCDIR = src/pmc
OPSDIR = src/ops
@@ -25,19 +26,8 @@ CC_SHARED = @cc_shared@
CFLAGS = @ccflags@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ $(CC_SHARED)
CC = @cc@
-
-TGE_DIR = ../../compilers/tge
-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
+TGE_DIR = $(LIB_DIR)/languages/tge
+PERL6GRAMMAR = $(LIB_DIR)/library/PGE/Perl6Grammar.pbc
RUNTIME_PIR = runtime/builtin/after.pir runtime/builtin/linsert.pir \
runtime/builtin/append.pir runtime/builtin/list.pir \
@@ -127,25 +117,13 @@ CLASSES = \
$(CLASSDIR)/tracearray.pir
pmcs:
- @cd $(PMCDIR) && $(PMCBUILD) generate $(PMCS)
- @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.
+ $(MAKE) $(PMCDIR)
+
.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)
- @cd $(OPSDIR) && $(OPSBUILD) generate tcl
- @cd $(OPSDIR) && $(OPSBUILD) compile tcl
- @cd $(OPSDIR) && $(OPSBUILD) linklibs tcl ../binary$(O)
- @cd $(OPSDIR) && $(OPSBUILD) copy "--destination=$(DESTDIR)" tcl
+ $(MAKE) $(OPSDIR)
runtime/builtins.pir: $(DEPS) tools/gen_builtins.pl
$(PERL) tools/gen_builtins.pl > runtime/builtins.pir
@@ -159,11 +137,8 @@ tclsh@exe@: tcl.pbc $(PBC_TO_EXE)
$(PBC_TO_EXE) tcl.pbc
$(RENAME) tcl@exe@ tclsh@exe@
-$(PBC_TO_EXE):
- $(MAKE) $(BUILD_DIR) ./pbc_to_exe@exe@
-
test: tcl.pbc
- $(PERL) t/harness
+ $(PERL) -I$(TOOLS_DIR)/lib t/harness
spectest: tcl.pbc
$(PERL) tools/tcl_test.pl
@@ -215,7 +190,9 @@ realclean: clean
distclean: realclean
-# regenerate the Makefile
-Makefile: config/makefiles/root.in
- cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages --languages=tcl
+# regenerate the Makefiles
+Makefile: config/makefiles/root.in config/makefiles/pmc.in config/makefiles/ops.in
+ $(RECONFIGURE) config/makefiles/root.in Makefile
+ $(RECONFIGURE) config/makefiles/pmc.in $(PMCDIR)/Makefile
+ $(RECONFIGURE) config/makefiles/ops.in $(OPSDIR)/Makefile
View
@@ -0,0 +1 @@
+This directory holds dynamic extensions for Partcl.
View
@@ -431,15 +431,15 @@ do_wrapper:
pir.'emit'(".HLL 'Tcl'")
pir.'emit'(".loadlib 'tcl_ops'")
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 .= result
pir.'emit'(' .return(%0)', ret)
pir.'emit'('.end')
pir.'emit'(<<"END_PIR")
.sub '_init' :init
- load_bytecode 'languages/tcl/runtime/tcllib.pir'
+ load_bytecode 'runtime/tcllib.pir'
.end
END_PIR
Oops, something went wrong.

0 comments on commit 72b645a

Please sign in to comment.