Hi,

I spent the last day getting parrot running under Borland. The
attached patch is whats need to get linking and running make test on
both Windows/Borland and Linux/gcc. I'm not sure if its ready for
inclusion in the tree, but I want some feedback on the approach.

The main problem is that Borland can't build a single static library
(at least I did not find out) with two files of the same name. But
there are some name clashes: intlist.o and classes/intlist.o or
stacks.o and languages/imcc/stacks.o. I solved this by seperating
libparrot in three partial libs: classes/classes.a containing all
object-files of classes/ ; languages/imcc/imcc.a containing all
object-files of imcc and blib/lib/libparrot.a for all the rest. (This
names need cleanup; shouldn't they all go to blib/lib?). classes/ is
still build by its own Makefile, this should be integrated in the
root-Makefile, but thats another story.

Next problem is library interdependence. classes.a depends on
libparrot.a and libparrot.a depends on classes.a. This complicates
linking a bit. The gnu linker does not revisit previous files so the
link line has to contain something like 
libparrot.a classes.a libparrot.a
A new configure variable parrot_libs takes care of this

Last Windows does no expansion of *.t. Adding glob expansion of ARGV
to t/harness lets make test work again on windows. (I think this part
of the patch can be applied right away because the Irresulte tinderbox
has the same problem)

Comments
bö

? icu/source/test
Index: config/gen/makefiles/classes.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/classes.in,v
retrieving revision 1.10
diff -u -r1.10 classes.in
--- config/gen/makefiles/classes.in	12 Sep 2003 21:30:42 -0000	1.10
+++ config/gen/makefiles/classes.in	14 Oct 2003 17:53:36 -0000
@@ -1,4 +1,5 @@
 O = ${o}
+A = ${a}
 RM_F = ${rm_f}
 
 INC=../include/parrot
@@ -19,11 +20,18 @@
 PERL = ${perl}
 MAKE_F=${make}
 PMC2C=$(PERL) pmc2c.pl
+AR_CR = ${ar} ${ar_flags}
+RANLIB = ${ranlib}
 
 .c$(O):
 	$(CC) $(CFLAGS) ${cc_o_out}$@ -c $<
 
-all : $(O_FILES)
+all : classes$(A)
+
+classes$(A) : $(O_FILES)
+	$(RM_F) $@
+	$(AR_CR) ${ar_out}$@ ${ar_extra} $(O_FILES)
+	$(RANLIB) $@
 
 ${pmc_build}
 
Index: config/gen/makefiles/root.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
retrieving revision 1.146
diff -u -r1.146 root.in
--- config/gen/makefiles/root.in	14 Oct 2003 11:08:21 -0000	1.146
+++ config/gen/makefiles/root.in	14 Oct 2003 17:53:36 -0000
@@ -168,9 +168,8 @@
 	nci$(O) cpu_dep$(O) ${asmfun_o} tsq$(O) longopt$(O) events$(O) \
 	dynext$(O) utils$(O) vtables$(O) mmd$(O) extend$(O)
 
-O_FILES = $(INTERP_O_FILES) $(IO_O_FILES) $(CLASS_O_FILES) \
-	$(ENCODING_O_FILES) $(CHARTYPE_O_FILES) \
-	$(IMCC_O_FILES)
+O_FILES = $(INTERP_O_FILES) $(IO_O_FILES) \
+	$(ENCODING_O_FILES) $(CHARTYPE_O_FILES)
 
 OPS_FILES = ${ops} $(GEN_OPSFILES)
 
@@ -205,7 +204,10 @@
 
 TEST_PROG = ${test_prog}${exe}
 TEST_PROG_SO = ${test_prog}_so${exe}
+PARROT_LIBS = ${parrot_libs}
 LIBPARROT = ${blib_lib_libparrot_a}
+LIBCLASSES = classes/classes$(A)
+LIBIMCC = $(IMCC_DIR)/imcc$(A)
 # utils
 DIS=disassemble${exe}
 PDUMP = pdump${exe}
@@ -255,8 +257,8 @@
 
 mops : examples/assembly/mops${exe} examples/mops/mops${exe}
 
-$(TEST_PROG) : $(PARROT_MAIN)$(O) $(GEN_HEADERS) $(LIBPARROT) lib/Parrot/OpLib/core.pm
-	$(LINK) ${ld_out}$(TEST_PROG) $(LINKFLAGS) $(PARROT_MAIN)$(O) $(LIBPARROT) $(C_LIBS)
+$(TEST_PROG) : $(PARROT_MAIN)$(O) $(GEN_HEADERS) $(LIBPARROT) $(LIBIMCC) $(LIBCLASSES) lib/Parrot/OpLib/core.pm
+	$(LINK) ${ld_out}$(TEST_PROG) $(LINKFLAGS) $(PARROT_MAIN)$(O) $(PARROT_LIBS) $(C_LIBS)
 
 lib_deps_object : $(O_FILES)
 	$(PERL) tools/dev/lib_deps.pl object $(O_FILES)
@@ -338,8 +340,8 @@
 
 pdb$(O) : $(GENERAL_H_FILES)
 
-$(PDB) : pdb$(O) $(LIBPARROT)
-	$(LINK) ${ld_out}$(PDB) pdb$(O) $(LINKFLAGS) $(LIBPARROT) $(C_LIBS)
+$(PDB) : pdb$(O) $(LIBPARROT) $(LIBCLASSES)
+	$(LINK) ${ld_out}$(PDB) pdb$(O) $(LINKFLAGS) $(PARROT_LIBS) $(C_LIBS)
 
 #
 # Parrot Disassembler
@@ -347,20 +349,20 @@
 
 disassemble$(O) : $(GENERAL_H_FILES)
 
-$(DIS) : disassemble$(O) $(LIBPARROT)
-	$(LINK) ${ld_out}$(DIS) disassemble$(O) $(LINKFLAGS) $(LIBPARROT) $(C_LIBS)
+$(DIS) : disassemble$(O) $(LIBPARROT) $(LIBCLASSES)
+	$(LINK) ${ld_out}$(DIS) disassemble$(O) $(LINKFLAGS) $(PARROT_LIBS) $(C_LIBS)
 
 #
 # Parrot Dump
 #
 
-$(PDUMP) : pdump$(O) packdump$(O) $(LIBPARROT)
-	$(LINK) ${ld_out}$(PDUMP) pdump$(O) packdump$(O) $(LINKFLAGS) $(LIBPARROT) $(C_LIBS)
+$(PDUMP) : pdump$(O) packdump$(O) $(LIBPARROT) $(LIBCLASSES)
+	$(LINK) ${ld_out}$(PDUMP) pdump$(O) packdump$(O) $(LINKFLAGS) $(PARROT_LIBS) $(C_LIBS)
 
 
 # pbc_info
-$(PINFO) : pbc_info$(O) $(LIBPARROT)
-	$(LINK) ${ld_out}$(PINFO) pbc_info$(O) $(LINKFLAGS) $(LIBPARROT) $(C_LIBS)
+$(PINFO) : pbc_info$(O) $(LIBPARROT) $(LIBCLASSES)
+	$(LINK) ${ld_out}$(PINFO) pbc_info$(O) $(LINKFLAGS) $(PARROT_LIBS) $(C_LIBS)
 
 ###############################################################################
 #
@@ -388,8 +390,8 @@
 examples/assembly/mops.c : examples/assembly/mops.pbc pbc2c.pl
 	$(PERL) pbc2c.pl examples/assembly/mops.pbc > examples/assembly/mops.c
 
-examples/assembly/mops${exe} : examples/assembly/mops$(O) $(LIBPARROT)
-	$(LINK) $(LINKFLAGS) ${ld_out}examples/assembly/mops${exe} examples/assembly/mops$(O) $(LIBPARROT) $(C_LIBS)
+examples/assembly/mops${exe} : examples/assembly/mops$(O) $(LIBPARROT) $(LIBCLASSES) $(LIBIMCC)
+	$(LINK) $(LINKFLAGS) ${ld_out}examples/assembly/mops${exe} examples/assembly/mops$(O) $(PARROT_LIBS) $(C_LIBS)
 
 examples/assembly/life.pbc : examples/assembly/life.pasm
 	$(MAKE_C) examples/assembly life.pbc
@@ -397,8 +399,8 @@
 examples/assembly/life.c : examples/assembly/life.pbc pbc2c.pl
 	$(PERL) pbc2c.pl examples/assembly/life.pbc > examples/assembly/life.c
 
-examples/assembly/life${exe} : examples/assembly/life$(O) $(LIBPARROT)
-	$(LINK) $(LINKFLAGS) ${ld_out}examples/assembly/life${exe} examples/assembly/life$(O) $(LIBPARROT) $(C_LIBS)
+examples/assembly/life${exe} : examples/assembly/life$(O) $(LIBPARROT) $(LIBCLASSES) $(LIBIMCC)
+	$(LINK) $(LINKFLAGS) ${ld_out}examples/assembly/life${exe} examples/assembly/life$(O) $(PARROT_LIBS) $(C_LIBS)
 
 ###############################################################################
 #
@@ -410,7 +412,7 @@
 
 examples/mops/mops${exe} : examples/mops/mops$(O)
 	$(LINK) $(LINKFLAGS) ${ld_out}examples/mops/mops${exe} \
-	examples/mops/mops$(O) $(LIBPARROT) $(C_LIBS)
+	examples/mops/mops$(O) $(PARROT_LIBS) $(C_LIBS)
 
 
 ###############################################################################
@@ -608,6 +610,10 @@
 
 $(IMCC_O_FILES) : $(IMCC_H_FILES) $(ALL_H_FILES)
 
+$(LIBIMCC) : $(IMCC_O_FILES)
+	$(RM_RF) $@
+	$(AR_CR) ${ar_out}$@ ${ar_extra} $(IMCC_O_FILES)
+	$(RANLIB) $@
 
 ################ docs, test and maintainer targets
 
@@ -629,6 +635,7 @@
 $(CLASS_O_FILES) : $(CLASS_PMC_FILES) $(NONGEN_HEADERS)
 	$(MAKE_C) classes
 
+$(LIBCLASSES) : $(CLASS_O_FILES)
 
 ###############################################################################
 #
@@ -833,7 +840,7 @@
 ###############################################################################
 
 exec : exec_start$(O) $(LIBPARROT)
-	$(LINK) ${ld_out}$(EXEC) $(LINKFLAGS) $(EXEC)$(O) exec_start$(O) $(LIBPARROT) $(C_LIBS)
+	$(LINK) ${ld_out}$(EXEC) $(LINKFLAGS) $(EXEC)$(O) exec_start$(O) $(PARROT_LIBS) $(C_LIBS)
 
 exec_so : exec_start$(O) blib/lib/libparrot$(SO)
 	$(LINK) ${ld_out}$(EXEC) $(LINKFLAGS) $(EXEC)$(O) exec_start$(O) -lparrot $(C_LIBS) -pthread
Index: config/init/data.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/data.pl,v
retrieving revision 1.15
diff -u -r1.15 data.pl
--- config/init/data.pl	2 Oct 2003 12:01:19 -0000	1.15
+++ config/init/data.pl	14 Oct 2003 17:53:36 -0000
@@ -63,6 +63,7 @@
 
     # should we have a dependancy upon arc to generate .a's?
     blib_lib_libparrot_a => 'blib/lib/libparrot$(A)',
+    parrot_libs   => 'blib/lib/libparrot$(A) classes/classes$(A) blib/lib/libparrot$(A) languages/imcc/imcc$(A)',
 
     perl          => $^X,
     test_prog     => 'parrot',
Index: config/init/hints/mswin32.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/hints/mswin32.pl,v
retrieving revision 1.14
diff -u -r1.14 mswin32.pl
--- config/init/hints/mswin32.pl	2 Oct 2003 12:01:21 -0000	1.14
+++ config/init/hints/mswin32.pl	14 Oct 2003 17:53:36 -0000
@@ -63,7 +63,7 @@
                         a => '.lib',
                         so => '.dll',
                         cc => ${cc},
-			ccflags => '-O2 -w-8066 -DWIN32 -DNO_STRICT -DNDEBUG -D_CONSOLE',
+                        ccflags => '-q -O2 -w-8066 -DWIN32 -DNO_STRICT -DNDEBUG -D_CONSOLE',
 			cc_o_out => '-o',
 			cc_exe_out => '-e',
 			cc_debug => '-v',
@@ -83,7 +83,7 @@
                         ar => 'tlib',
                         ar_flags => '',
                         ar_out => '',
-                        ar_extra => '/au',
+                        ar_extra => '/a',
                         slash => '\\',
                         make_and => "\n\t",
 
Index: lib/Parrot/Test.pm
===================================================================
RCS file: /cvs/public/parrot/lib/Parrot/Test.pm,v
retrieving revision 1.46
diff -u -r1.46 Test.pm
--- lib/Parrot/Test.pm	2 Oct 2003 16:15:23 -0000	1.46
+++ lib/Parrot/Test.pm	14 Oct 2003 17:53:36 -0000
@@ -209,8 +209,8 @@
       print SOURCE $source;
       close SOURCE;
 
-      my $libparrot = $PConfig{blib_lib_libparrot_a};
-      $libparrot =~ s/\$\(A\)/$PConfig{a}/;
+      my $parrot_libs = "$PConfig{parrot_libs}";
+      $parrot_libs =~ s/\$\(A\)/$PConfig{a}/g;
 
       my ($cmd, $exit_code);
       $cmd = "$PConfig{cc} $PConfig{ccflags} $PConfig{cc_debug} -I./include -c " .
@@ -219,7 +219,7 @@
       $Builder->diag("'$cmd' failed with exit code $exit_code") if $exit_code;
 
       $cmd = "$PConfig{link} $PConfig{linkflags} $PConfig{ld_debug} $obj_f " .
-             "$PConfig{ld_out}$exe_f $libparrot $PConfig{libs}";
+             "$PConfig{ld_out}$exe_f $parrot_libs $PConfig{libs}";
       $exit_code = _run_command($cmd, 'STDOUT' => $build_f, 'STDERR' => $build_f);
       $Builder->diag("'$cmd' failed with exit code $exit_code") if $exit_code;
 
Index: t/harness
===================================================================
RCS file: /cvs/public/parrot/t/harness,v
retrieving revision 1.14
diff -u -r1.14 harness
--- t/harness	28 Jan 2003 10:17:00 -0000	1.14
+++ t/harness	14 Oct 2003 17:53:36 -0000
@@ -19,5 +19,7 @@
 @ARGV = grep $_ ne 'quick', @ARGV;
 
 # Pass in a list of tests to run on the command line, else run all the tests.
-my @tests = @ARGV ? @ARGV : map { glob( "t/$_/*.t" ) } ( qw(src op pmc native_pbc) );
+my @tests = @ARGV
+            ? map { glob $_ } @ARGV
+            : map { glob( "t/$_/*.t" ) } qw(src op pmc native_pbc) ;
 runtests(@tests);

Reply via email to