This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PERL_SRC already has brackets on VMS.
[perl5.git] / ext / DynaLoader / Makefile.PL
index b4c12fc..d3670a8 100644 (file)
@@ -1,10 +1,14 @@
+use strict;
 use ExtUtils::MakeMaker;
 
+my $is_mswin    = $^O eq 'MSWin32';
+my $is_netware  = $^O eq 'NetWare';
+my $is_vms      = $^O eq 'VMS';
+
 WriteMakefile(
     NAME => 'DynaLoader',
     LINKTYPE   => 'static',
-    DEFINE     => '-DPERL_CORE -DLIBC="$(LIBC)"',
-    MAN3PODS   => {},  # Pods will be built by installman.
+    DEFINE     => '-DLIBC="$(LIBC)"',
     SKIP       => [qw(dynamic dynamic_lib dynamic_bs)],
     XSPROTOARG => '-noprototypes',             # XXX remove later?
     VERSION_FROM => 'DynaLoader_pm.PL',
@@ -18,10 +22,12 @@ WriteMakefile(
 );
 
 sub MY::postamble {
-       '
-DynaLoader.xs: $(DLSRC)
-       $(RM_F) $@
-       $(CP) $? $@
+    my $test_xs;
+
+    if ($is_mswin || $is_netware || $is_vms) {
+       $test_xs = '';
+    } else {
+       $test_xs = <<'EOT';
 
 # Perform very simple tests just to check for major gaffs.
 # We can\'t do much more for platforms we are not executing on.
@@ -29,15 +35,32 @@ test-xs:
        for i in dl_*xs; \
            do $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSUBPPARGS) $$i > /dev/null; \
        done
-';
+EOT
+    }
+
+    return '
+DynaLoader.xs: $(DLSRC)
+       $(RM_F) $@
+       $(CP) $? $@
+' . $test_xs;
 }
 
 sub MY::static {
-       '
-$(PERL_SRC)/$(OBJECT) : $(FIRST_MAKEFILE) $(OBJECT)
-       $(RM_RF) $(PERL_SRC)/$(OBJECT)
-       $(CP) $(OBJECT) $(PERL_SRC)/$(OBJECT)
+    my $object;
+    if ($is_mswin || $is_netware) {
+       $object = '$(PERL_SRC)\\$(OBJECT)';
+    } elsif ($is_vms) {
+       $object = '$(PERL_SRC)$(OBJECT)';
+    } else {
+       $object = '$(PERL_SRC)/$(OBJECT)';
+    }
+
+
+    return "
+$object : \$(FIRST_MAKEFILE) \$(OBJECT)
+       \$(RM_RF) $object
+       \$(CP) \$(OBJECT) $object
 
-static :: $(PERL_SRC)/$(OBJECT)
-';
+static :: $object
+";
 }