=cut
-use Config;
+use ExtUtils::MakeMaker::Config;
use File::Basename;
use File::Spec;
use ExtUtils::MakeMaker qw( neatvalue );
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
-$VERSION = '1.06';
+$VERSION = '1.12';
$ENV{EMXSHELL} = 'sh'; # to run `commands`
}
-=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;
- # gotta be careful this isn't interpreted as an escape.
- $self->{DIRFILESEP} = '^\\';
+ # The ^ makes sure its not interpreted as an escape in nmake
+ $self->{DIRFILESEP} = $NMAKE ? '^\\' :
+ $DMAKE ? '\\\\'
+ : '\\';
}
=item B<init_others>
my ($self) = @_;
# Used in favor of echo because echo won't strip quotes. :(
- $self->{ECHO} ||= '$(PERLRUN) -le "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->{ECHO} ||= $self->oneliner('print qq{@ARGV}', ['-l']);
+ $self->{ECHO_N} ||= $self->oneliner('print qq{@ARGV}');
+
+ $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';
- # technically speaking, these should be in init_main()
+ $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';
$self->SUPER::init_others;
+ # Setting SHELL from $Config{sh} can break dmake. Its ok without it.
+ delete $self->{SHELL};
+
$self->{LDLOADLIBS} ||= $Config{libs};
# -Lfoo must come first for Borland, so we put it in LDDLFLAGS
if ($BORLAND) {
}
-=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.
}
-=item static_lib (o)
+=item static_lib
Changes how to run the linker.
my(@m);
push(@m, <<'END');
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(RM_RF) $@
END
$(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs
MAKE_FRAG
- push @m, "\n", $self->dir_target('$(INST_ARCHAUTODIR)');
join('', @m);
}
-=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) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists $(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,
$(CHMOD) $(PERM_RWX) $@
';
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
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.
}
-=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};
}
# Win98's command.com
$text =~ s{"}{\\"}g;
+ # dmake eats '{' inside double quotes and leaves alone { outside double
+ # quotes; however it transforms {{ into { either inside and outside double
+ # quotes. It also translates }} into }. The escaping below is not
+ # 100% correct.
+ if( $DMAKE ) {
+ $text =~ s/{/{{/g;
+ $text =~ s/}}/}}}/g;
+ }
+
return qq{"$text"};
}
}
+=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 $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
-Using 31K, a safe number gotten from Windows 2000.
+nmake 1.50 limits command length to 2048 characters.
=cut
sub max_exec_len {
my $self = shift;
- return $self->{_MAX_EXEC_LEN} ||= 31 * 1024;
+ return $self->{_MAX_EXEC_LEN} ||= 2 * 1024;
+}
+
+
+=item os_flavor
+
+Windows is Win32.
+
+=cut
+
+sub os_flavor {
+ return('Win32');
}