In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/07f3cc2a611daebb9d83f869d36ef63cf4fa2565?hp=fc6784129696c3d1b807ce356dbd42133b41d86a>

- Log -----------------------------------------------------------------
commit 07f3cc2a611daebb9d83f869d36ef63cf4fa2565
Author: Nicholas Clark <n...@ccl4.org>
Date:   Sat Jan 31 20:16:43 2009 +0000

    Move the static/dynamic/nonxs LINKTYPE logic from make_ext.pl to Makefile.SH
    This simplifies make_ext.pl considerably. Given that the first use of 
'passthru'
    was in 40000a8c37c35cc00114329ca0add46bca36a0ec in 1995, possibly we should 
have
    done this particular refactoring a little while ago.
-----------------------------------------------------------------------

Summary of changes:
 Makefile.SH |   16 ++++++++--------
 make_ext.pl |   27 ++++-----------------------
 2 files changed, 12 insertions(+), 31 deletions(-)

diff --git a/Makefile.SH b/Makefile.SH
index 2e82a8e..f8193a6 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -59,7 +59,7 @@ true)
        esac
 
        pldlflags="$cccdlflags"
-       static_target='static_pic'
+       static_ldflags=''
        case "${osname}${osvers}" in
        next4*)
                ld=libtool
@@ -175,7 +175,7 @@ EOT
        ;;
 
 *)     pldlflags=''
-       static_target='static'
+       static_ldflags='CCCDLFLAGS='
        ;;
 esac
 
@@ -272,8 +272,8 @@ SHRPENV = $shrpenv
 # if building a shared libperl.so that might later be linked into
 # another application, then it might be appropriate to also build static
 # extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC
-# for GNU cc).  This is handled by make_ext.pl.
-STATIC = $static_target
+# for GNU cc).
+STATIC_LDFLAGS = $static_ldflags
 
 # The following is used to include the current directory in
 # the dynamic loader path you are building a shared libperl.
@@ -1123,16 +1123,16 @@ manicheck:      FORCE
 # DynaLoader may be needed for extensions that use Makefile.PL.
 
 $(DYNALOADER): miniperl$(EXE_EXT) preplibrary FORCE
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl 
--target=$(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ 
MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
 
 d_dummy $(dynamic_ext):        miniperl$(EXE_EXT) preplibrary makeppport 
$(DYNALOADER) FORCE
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl 
--target=dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ 
MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
 
 s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) 
FORCE
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl 
--target=$(STATIC) $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ 
MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
 
 n_dummy $(nonxs_ext):  miniperl$(EXE_EXT) preplibrary FORCE
-       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl 
--target=nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+       $(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl $@ 
MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
 !NO!SUBS!
 
 $spitshell >>$Makefile <<EOF
diff --git a/make_ext.pl b/make_ext.pl
index e802f65..2f09453 100644
--- a/make_ext.pl
+++ b/make_ext.pl
@@ -38,6 +38,7 @@ my $makecmd  = shift @pass_through; # Should be something 
like MAKE=make
 unshift @pass_through, 'PERL_CORE=1';
 
 my $target   = $opts{target};
+$target = 'all' unless defined $target;
 my $extspec  = $extspec[0];
 
 # Previously, $make was taken from config.sh.  However, the user might
@@ -67,31 +68,11 @@ if (!defined($extspec) or $extspec eq '')  {
        exit(1);
 }
 
-# check link type and do any preliminaries.  Valid link types are
-# 'dynamic', 'static', and 'static_pic' (the last one respects
-# CCCDLFLAGS such as -fPIC -- see static_target in the main Makefile.SH)
-if ($target eq 'dynamic') {
-       unshift @pass_through, 'LINKTYPE=dynamic';
-       $target   = 'all';
-}
-elsif ($target eq 'static') {
-       unshift @pass_through, 'LINKTYPE=static', 'CCCDLFLAGS=';
-       $target   = 'all';
-}
-elsif ($target eq 'static_pic') {
-       unshift @pass_through, 'LINKTYPE=static';
-       $target   = 'all';
-}
-elsif ($target eq 'nonxs') {
-       $target   = 'all';
-}
-elsif ($target =~ /clean$/) {
-}
-elsif ($target eq '') {
-       print "make_ext: no make target specified (eg static or dynamic)\n";
+if ($target eq '') {
+       print "make_ext: no make target specified (eg all or clean)\n";
        exit(1);
 }
-else {
+elsif ($target !~ /(?:^all|clean)$/) {
        # for the time being we are strict about what make_ext is used for
        print "make_ext: unknown make target '$target'\n";
        exit(1);

--
Perl5 Master Repository

Reply via email to