=cut
-use Config;
+use ExtUtils::MakeMaker::Config;
use File::Basename;
use File::Spec;
use ExtUtils::MakeMaker qw( neatvalue );
-use vars qw(@ISA $VERSION $BORLAND $GCC $DMAKE $NMAKE);
+use vars qw(@ISA $VERSION);
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-$VERSION = '1.10';
+$VERSION = '1.13';
$ENV{EMXSHELL} = 'sh'; # to run `commands`
-$BORLAND = 1 if $Config{'cc'} =~ /^bcc/i;
-$GCC = 1 if $Config{'cc'} =~ /^gcc/i;
-$DMAKE = 1 if $Config{'make'} =~ /^dmake/i;
-$NMAKE = 1 if $Config{'make'} =~ /^nmake/i;
+my $BORLAND = 1 if $Config{'cc'} =~ /^bcc/i;
+my $GCC = 1 if $Config{'cc'} =~ /^gcc/i;
=head2 Overridden methods
}
-=item B<find_tests>
-
-The Win9x shell does not expand globs and I'll play it safe and assume
-other Windows variants don't either.
-
-So we do it for them.
-
-=cut
-
-sub find_tests {
- return join(' ', <t\\*.t>);
-}
-
-
=item B<init_DIRFILESEP>
Using \ for Windows.
sub init_DIRFILESEP {
my($self) = shift;
+ my $make = $self->make;
+
# The ^ makes sure its not interpreted as an escape in nmake
- $self->{DIRFILESEP} = $NMAKE ? '^\\' :
- $DMAKE ? '\\\\'
- : '\\';
+ $self->{DIRFILESEP} = $make eq 'nmake' ? '^\\' :
+ $make eq 'dmake' ? '\\\\'
+ : '\\';
}
=item B<init_others>
$self->{ECHO} ||= $self->oneliner('print qq{@ARGV}', ['-l']);
$self->{ECHO_N} ||= $self->oneliner('print qq{@ARGV}');
- $self->{TOUCH} ||= '$(PERLRUN) -MExtUtils::Command -e touch';
- $self->{CHMOD} ||= '$(PERLRUN) -MExtUtils::Command -e chmod';
- $self->{CP} ||= '$(PERLRUN) -MExtUtils::Command -e cp';
- $self->{RM_F} ||= '$(PERLRUN) -MExtUtils::Command -e rm_f';
- $self->{RM_RF} ||= '$(PERLRUN) -MExtUtils::Command -e rm_rf';
- $self->{MV} ||= '$(PERLRUN) -MExtUtils::Command -e mv';
+ $self->{TOUCH} ||= '$(ABSPERLRUN) -MExtUtils::Command -e touch';
+ $self->{CHMOD} ||= '$(ABSPERLRUN) -MExtUtils::Command -e chmod';
+ $self->{CP} ||= '$(ABSPERLRUN) -MExtUtils::Command -e cp';
+ $self->{RM_F} ||= '$(ABSPERLRUN) -MExtUtils::Command -e rm_f';
+ $self->{RM_RF} ||= '$(ABSPERLRUN) -MExtUtils::Command -e rm_rf';
+ $self->{MV} ||= '$(ABSPERLRUN) -MExtUtils::Command -e mv';
$self->{NOOP} ||= 'rem';
- $self->{TEST_F} ||= '$(PERLRUN) -MExtUtils::Command -e test_f';
+ $self->{TEST_F} ||= '$(ABSPERLRUN) -MExtUtils::Command -e test_f';
$self->{DEV_NULL} ||= '> NUL';
+ $self->{FIXIN} ||= $self->{PERL_CORE} ?
+ "\$(PERLRUN) $self->{PERL_SRC}/win32/bin/pl2bat.pl" :
+ 'pl2bat.bat';
+
$self->{LD} ||= $Config{ld} || 'link';
$self->{AR} ||= $Config{ar} || 'lib';
}
-=item init_platform (o)
+=item init_platform
Add MM_Win32_VERSION.
-=item platform_constants (o)
+=item platform_constants
=cut
}
-=item special_targets (o)
+=item special_targets
Add .USESHELL target for dmake.
my $make_frag = $self->SUPER::special_targets;
- $make_frag .= <<'MAKE_FRAG' if $DMAKE;
+ $make_frag .= <<'MAKE_FRAG' if $self->make eq 'dmake';
.USESHELL :
MAKE_FRAG
}
-=item static_lib (o)
+=item static_lib
Changes how to run the linker.
my(@m);
push(@m, <<'END');
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) blibdirs
+$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(RM_RF) $@
END
}
-=item dynamic_lib (o)
+=item dynamic_lib
Complicated stuff for Win32 that I don't understand. :(
OTHERLDFLAGS = '.$otherldflags.'
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) blibdirs $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
+$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
');
if ($GCC) {
push(@m,
} elsif ($BORLAND) {
push(@m,
q{ $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) }.$ldfrom.q{,$@,,}
- .($DMAKE ? q{$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) }
+ .($self->make eq 'dmake'
+ ? q{$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) }
.q{$(MYEXTLIB:s,/,\,),$(EXPORT_LIST:s,/,\,)}
: q{$(subst /,\,$(PERL_ARCHIVE)) $(subst /,\,$(LDLOADLIBS)) }
.q{$(subst /,\,$(MYEXTLIB)),$(subst /,\,$(EXPORT_LIST))})
push(@m,
q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) }
.q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)});
+ if ($Config{cc} eq 'cl' and $Config{ccversion} =~ /^(\d+)/ and $1 >= 14) { # VC 2005 (aka VC 8) or higher
+ push(@m,
+ q{
+ mt -nologo -manifest $@.manifest -outputresource:$@;2 && del $@.manifest});
+ }
}
push @m, '
$(CHMOD) $(PERM_RWX) $@
join('',@m);
}
-=item clean
+=item extra_clean_files
Clean out some extra dll.{base,exp} files which might be generated by
gcc. Otherwise, take out all *.pdb files.
=cut
-sub clean
-{
- my ($self) = shift;
- my $s = $self->SUPER::clean(@_);
- my $clean = $GCC ? 'dll.base dll.exp' : '*.pdb';
- $s .= <<END;
-clean ::
- -\$(RM_F) $clean
+sub extra_clean_files {
+ my $self = shift;
-END
- return $s;
+ return $GCC ? (qw(dll.base dll.exp)) : ('*.pdb');
}
=item init_linker
}
-=item xs_o (o)
+=item xs_o
This target is stubbed out. Not sure why.
}
-=item pasthru (o)
+=item pasthru
All we send is -nologo to nmake to prevent it from printing its damned
banner.
sub pasthru {
my($self) = shift;
- return "PASTHRU = " . ($NMAKE ? "-nologo" : "");
+ return "PASTHRU = " . ($self->make eq 'nmake' ? "-nologo" : "");
}
-=item oneliner (o)
+=item oneliner
These are based on what command.com does on Win98. They may be wrong
for other Windows shells, I don't know.
$switches = join ' ', @$switches;
- return qq{\$(PERLRUN) $switches -e $cmd};
+ return qq{\$(ABSPERLRUN) $switches -e $cmd --};
}
# quotes; however it transforms {{ into { either inside and outside double
# quotes. It also translates }} into }. The escaping below is not
# 100% correct.
- if( $DMAKE ) {
+ if( $self->make eq 'dmake' ) {
$text =~ s/{/{{/g;
$text =~ s/}}/}}}/g;
}
}
+=item cd
+
+dmake can handle Unix style cd'ing but nmake (at least 1.5) cannot. It
+wants:
+
+ cd dir
+ command
+ another_command
+ cd ..
+
+B<NOTE> This cd can only go one level down. So far this sufficient for
+what MakeMaker needs.
+
+=cut
+
+sub cd {
+ my($self, $dir, @cmds) = @_;
+
+ return $self->SUPER::cd($dir, @cmds) unless $self->make eq 'nmake';
+
+ my $cmd = join "\n\t", map "$_", @cmds;
+
+ # No leading tab and no trailing newline makes for easier embedding.
+ my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd;
+cd %s
+ %s
+ cd ..
+MAKE_FRAG
+
+ chomp $make_frag;
+
+ return $make_frag;
+}
+
+
=item max_exec_len
nmake 1.50 limits command length to 2048 characters.