"Brent Dax" <[EMAIL PROTECTED]> writes: > Steve Fink: > # > Following things were done: > # > - s,/,\${slash},g > # > # Ugh. How difficult would it be to have Configure do this rewriting > # automatically? (Or rewrite to whatever it is you need, instead)? This > # just clutters up the makefiles a little too much, IMO. > > Well... > > It's theoretically possible. However, it'll cause problems if we use > tools that require use of slashes on arguments (xcopy /e, for example, > which we might use to install modules at some point--and my > understanding is that VMS tools all use slashes exclusively). > > Either we substitute before we interpolate things into the Makefile, > which'll miss any interpolated slashes (like the ones in the variable > that defines which PMC classes are compiled in), or we do so after, > which will hit all interpolated slashes (including command-line > switches). We can't have it both ways.
I tried the first way: substitute before interpolation. This means all uservariables need to substitute slashes. Fortunatly there are not so many. > But VMS brings up another point--can we afford to use a simple > substitution at all? After all, they use a completely different syntax > for paths, right? How does VMS-make handle the directory case? > What seems far more promising to me is something in the cc wrapper we're > using. Similar wrappers for ld, ar, and the other build tools might be > in order. Nothing would please me more than a Makefile like: > > .c$(O): > $(PERL) tools/build/calltool.pl cc $@ $< > > parrot$(EXE): > $(PERL) tools/build/calltool.pl ld parrot$(EXE) > $(O_FILES) > > That could appear exactly the same in makefiles/root.in as in /Makefile. > All systems would use 'calltool.pl cc' to invoke the C compiler--it > wouldn't be 'calltool.pl cl' on Windows, or 'calltool.pl gcc' on > gcc-using systems. And 'calltool.pl' could convert paths on VMS or > Windows. But this means that calltool.pl must be generated by Configure. The diffrent Makerules are just hidden in calltool.pl. > *That* would make me a happy Configure hacker. :^) > > --Brent Dax <[EMAIL PROTECTED]> > Perl and Parrot hacker > > "Yeah, and my underwear is flame-retardant--that doesn't mean I'm gonna > set myself on fire to prove it." Anyway please test the revisited patch bye bö
? bcc5.diff ? r.diff Index: config/auto/sizes.pl =================================================================== RCS file: /cvs/public/parrot/config/auto/sizes.pl,v retrieving revision 1.7 diff -u -r1.7 sizes.pl --- config/auto/sizes.pl 27 Apr 2003 07:36:44 -0000 1.7 +++ config/auto/sizes.pl 23 Sep 2003 17:20:42 -0000 @@ -118,7 +118,7 @@ }; # clear int8_t on error - if($@) { + if($@ || !exists $results{hugeintval}) { Configure::Data->set('int8_t' => undef); next; } Index: config/gen/makefiles.pl =================================================================== RCS file: /cvs/public/parrot/config/gen/makefiles.pl,v retrieving revision 1.17 diff -u -r1.17 makefiles.pl --- config/gen/makefiles.pl 23 Jul 2003 14:38:23 -0000 1.17 +++ config/gen/makefiles.pl 23 Sep 2003 17:20:42 -0000 @@ -10,27 +10,27 @@ sub runstep { genfile('config/gen/makefiles/root.in', 'Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); genfile('config/gen/makefiles/classes.in', 'classes/Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); genfile('config/gen/makefiles/languages.in', 'languages/Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); genfile('config/gen/makefiles/jako.in', 'languages/jako/Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); genfile('config/gen/makefiles/miniperl.in', 'languages/miniperl/Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); genfile('config/gen/makefiles/scheme.in', 'languages/scheme/Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); genfile('config/gen/makefiles/perl6.in', 'languages/perl6/Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); genfile('config/gen/makefiles/imcc.in', 'languages/imcc/Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); genfile('config/gen/makefiles/bf.in', 'languages/bf/Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); genfile('config/gen/makefiles/befunge.in', 'languages/befunge/Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); genfile('config/gen/makefiles/ook.in', 'languages/ook/Makefile', - commentType => '#'); + commentType => '#', replace_slashes => 1); # set up docs/Makefile, partly based on the .ops in the root dir Index: config/gen/makefiles/imcc.in =================================================================== RCS file: /cvs/public/parrot/config/gen/makefiles/imcc.in,v retrieving revision 1.29 diff -u -r1.29 imcc.in --- config/gen/makefiles/imcc.in 12 Sep 2003 21:30:42 -0000 1.29 +++ config/gen/makefiles/imcc.in 23 Sep 2003 17:20:42 -0000 @@ -44,7 +44,7 @@ # do it for you. # ${make_set_make} - +MAKE_C = ${make_c} all : flags_dummy imcc${exe} @@ -53,7 +53,7 @@ @$(PERL) ../../tools/dev/cc_flags.pl ./CFLAGS echo $(CFLAGS) xx$(O) -c xx.c ../../$(PARROTLIB): - cd ..${slash}.. && $(MAKE) $(PARROTLIB) && cd languages${slash}imcc + $(MAKE_C) ../.. $(PARROTLIB) # The .flag files are needed because we are keeping some derived files in CVS, # which does not keep accurate timestamps on the files, relative to each other. Index: config/gen/makefiles/languages.in =================================================================== RCS file: /cvs/public/parrot/config/gen/makefiles/languages.in,v retrieving revision 1.4 diff -u -r1.4 languages.in --- config/gen/makefiles/languages.in 19 Sep 2003 05:44:01 -0000 1.4 +++ config/gen/makefiles/languages.in 23 Sep 2003 17:20:42 -0000 @@ -1,4 +1,6 @@ -MAKE = ${make} +PERL = ${perl} +${make_set_make} +MAKE_C = ${make_c} all : imcc regex befunge bf cola ook perl6 @echo "SKIPPED: scheme (nothing to make, but should not default to make test)" @@ -17,7 +19,7 @@ imcc: imcc.dummy imcc.dummy: - cd imcc && $(MAKE) && cd .. + $(MAKE_C) imcc imcc.test: cd imcc && $(MAKE) test && cd .. @@ -25,7 +27,7 @@ jako: jako.dummy imcc.dummy jako.dummy: - cd jako && $(MAKE) && cd .. + $(MAKE_C) jako jako.test: cd jako && $(MAKE) test && cd .. @@ -33,7 +35,10 @@ scheme: scheme.dummy scheme.dummy: - cd scheme && $(MAKE) && cd .. + $(MAKE_C) scheme + +scheme.test: + $(MAKE_C) scheme test scheme.test: cd scheme && $(MAKE) test && cd .. @@ -41,31 +46,31 @@ regex: regex.dummy regex.dummy: - cd regex && $(MAKE) && cd .. + $(MAKE_C) regex regex.test : - cd regex && $(MAKE) test && cd .. + $(MAKE_C) regex test befunge : befunge.dummy befunge.dummy: - cd befunge && $(MAKE) && cd .. + $(MAKE_C) befunge befunge.test: - cd befunge && $(MAKE) test && cd .. + $(MAKE_C) befunge test bf : bf.dummy bf.dummy: - cd bf && $(MAKE) && cd .. + $(MAKE_C) bf bf.test: - cd bf && $(MAKE) test && cd .. + $(MAKE_C) bf test cola : cola.dummy cola.dummy: - cd cola && $(MAKE) && cd .. + $(MAKE_C) cola cola.test: cd cola && $(MAKE) test && cd .. @@ -73,23 +78,23 @@ ook : ook.dummy ook.dummy: - cd ook && $(MAKE) && cd .. + $(MAKE_C) ook ook.test: - cd ook && $(MAKE) test && cd .. + $(MAKE_C) ook test perl6 : perl6.dummy perl6.dummy: - cd perl6 && $(MAKE) && cd .. + $(MAKE_C) perl6 perl6.test: - cd perl6 && $(MAKE) test && cd .. + $(MAKE_C) perl6 test clean: - cd imcc && $(MAKE) clean && cd .. - cd jako && $(MAKE) clean && cd .. - cd scheme && $(MAKE) clean && cd .. + $(MAKE_C) imcc clean + $(MAKE_C) jako clean + $(MAKE_C) scheme clean update: cvs -q update -dP Index: config/gen/makefiles/root.in =================================================================== RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v retrieving revision 1.122 diff -u -r1.122 root.in --- config/gen/makefiles/root.in 20 Sep 2003 07:35:07 -0000 1.122 +++ config/gen/makefiles/root.in 23 Sep 2003 17:20:43 -0000 @@ -186,6 +186,7 @@ # do it for you. # ${make_set_make} +MAKE_C = ${make_c} .c$(O) : @$(PERL) tools/dev/cc_flags.pl ./CFLAGS $(CC) $(CFLAGS) ${cc_o_out}$@ -c $< @@ -229,7 +230,7 @@ $(LIBPARROT) : $(O_FILES) $(MKDIR) blib blib/lib - $(AR_CR) ${ar_out}$@ $(O_FILES) + $(AR_CR) ${ar_out}$@ ${ar_extra} $(O_FILES) $(RANLIB) $@ blib/lib/libparrot$(SO) : $(O_FILES) @@ -326,7 +327,7 @@ ############################################################################### examples/assembly/mops.pbc : examples/assembly/mops.pasm - cd examples && cd assembly && $(MAKE) mops.pbc PERL=$(PERL) && cd .. && cd .. + $(MAKE_C) examples/assembly mops.pbc examples/assembly/mops.c : examples/assembly/mops.pbc pbc2c.pl $(PERL) pbc2c.pl examples/assembly/mops.pbc > examples/assembly/mops.c @@ -335,7 +336,7 @@ $(LINK) $(LINKFLAGS) ${ld_out}examples/assembly/mops${exe} examples/assembly/mops$(O) $(LIBPARROT) $(C_LIBS) examples/assembly/life.pbc : examples/assembly/life.pasm - cd examples && cd assembly && $(MAKE) life.pbc PERL=$(PERL) && cd .. && cd .. + $(MAKE_C) examples/assembly life.pbc examples/assembly/life.c : examples/assembly/life.pbc pbc2c.pl $(PERL) pbc2c.pl examples/assembly/life.pbc > examples/assembly/life.c @@ -524,23 +525,23 @@ exec_cpu.c: lib/Parrot/OpLib/core.pm $(INC)/jit_emit.h jit/${jitcpuarch}/core.jit ${exec_h} $(INC)/exec_dep.h $(PERL) jit2h.pl ${jitcpuarch} exec_cpu.c -docs : docs/.dummy +docs : docs.dummy -docs/.dummy : - cd docs && $(MAKE) && cd .. +docs.dummy : + $(MAKE_C) docs languages : languages.dummy languages.dummy : - cd languages && $(MAKE) && cd .. + $(MAKE_C) languages languages-test : - cd languages && $(MAKE) test && cd .. + $(MAKE_C) languages test # If anything in the classes directory is out of date, # then run `make` in sub-dir to rebuild only the out of date files. $(CLASS_O_FILES) : $(CLASS_PMC_FILES) $(NONGEN_HEADERS) - cd classes && $(MAKE) && cd .. + $(MAKE_C) classes $(IMCC_PROG) : $(LIBPARROT) \ @@ -548,9 +549,9 @@ languages/imcc/*.h \ languages/imcc/*.y \ languages/imcc/*.l - cd languages${slash}imcc && $(MAKE) && cd ..${slash}.. + $(MAKE_C) languages/imcc $(PERL) -MExtUtils::Command -e mv $(IMCC_PROG) $(TEST_PROG) - cd languages${slash}imcc && $(MAKE) && cd ..${slash}.. + $(MAKE_C) languages/imcc # the chmod doesn't work here, so move imcc and make it again :-( # $(PERL) -MExtUtils::Command -e chmod 0755 $(TEST_PROG) @@ -647,9 +648,9 @@ examples/assembly/mops${exe} examples/assembly/mops.c \ examples/assembly/mops$(O) examples/assembly/mops.pbc \ examples/mops/mops$(O) examples/mops/mops${exe} - cd docs && $(MAKE) clean && cd .. - cd classes && $(MAKE) clean && cd .. - cd languages && $(MAKE) clean && cd .. + $(MAKE_C) docs clean + $(MAKE_C) classes clean + $(MAKE_C) languages clean progclean: $(RM_F) $(O_FILES) \ @@ -658,7 +659,7 @@ $(PDB) pdb$(O) \ $(DIS) disassemble$(O) $(RM_RF) blib - cd classes && $(MAKE) progclean && cd .. + $(MAKE_C) classes progclean testclean : $(RM_F) t/op/*.pasm t/op/*.pbc t/op/*.out t/op/*.o t/op/*.stabs.s \ @@ -731,7 +732,7 @@ rpms : release sudo cp parrot-$(VERSION).tar.gz /usr/src/*/SOURCES sudo cp parrot.spec /usr/src/*/SPECS - cd /usr/src/*/SPECS && sudo rpm -ba parrot.spec + cd /usr/src/*/SPECS ${make_and} sudo rpm -ba parrot.spec ############################################################################### # Index: config/init/data.pl =================================================================== RCS file: /cvs/public/parrot/config/init/data.pl,v retrieving revision 1.14 diff -u -r1.14 data.pl --- config/init/data.pl 17 Sep 2003 19:13:21 -0000 1.14 +++ config/init/data.pl 23 Sep 2003 17:20:43 -0000 @@ -71,9 +71,12 @@ ar => $Config{ar}, ar_flags => 'cr', ar_out => '', # for Win32 + ar_extra => '', # for Borland C ranlib => $Config{ranlib}, make => $Config{make}, make_set_make => $Config{make_set_make}, + make_and => '&&', + make_c => '$(PERL) -e \'chdir shift @ARGV; system q{$(MAKE)}, @ARGV; exit $$? >> 8;\'', cp => 'cp', slash => '/', Index: config/init/hints.pl =================================================================== RCS file: /cvs/public/parrot/config/init/hints.pl,v retrieving revision 1.4 diff -u -r1.4 hints.pl --- config/init/hints.pl 28 Dec 2002 01:35:48 -0000 1.4 +++ config/init/hints.pl 23 Sep 2003 17:20:43 -0000 @@ -11,13 +11,16 @@ sub runstep { my $hints = "config/init/hints/" . lc($^O) . ".pl"; my $hints_used = 0; + print "[ "; if(-e $hints) { + print "$hints "; do $hints; die $@ if $@; $hints_used++; } $hints = "config/init/hints/local.pl"; if(-e $hints) { + print "$hints "; do $hints; die $@ if $@; $hints_used++; @@ -25,6 +28,7 @@ if ($hints_used == 0) { print "(no hints) "; } + print "]"; } 1; Index: config/init/hints/mswin32.pl =================================================================== RCS file: /cvs/public/parrot/config/init/hints/mswin32.pl,v retrieving revision 1.12 diff -u -r1.12 mswin32.pl --- config/init/hints/mswin32.pl 15 Sep 2003 16:32:03 -0000 1.12 +++ config/init/hints/mswin32.pl 23 Sep 2003 17:20:44 -0000 @@ -16,7 +16,8 @@ Configure::Data->set( rm_f => '$(PERL) -MExtUtils::Command -e rm_f', rm_rf => '$(PERL) -MExtUtils::Command -e rm_rf', - PQ => '"' + PQ => '"', + make_c=> '$(PERL) -e "chdir shift @ARGV; system \'$(MAKE)\', @ARGV; exit $$? >> 8;"' ); if( $is_msvc ) { @@ -59,12 +60,15 @@ if( $is_bcc ) { Configure::Data->set( o => '.obj', + a => '.lib', + so => '.dll', + cc => ${cc}, ccflags => '-O2 -w-8066 -DWIN32 -DNO_STRICT -DNDEBUG -D_CONSOLE', cc_o_out => '-o', cc_exe_out => '-e', cc_debug => '-v', - ld => 'bcc32.exe', + ld => ${cc}, ldflags => '', ld_out => '-e', cc_ldflags => '', @@ -72,8 +76,18 @@ ld_shared => '-WD', libs => 'import32.lib cw32.lib', + link => ${cc}, + linkflags => '', + cp => 'copy', - slash => '\\' + ar => 'tlib', + ar_flags => '', + ar_out => '', + ar_extra => '/au', + slash => '\\', + make_and => "\n\t", + + blib_lib_libparrot_a => 'blib\lib\libparrot.lib', ); } elsif( $is_mingw ) { Index: config/inter/pmc.pl =================================================================== RCS file: /cvs/public/parrot/config/inter/pmc.pl,v retrieving revision 1.10 diff -u -r1.10 pmc.pl --- config/inter/pmc.pl 26 Aug 2003 10:05:30 -0000 1.10 +++ config/inter/pmc.pl 23 Sep 2003 17:20:44 -0000 @@ -85,8 +85,9 @@ } # build list of libraries for link line in Makefile - (my $pmc_classes_o = $pmc_o ) =~ s/^| / classes\//g; - (my $pmc_classes_pmc = $pmc_list) =~ s/^| / classes\//g; + my $slash = Configure::Data->get('slash'); + (my $pmc_classes_o = $pmc_o ) =~ s/^| / classes${slash}/g; + (my $pmc_classes_pmc = $pmc_list) =~ s/^| / classes${slash}/g; # Gather the actual names (with MixedCase) of all of the # non-abstract built-in PMCs. Index: lib/Parrot/Configure/Step.pm =================================================================== RCS file: /cvs/public/parrot/lib/Parrot/Configure/Step.pm,v retrieving revision 1.15 diff -u -r1.15 Step.pm --- lib/Parrot/Configure/Step.pm 15 Sep 2003 16:32:07 -0000 1.15 +++ lib/Parrot/Configure/Step.pm 23 Sep 2003 17:20:46 -0000 @@ -140,6 +140,12 @@ last; } + if ($options{replace_slashes}) { + s{(/+)}{ + my $len = length $1; + my $slash = Configure::Data->get('slash'); + '/' x ($len/2) . ($len%2 ? $slash : ''); }eg; + } s{ \$\{(\w+)\} }{