-*- diff -*- The reason for the problem to make shared libparrot with an already installed shared libparrot is simple and has several reasons: 1. libs belongs to the end. first LDFLAGS, then LD_LOAD_FLAGS, then libparrot, then LIBS + EXTRALIBS. dynpmc got this wrong. It had LIBS at the front. a. One should not put libs before the LDFLAGS. b. One should reverse the LIBS line in order of dependencies. We have the problem that the libs line is generated automatically and may contain -L/usr/lib (pulled in from libicu) and -L/usr/local/lib, so the already installed -lparrot will be found. So our -Lblib/lib should be at the front, best in LDFLAGS. Note that parrot.pc got that right: Libs: -L${libdir} -lparrot @icu_shared@ @libs@ 2. remove the perl5 -L/usr/local/lib LDFLAGS which would pull in a shared /usr/local/lib/libparrot.so before checking -Lblib/lib -lparrot. One fix could be to check this in Configure and move all -L from LDFLAGS to the LIBS flag at the front. I went this way. The other fix would be to explicitly link to blib/lib/libparrot.so, without -L path hacks. 3. Now an already installed libparrot.dll/.so does not conflict with make anymore. The remaining problem is at make installable esp. for the languages and already installed /usr/lib/parrot, /usr/include/parrot and /usr/lib/libparrot.dll.a This patch adds PATH resp. LD_RUN_PATH to the parrot invocations, similar as in perl5. It moves a -L from @ldflags@ to @libs@ in config. It also adds emacs/vim modes to the Makefiles. It also adds Makefile targets to regenerate the Makefiles automatically. Index: parrot-svn/config/gen/makefiles/dynpmc_pl.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/dynpmc_pl.in +++ parrot-svn/config/gen/makefiles/dynpmc_pl.in @@ -81,8 +81,15 @@ sub partial_link_cmd { my $liblist; if ($^O =~ /mswin32/i) { - # Need to put various libraries in the link line. - $liblist = join( ' ', map { "$_.lib" } keys %$libs ); + # Note that we may need to look in the Parrot blib directory first. + if ($CC =~ /gcc/i) { + $liblist = qq{ -Wl,-L "@build_dir@/blib/lib"}; + } + else { + $liblist = qq{ /LIBPATH:"@build_dir@/blib/lib"}; + } + # Need to add various libraries in the link line. + $liblist .= join( ' ', map { "$_.lib" } keys %$libs ); if ($CC =~ /gcc/i) { $liblist =~ s/libgdbm\.lib/-llibgdbm/i; } @@ -90,14 +97,6 @@ sub partial_link_cmd { $extraLibs =~ s/blib/..\\blib/g; $extraLibs =~ s/\Q$(A)\E/.lib/g; $liblist .= ' ' . $extraLibs; - - # Also note that we may need to look in the Parrot blib directory. - if ($CC =~ /gcc/i) { - $liblist .= qq{ -Wl,-L "@build_dir@/blib/lib"}; - } - else { - $liblist .= qq{ /LIBPATH:"@build_dir@/blib/lib"}; - } } else { $liblist = join( ' ', map { "-l$_" } keys %$libs ); @@ -109,11 +108,14 @@ sub partial_link_cmd { push @$sources, split ",", $ENV{DYNPMC_LINK}; } + # LDFLAGS, LIBS or ICU_SHARED may contain -L/usr/lib or -L/usr/local/lib + # falsely favoring an already installed libparrot.{so,dll}. So put liblist + # to the end. return "$LD ". '@ld_out@' . $target . " " . join(" ", map {"$PATHQUOTE$_$PATHQUOTE"} @$sources) . - " $liblist $LDFLAGS $LD_LOAD_FLAGS $PATHQUOTE$LIBPARROT$PATHQUOTE"; + " $LDFLAGS $LD_LOAD_FLAGS $PATHQUOTE$LIBPARROT$PATHQUOTE $liblist"; } our $NOW = time(); Index: parrot-svn/config/gen/makefiles/dynpmc.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/dynpmc.in +++ parrot-svn/config/gen/makefiles/dynpmc.in @@ -72,3 +72,9 @@ realclean: clean distclean: realclean svnclean: realclean + +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/gen/makefiles/nqp.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/nqp.in +++ parrot-svn/config/gen/makefiles/nqp.in @@ -4,6 +4,9 @@ PERL = @perl@ RM_F = @rm_f@ PARROT = ../../parrot@exe@ +RECONFIGURE = $(PERL) @build_dir@/tools/dev/reconfigure.pl + + PARROT_LIBRARY = @build_dir@/runtime/parrot/library PGE_LIBRARY = @build_dir@/runtime/parrot/library/PGE @@ -26,11 +29,15 @@ nqp.pbc: $(PARROT) $(PGE_LIBRARY)/Perl6G boot: $(BOOTSRC) $(PARROT) nqp.pbc \ - --output=bootstrap/gen_actions.pir \ - --target=pir \ - bootstrap/actions.pm + --output=bootstrap/gen_actions.pir \ + --target=pir \ + bootstrap/actions.pm $(PARROT) --output-pbc -o bootstrap/nqp.pbc bootstrap/nqp.pir +# regenerate the Makefile +Makefile: @build_dir@/config/gen/makefiles/nqp.in + cd @build_dir@ && $(RECONFIGURE) --step=gen::makefiles --target=compilers/nqp/Makefile + # This is a listing of all targets, that are meant to be called by users help: @echo "" @@ -71,3 +78,9 @@ realclean: clean $(RM_F) Makefile distclean: realclean + +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/gen/makefiles/parrot_embed.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/parrot_embed.in +++ parrot-svn/config/gen/makefiles/parrot_embed.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, The Perl Foundation. +# Copyright (C) 2007, The Perl Foundation. -*- cperl -*- # $Id: parrot_embed.in 17688 2007-03-22 08:48:04Z fperrad $ # use Cwd; @@ -43,7 +43,9 @@ package MY; sub postamble { - "t/greet.pbc:\n\t$config{PARROT} -o t/greet.pbc t/greet.pir\n"; + "t/greet.pbc:\n\t$config{PARROT} -o t/greet.pbc t/greet.pir\n" + ."#\n# Local variables:\n# mode: makefile\n" + ."# ex: ft=make\n# End:\n"; } sub test @@ -64,3 +66,10 @@ sub dynamic_lib $inherited =~ s{($sub_target)}{$1 t/greet.pbc}; $inherited; } + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Index: parrot-svn/config/gen/makefiles/pct.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/pct.in +++ parrot-svn/config/gen/makefiles/pct.in @@ -9,6 +9,9 @@ TOOL_DIR = ../.. PGE_DIR = ../../compilers/pge TEST_DIR = ../../t/compilers/pct CP = @cp@ +RECONFIGURE = $(PERL) @build_dir@/tools/dev/reconfigure.pl + + # Where to put things PARROT_LIBRARY = ../../runtime/parrot/library @@ -30,7 +33,7 @@ PCT_SOURCES = \ src/POST/Node.pir # the default target -all: $(PARROT_LIBRARY)/PCT.pbc +all: $(PARROT_LIBRARY)/PCT.pbc Makefile $(PARROT_LIBRARY)/PCT.pbc: $(PARROT) $(PCT_SOURCES) $(PARROT) -o $(PARROT_LIBRARY)/PCT.pbc --output-pbc PCT.pir @@ -38,6 +41,10 @@ $(PARROT_LIBRARY)/PCT.pbc: $(PARROT) $(P $(PARROT) -o $(PARROT_LIBRARY)/PCT/Grammar.pbc --output-pbc src/PCT/Grammar.pir $(PARROT) -o $(PARROT_LIBRARY)/PCT/HLLCompiler.pbc --output-pbc src/PCT/HLLCompiler.pir +# regenerate the Makefile +Makefile: @build_dir@/config/gen/makefiles/pct.in + cd @build_dir@ && $(RECONFIGURE) --step=gen::makefiles --target=compilers/pct/Makefile + # This is a listing of all targets, that are meant to be called by users help: @echo "" @@ -72,3 +79,9 @@ realclean: clean $(RM_F) Makefile distclean: realclean + +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/gen/makefiles/pge.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/pge.in +++ parrot-svn/config/gen/makefiles/pge.in @@ -7,12 +7,15 @@ RM_F = @rm_f@ PARROT = ../../parrot@exe@ TOOL_DIR = ../.. CP = @cp@ +RECONFIGURE = $(PERL) @build_dir@/tools/dev/reconfigure.pl + + # Where to put things PARROT_LIBRARY = ../../runtime/parrot/library # the default target -all: $(PARROT_LIBRARY)/PGE.pbc +all: $(PARROT_LIBRARY)/PGE.pbc Makefile SOURCES = PGE.pir \ PGE/Exp.pir \ @@ -30,10 +33,14 @@ PGE.pbc: $(PARROT) $(SOURCES) $(RM_F) PGE.pbc $(PARROT_LIBRARY)/PGE.pbc $(PERL) -e "" >PGE/builtins_gen.pir $(PARROT) -o PGE.pbc --output-pbc PGE.pir - $(PARROT) $(PARROT_LIBRARY)/PGE/Perl6Grammar.pir --output=PGE/builtins_gen.pir PGE/builtins.pg + $(PARROT) $(PARROT_LIBRARY)/PGE/Perl6Grammar.pir --output=PGE/builtins_gen.pir PGE/builtins.pg $(RM_F) PGE.pbc $(PARROT) -o PGE.pbc --output-pbc PGE.pir +# regenerate the Makefile +Makefile: @build_dir@/config/gen/makefiles/pge.in + cd @build_dir@ && $(RECONFIGURE) --step=gen::makefiles --target=compilers/pge/Makefile + # This is a listing of all targets, that are meant to be called by users help: @echo "" @@ -75,3 +82,9 @@ realclean: clean $(RM_F) Makefile distclean: realclean + +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/gen/makefiles/pirc.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/pirc.in +++ parrot-svn/config/gen/makefiles/pirc.in @@ -8,6 +8,8 @@ PARROT = ../../parrot@exe@ TOOL_DIR = ../.. CC = @cc@ CP = @cp@ +POD2HTML = pod2html +PODCHECKER = podchecker BUILD = $(PERL) @build_dir@/tools/build/dynpmc.pl O = @o@ EXE = @exe@ @@ -54,7 +56,7 @@ new/pirregalloc$(O) # the default target -all: pirc$(EXE) +all: pirc$(EXE) heredoc macro Makefile pirc$(EXE): $(OBJS) @@ -95,3 +97,9 @@ pirc$(EXE) \ doc/*.html distclean: realclean + +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/gen/makefiles/tge.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/tge.in +++ parrot-svn/config/gen/makefiles/tge.in @@ -6,13 +6,16 @@ PERL = @perl@ RM_F = @rm_f@ PARROT = ../../parrot@exe@ +RECONFIGURE = $(PERL) @build_dir@/tools/dev/reconfigure.pl + + # Where to put things PARROT_LIBRARY = ../../runtime/parrot/library PERL6GRAMMAR = $(PARROT_LIBRARY)/PGE/Perl6Grammar.pbc # the default target -all: $(PARROT_LIBRARY)/TGE.pbc +all: $(PARROT_LIBRARY)/TGE.pbc Makefile $(PARROT_LIBRARY)/TGE.pbc: TGE.pir TGE/Rule.pbc TGE/Parser.pbc TGE/Grammar.pbc TGE/Compiler.pbc TGE/Tree.pbc $(PARROT) -o $(PARROT_LIBRARY)/TGE.pbc --output-pbc TGE.pir @@ -21,7 +24,11 @@ $(PARROT_LIBRARY)/TGE.pbc: TGE.pir TGE/R $(PARROT) -o $@ --output-pbc $< TGE/Parser.pir: TGE/Parser.pg - $(PARROT) $(PERL6GRAMMAR) --output=TGE//Parser.pir TGE//Parser.pg + $(PARROT) $(PERL6GRAMMAR) --output=TGE/Parser.pir TGE/Parser.pg + +# regenerate the Makefile +Makefile: @build_dir@/config/gen/makefiles/tge.in + cd @build_dir@ && $(RECONFIGURE) --step=gen::makefiles --target=compilers/tge/Makefile # This is a listing of all targets, that are meant to be called by users help: @@ -62,3 +69,9 @@ realclean: clean $(RM_F) Makefile distclean: realclean + +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/gen/makefiles/editor.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/editor.in +++ parrot-svn/config/gen/makefiles/editor.in @@ -11,10 +11,15 @@ PERL = @perl@ CP = @cp@ MKPATH = @mkpath@ RM_F = @rm_f@ +RECONFIGURE = $(PERL) @build_dir@/tools/dev/reconfigure.pl default: all -all: pir.vim imc.kate +all: pir.vim imc.kate Makefile + +# regenerate the Makefile +Makefile: @build_dir@/config/gen/makefiles/editor.in + cd @build_dir@ && $(RECONFIGURE) --step=gen::makefiles --target=editor/Makefile # This is a listing of all targets, that are meant to be called by users help : @@ -66,3 +71,9 @@ clean: realclean: clean $(RM_F) Makefile + +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/gen/makefiles/ext.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/ext.in +++ parrot-svn/config/gen/makefiles/ext.in @@ -28,7 +28,14 @@ help: @echo " This is the default." @echo " test: Unified test suite for a lot of languages." @echo "" + @echo " installable: Create self-hosting bins and libs." + @echo "" + @echo " test-installable: Test self-hosting bins and libs." + @echo "" + @echo " install: Make install for a lot of languages." + @echo "" @echo " clean: Clean up a lot of languages." + @echo " realclean: Clean up and remove Makefiles." @echo "" @echo " help: Print this help message." @echo "" @@ -40,11 +47,14 @@ help: @echo "" @echo "Following languages are available:" @echo " $(LANGUAGES)" - @echo "A particular language can be built, tested and cleand up" @echo " make " @echo " make .test" + @echo " make .installable" + @echo " make .test-installable" + @echo " make .install" @echo " make .clean" - @echo "For the status of individual languages see LANGUAGES.STATUS.pod" + @echo " make .realclean" + @echo "For the status of individual languages see LANGUAGES_STATUS.pod" @echo "" clean: \ @@ -66,3 +76,8 @@ Parrot-Embed.clean: #CONDITIONED_LINE(win32): - cd Parrot-Embed && nmake clean #INVERSE_CONDITIONED_LINE(win32): - cd Parrot-Embed && $(MAKE) clean +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/gen/makefiles/json.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/json.in +++ parrot-svn/config/gen/makefiles/json.in @@ -3,13 +3,20 @@ PERL = @perl@ RM_F = @rm_f@ PARROT = ../../parrot@exe@ +RECONFIGURE = $(PERL) @build_dir@/tools/dev/reconfigure.pl + + TOOL_DIR = ../.. PGE_DIR = ../../compilers/pge TGE_DIR = ../../compilers/tge # the default target -all: JSON.pbc +all: JSON.pbc Makefile + +# regenerate the Makefile +Makefile: @build_dir@/config/gen/makefiles/json.in + cd @build_dir@ && $(RECONFIGURE) --step=gen::makefiles --target=compilers/json/Makefile # This is a listing of all targets, that are meant to be called by users help: @@ -52,3 +59,9 @@ JSON/pge2pir.pir : JSON/pge2pir.tg clean : testclean @rm_f@ "JSON/*.pbc" "JSON/*.pir" JSON.pbc + +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/gen/makefiles/root.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/root.in +++ parrot-svn/config/gen/makefiles/root.in @@ -106,6 +106,8 @@ RECONFIGURE = $(PERL) tools/dev/rec INNO_SETUP = iscc JIT_BUILD_TOOL = $(BUILD_TOOLS_DIR)/jit2c.pl #CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@ +#CONDITIONED_LINE(cygchkdll):SHRPENV = env PATH="@build_dir@/blib/lib:$(PATH)" +#INVERSE_CONDITIONED_LINE(cygchkdll):SHRPENV = env LD_RUN_PATH="@build_dir@/blib/lib" ############################################################################### # @@ -534,10 +536,10 @@ MAKE = @make_c@ # here, though. Ignored on Mac OS X, at least. .pir.pbc : - $(PARROT) -o $@ $< + $(SHRPENV) $(PARROT) -o $@ $< .pbc$(O) : - $(PARROT) -o $@ $< + $(SHRPENV) $(PARROT) -o $@ $< ############################################################################### @@ -768,12 +770,12 @@ flags_dummy : @$(PERL) tools/dev/cc_flags.pl $(CUR_DIR)/CFLAGS echo $(CC) $(CFLAGS) -I$(@D) @cc_o_out@ xx$(O) -c xx.c runtime/parrot/include/parrotlib.pbc: runtime/parrot/library/parrotlib.pir $(PARROT) - $(PARROT) -o $@ runtime/parrot/library/parrotlib.pir + $(SHRPENV) $(PARROT) -o $@ runtime/parrot/library/parrotlib.pir runtime/parrot/include/config.fpmc : myconfig config_lib.pasm $(MINIPARROT) - @cygchkdll@ +#CONDITIONED_LINE(cygchkdll): $(SHRPENV) @cygchkdll@ @echo Invoking Parrot to generate runtime/parrot/include/config.fpmc --cross your fingers - $(MINIPARROT) config_lib.pasm > $@ + $(SHRPENV) $(MINIPARROT) config_lib.pasm > $@ $(PARROT) : $(SRC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) CFLAGS \ lib/Parrot/OpLib/core.pm $(SRC_DIR)/parrot_config$(O) \ @@ -788,12 +790,12 @@ pbc_to_exe.pir : $(PARROT) tools/dev/pbc > pbc_to_exe.pir $(PBC_TO_EXE) : pbc_to_exe.pir $(PARROT) - $(PARROT) -o pbc_to_exe.pbc pbc_to_exe.pir - $(PARROT) pbc_to_exe.pir pbc_to_exe.pbc + $(SHRPENV) $(PARROT) -o pbc_to_exe.pbc pbc_to_exe.pir + $(SHRPENV) $(PARROT) pbc_to_exe.pir pbc_to_exe.pbc $(PARROT_CONFIG) : tools/util/parrot-config.pir $(PARROT) $(PBC_TO_EXE) - $(PARROT) -o parrot_config.pbc tools/util/parrot-config.pir - $(PARROT) pbc_to_exe.pbc parrot_config.pbc + $(SHRPENV) $(PARROT) -o parrot_config.pbc tools/util/parrot-config.pir + $(SHRPENV) $(PARROT) pbc_to_exe.pbc parrot_config.pbc # HLL Executable targets #CONDITIONED_LINE(win32):perl6 : $(PERL6) @@ -802,7 +804,7 @@ $(PERL6) : compilers $(PBC_TO_EXE) $(MAKE) languages/perl6 perl6$(EXE) $(CP) languages/perl6/perl6$(EXE) $(PERL6) $(CHMOD) 0755 $(PERL6) - $(PERL6) -e"say 'Hello, world.'" + $(SHRPENV) $(PERL6) -e"say 'Hello, world.'" # TODO build the real miniparrot @@ -814,10 +816,10 @@ $(MINIPARROT) : $(SRC_DIR)/main$(O) $(GE $(INSTALLABLEPARROT) : $(SRC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) \ lib/Parrot/OpLib/core.pm $(SRC_DIR)/install_config$(O) \ - $(PARROT) + $(SHRPENV) $(PARROT) $(LINK) @ld_out@$@ \ - $(SRC_DIR)/main$(O) \ - $(ALL_PARROT_LIBS) $(LINKFLAGS) $(SRC_DIR)/install_config$(O) + $(SRC_DIR)/main$(O) $(SRC_DIR)/install_config$(O) \ + $(ALL_PARROT_LIBS) $(LINKFLAGS) #CONDITIONED_LINE(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;1 $(INC_DIR)/parrot.h : $(INC_DIR)/pbcversion.h $(INC_DIR)/vtable.h @@ -843,7 +845,7 @@ $(SRC_DIR)/null_config.c : myconfig $(BU install_config.fpmc : myconfig config_lib.pasm $(PARROT) @echo "Invoking Parrot to generate install_config.fpmc" - $(PARROT) config_lib.pasm --install > $@ + $(SHRPENV) $(PARROT) config_lib.pasm --install > $@ $(SRC_DIR)/parrot_config$(O) : $(SRC_DIR)/parrot_config.c @@ -888,7 +890,7 @@ $(LIBPARROT_STATIC) : $(O_FILES) $(LIBPARROT_SHARED) : $(O_FILES) $(MKPATH) @blib_dir@ $(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) @ld_out@$@ @libparrot_soname@ \ -#CONDITIONED_LINE(cygchkdll): -Wl,--out-implib=blib/lib/libparrot.dll.a \ +#CONDITIONED_LINE(cygchkdll): -Wl,--out-implib=libparrot.dll.a \ $(O_FILES) $(C_LIBS) $(ICU_SHARED) #CONDITIONED_LINE(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;2 #CONDITIONED_LINE(libparrot_shared_alias): ( cd @blib_dir@ ; ln -sf @libparrot_shared@ @libparrot_shared_alias@ ) @@ -1020,10 +1022,10 @@ hello: test_prep examples/pasm/hello$(EX $(CUR_DIR)/examples/pasm/hello$(EXE) "from your friendly makefile" examples/pasm/hello.pbc: examples/pasm/hello.pasm - $(PARROT) -o examples/pasm/hello.pbc examples/pasm/hello.pasm + $(SHRPENV) $(PARROT) -o examples/pasm/hello.pbc examples/pasm/hello.pasm examples/pasm/hello$(O): examples/pasm/hello.pbc - $(PARROT) -o examples/pasm/hello$(O) examples/pasm/hello.pbc + $(SHRPENV) $(PARROT) -o examples/pasm/hello$(O) examples/pasm/hello.pbc examples/pasm/hello$(EXE): examples/pasm/hello$(O) $(MAKE) . EXEC=examples/pasm/hello exec @@ -1577,7 +1579,7 @@ doc_tests : # Running a benchmark mopsbench : test_prep - $(PARROT) examples/benchmarks/mops_intval.pasm + $(SHRPENV) $(PARROT) examples/benchmarks/mops_intval.pasm # distro tests distro_tests : test_prep Index: parrot-svn/config/gen/makefiles/docs.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/docs.in +++ parrot-svn/config/gen/makefiles/docs.in @@ -7,6 +7,7 @@ RM_F = @rm_f@ MKPATH = @mkpath@ CHMOD = @chmod@ PERLDOC = @perldoc@ +BUILD_DIR = @build_dir@ # long list of .pod files POD = @pod@ @@ -16,7 +17,11 @@ POD = @pod@ # # The default target -all: doc-prep packfile-c.pod $(POD) +all: doc-prep packfile-c.pod $(POD) Makefile + +# regenerate the Makefile +Makefile: $(BUILD_DIR)/config/gen/makefiles/docs.in + cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::makefiles --target=docs/Makefile # This is a listing of all targets, that are meant to be called by users # Most of them are proxied in the root makefile parrot/Makefile Index: parrot-svn/config/gen/makefiles/bcg.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/bcg.in +++ parrot-svn/config/gen/makefiles/bcg.in @@ -1,25 +1,25 @@ -RM_F = @rm_f@ -PERL = @perl@ +RM_F = @rm_f@ +PERL = @perl@ PARROT = @build_dir@/parrot@exe@ #CONDITIONED_LINE(win32):LIBPARROT = @build_dir@/libparrot@a@ #INVERSE_CONDITIONED_LINE(win32):LIBPARROT = @build_dir@/@blib_dir@/libparrot@a@ -O = @o@ -LOAD_EXT = @load_ext@ -CC = @cc@ -CC_INC = @cc_inc@ -I@build_dir@/include -C_LIBS = @libs@ -CC_SHARED = @cc_shared@ -CFLAGS = $(CC_INC) @ccflags@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ $(CC_SHARED) +O = @o@ +LOAD_EXT = @load_ext@ +CC = @cc@ +CC_INC = @cc_inc@ -I@build_dir@/include +C_LIBS = @libs@ +CC_SHARED = @cc_shared@ +CFLAGS = $(CC_INC) @ccflags@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ $(CC_SHARED) LINK_DYNAMIC = @link_dynamic@ -LINK = @link@ -LINKFLAGS = @linkflags@ @link_debug@ @ld_debug@ -LD = @ld@ -#CONDITIONED_LINE(win32):LDFLAGS = @ldflags@ @ld_debug@ $(LIBPARROT) -#INVERSE_CONDITIONED_LINE(win32):LDFLAGS = @ldflags@ @ld_debug@ -L@build_dir@/blib/lib/ -lparrot +LINK = @link@ +LINKFLAGS = @linkflags@ @link_debug@ @ld_debug@ +LD = @ld@ +#CONDITIONED_LINE(win32):LDFLAGS = @ldflags@ @ld_debug@ $(LIBPARROT) +#INVERSE_CONDITIONED_LINE(win32):LDFLAGS = @ldflags@ @ld_debug@ -L@build_dir@/blib/lib/ -lparrot SHARE_EXT = @share_ext@ LD_SHARE_FLAGS = @ld_share_flags@ BUILD_PMC = $(PERL) @build_dir@/tools/build/dynpmc.pl -SRC_PMC_DIR = src/pmc +SRC_PMC_DIR = src/pmc DEST_PMC_DIR = @build_dir@/runtime/parrot/dynext PMC_GROUP = $(DEST_PMC_DIR)/bcg_group$(LOAD_EXT) DYNPMC_INCLUDE = @build_dir@/compilers/bcg/include,@build_dir@/compilers/bcg/include,@build_dir@/compilers/bcg/include @@ -61,8 +61,7 @@ PMC_GEN_FILES = \ $(SRC_PMC_DIR)/*$(LOAD_EXT) \ $(PMC_GROUP) -all: pmcs - +all: pmcs Makefile # # Build Targets @@ -73,7 +72,6 @@ $(LIB_BCG): $(BCG_O_FILES) $(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) @ld_out@$@ $(BCG_O_FILES) @libs@ $(CP) @build_dir@/blib/lib/libbcg$(SHARE_EXT) @build_dir@ - pmcs: $(LIB_BCG) @cd $(SRC_PMC_DIR) && $(BUILD_PMC) generate $(PMCS) @cd $(SRC_PMC_DIR) && DYNPMC_INCLUDE=$(DYNPMC_INCLUDE) $(BUILD_PMC) compile $(PMCS) @@ -81,6 +79,9 @@ pmcs: $(LIB_BCG) @cd $(SRC_PMC_DIR) && $(BUILD_PMC) copy "--destination=$(DEST_PMC_DIR)" \ $(PMCS) +# regenerate the Makefile +Makefile: @build_dir@/config/gen/makefiles/docs.in + cd @build_dir@ && $(RECONFIGURE) --step=gen::makefiles --target=docs/Makefile # # Test Targets @@ -103,3 +104,9 @@ clean: testclean realclean: clean distclean: realclean + +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/inter/libparrot.pm =================================================================== --- parrot-svn.orig/config/inter/libparrot.pm +++ parrot-svn/config/inter/libparrot.pm @@ -93,6 +93,17 @@ sub runstep { ); } + # RT#39742 installed parrot conflicts with dev parrot: + # move -L/usr/lib in ldflags to the back after -lparrot + # but better link directly to the file. + if ($parrot_is_shared and $conf->data->get('ldflags') =~ /(-L\S+)/) { + my $ldflags = $conf->data->get('ldflags'); + my $lpath = $1; + $ldflags =~ s|$1||; + $conf->data->set('libs' => $lpath . " " . $conf->data->get('libs')); + $conf->data->set('ldflags' => $ldflags); + } + $self->set_result( $parrot_is_shared ? 'yes' : 'no' ); return 1; Index: parrot-svn/config/gen/makefiles/dynoplibs.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/dynoplibs.in +++ parrot-svn/config/gen/makefiles/dynoplibs.in @@ -1,10 +1,10 @@ -# $Id: dynoplibs.in 19913 2007-07-16 20:30:04Z particle $ +# $Id: dynoplibs.in 31315 2008-09-21 14:25:18Z rurban $ -PERL = @perl@ -RM_F = @rm_f@ -LOAD_EXT = @load_ext@ +PERL = @perl@ +RM_F = @rm_f@ +LOAD_EXT = @load_ext@ RUNTIME_DIR = @build_dir@/runtime/parrot/dynext -O = @o@ +O = @o@ # add your dynamic op libraries here # @@ -32,7 +32,7 @@ testclean : # win32 exported functions and data items # win32 export definition files dynext-clean : - $(RM_F) "*.lib" "*.pdb" "*.ilk" "*.exp" "*.def" "*.manifest" +#IF(win32): $(RM_F) "*.lib" "*.pdb" "*.ilk" "*.exp" "*.def" "*.manifest" clean : testclean dynext-clean $(RM_F) "*.h" "*.c" "*$(LOAD_EXT)" "*$(O)" @@ -46,3 +46,9 @@ realclean: clean distclean: realclean svnclean: realclean + +# +# Local variables: +# mode: makefile +# ex: ft=make +# End: Index: parrot-svn/config/gen/makefiles/dynoplibs_pl.in =================================================================== --- parrot-svn.orig/config/gen/makefiles/dynoplibs_pl.in +++ parrot-svn/config/gen/makefiles/dynoplibs_pl.in @@ -46,7 +46,7 @@ if ($^O eq 'MSWin32') { } # OPS2C Config -our $OPS2C = "$PERL -I $PATHQUOTE" . +our $OPS2C = "$PERL -I $PATHQUOTE" . q[@build_dir@@slash@lib] . "$PATHQUOTE $PATHQUOTE" . q[@build_dir@@slash@tools@slash@build@slash@ops2c.pl] . @@ -73,7 +73,7 @@ sub compile_cmd { sub partial_link_cmd { my ($target, $libs, $sources) = @_; - + my $liblist; if ($^O =~ /mswin32/i) { # Need to put various libraries in the link line. @@ -93,7 +93,7 @@ sub partial_link_cmd { "$LD ". "@ld_out@" . $target . " " . join(" ", map {"$PATHQUOTE$_$PATHQUOTE"} @$sources) . - " $liblist $LDFLAGS $LD_LOAD_FLAGS $PATHQUOTE$LIBPARROT$PATHQUOTE"; + " $LDFLAGS $LD_LOAD_FLAGS $PATHQUOTE$LIBPARROT$PATHQUOTE $liblist"; } our $NOW = time(); Index: parrot-svn/config/init/hints/cygwin.pm =================================================================== --- parrot-svn.orig/config/init/hints/cygwin.pm +++ parrot-svn/config/init/hints/cygwin.pm @@ -17,15 +17,18 @@ sub runstep { my $build_dir = $conf->data->get('build_dir'); $build_dir =~ s/ /\\ /g; - # A note about building shared libraries: Perl5 uses the 'ld2' tool, which - # is installed as part of the perl5 installation. So far, it appears - # parrot can get by with simply using gcc -shared, so we override the - # perl5 Configure defaults and use 'gcc -shared' instead of 'ld2'. - # If this later causes problems, it might be worth revisiting. - # A. Dougherty 9/9/2002 + # A note about building shared libraries: Perl5 used the 'ld2' tool until + # 5.8.8-4, which is installed as part of the perl5 installation. So far, it + # appears parrot can get by with simply using gcc -shared, so we override + # the perl5 Configure defaults and use 'gcc -shared' instead of 'ld2'. If + # this later causes problems, it might be worth revisiting. A. Dougherty + # 9/9/2002 + # This can be checked with Config{ld} containing ld2 or g++|gcc $conf->data->set( build_dir => $build_dir, - ld => 'gcc', + ld => $conf->data->get('ld') eq 'ld2' + ? 'gcc' + : $conf->data->get('ld'), ld_share_flags => '-shared', ld_load_flags => '-shared', libs => $libs, @@ -35,6 +38,7 @@ sub runstep { sym_export => '__declspec(dllexport)', sym_import => '__declspec(dllimport)', cygchkdll => 'tools/build/cygchkdll.sh $(MINIPARROT) $(LIBPARROT)', + libparrot_ldflags => $conf->data->get('build_dir') . '/libparrot.dll.a', ); # inet_aton needs to be defined on Cygwin. Index: parrot-svn/config/init/hints/msys.pm =================================================================== --- parrot-svn.orig/config/init/hints/msys.pm +++ parrot-svn/config/init/hints/msys.pm @@ -1,5 +1,5 @@ # Copyright (C) 2005-2007, The Perl Foundation. -# $Id: msys.pm 18563 2007-05-16 00:53:55Z chromatic $ +# $Id$ package init::hints::msys;