1*0Sstevel@tonic-gatepackage ExtUtils::MM_Win32; 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateuse strict; 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gate=head1 NAME 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gateExtUtils::MM_Win32 - methods to override UN*X behaviour in ExtUtils::MakeMaker 9*0Sstevel@tonic-gate 10*0Sstevel@tonic-gate=head1 SYNOPSIS 11*0Sstevel@tonic-gate 12*0Sstevel@tonic-gate use ExtUtils::MM_Win32; # Done internally by ExtUtils::MakeMaker if needed 13*0Sstevel@tonic-gate 14*0Sstevel@tonic-gate=head1 DESCRIPTION 15*0Sstevel@tonic-gate 16*0Sstevel@tonic-gateSee ExtUtils::MM_Unix for a documentation of the methods provided 17*0Sstevel@tonic-gatethere. This package overrides the implementation of these methods, not 18*0Sstevel@tonic-gatethe semantics. 19*0Sstevel@tonic-gate 20*0Sstevel@tonic-gate=cut 21*0Sstevel@tonic-gate 22*0Sstevel@tonic-gateuse Config; 23*0Sstevel@tonic-gateuse File::Basename; 24*0Sstevel@tonic-gateuse File::Spec; 25*0Sstevel@tonic-gateuse ExtUtils::MakeMaker qw( neatvalue ); 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gateuse vars qw(@ISA $VERSION $BORLAND $GCC $DMAKE $NMAKE); 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gaterequire ExtUtils::MM_Any; 30*0Sstevel@tonic-gaterequire ExtUtils::MM_Unix; 31*0Sstevel@tonic-gate@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); 32*0Sstevel@tonic-gate$VERSION = '1.09'; 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate$ENV{EMXSHELL} = 'sh'; # to run `commands` 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate$BORLAND = 1 if $Config{'cc'} =~ /^bcc/i; 37*0Sstevel@tonic-gate$GCC = 1 if $Config{'cc'} =~ /^gcc/i; 38*0Sstevel@tonic-gate$DMAKE = 1 if $Config{'make'} =~ /^dmake/i; 39*0Sstevel@tonic-gate$NMAKE = 1 if $Config{'make'} =~ /^nmake/i; 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate=head2 Overridden methods 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate=over 4 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate=item B<dlsyms> 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate=cut 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gatesub dlsyms { 51*0Sstevel@tonic-gate my($self,%attribs) = @_; 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {}; 54*0Sstevel@tonic-gate my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || []; 55*0Sstevel@tonic-gate my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || []; 56*0Sstevel@tonic-gate my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {}; 57*0Sstevel@tonic-gate my(@m); 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate if (not $self->{SKIPHASH}{'dynamic'}) { 60*0Sstevel@tonic-gate push(@m," 61*0Sstevel@tonic-gate$self->{BASEEXT}.def: Makefile.PL 62*0Sstevel@tonic-gate", 63*0Sstevel@tonic-gate q! $(PERLRUN) -MExtUtils::Mksymlists \\ 64*0Sstevel@tonic-gate -e "Mksymlists('NAME'=>\"!, $self->{NAME}, 65*0Sstevel@tonic-gate q!\", 'DLBASE' => '!,$self->{DLBASE}, 66*0Sstevel@tonic-gate # The above two lines quoted differently to work around 67*0Sstevel@tonic-gate # a bug in the 4DOS/4NT command line interpreter. The visible 68*0Sstevel@tonic-gate # result of the bug was files named q('extension_name',) *with the 69*0Sstevel@tonic-gate # single quotes and the comma* in the extension build directories. 70*0Sstevel@tonic-gate q!', 'DL_FUNCS' => !,neatvalue($funcs), 71*0Sstevel@tonic-gate q!, 'FUNCLIST' => !,neatvalue($funclist), 72*0Sstevel@tonic-gate q!, 'IMPORTS' => !,neatvalue($imports), 73*0Sstevel@tonic-gate q!, 'DL_VARS' => !, neatvalue($vars), q!);" 74*0Sstevel@tonic-gate!); 75*0Sstevel@tonic-gate } 76*0Sstevel@tonic-gate join('',@m); 77*0Sstevel@tonic-gate} 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate=item replace_manpage_separator 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gateChanges the path separator with . 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate=cut 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gatesub replace_manpage_separator { 86*0Sstevel@tonic-gate my($self,$man) = @_; 87*0Sstevel@tonic-gate $man =~ s,/+,.,g; 88*0Sstevel@tonic-gate $man; 89*0Sstevel@tonic-gate} 90*0Sstevel@tonic-gate 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate=item B<maybe_command> 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gateSince Windows has nothing as simple as an executable bit, we check the 95*0Sstevel@tonic-gatefile extension. 96*0Sstevel@tonic-gate 97*0Sstevel@tonic-gateThe PATHEXT env variable will be used to get a list of extensions that 98*0Sstevel@tonic-gatemight indicate a command, otherwise .com, .exe, .bat and .cmd will be 99*0Sstevel@tonic-gateused by default. 100*0Sstevel@tonic-gate 101*0Sstevel@tonic-gate=cut 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gatesub maybe_command { 104*0Sstevel@tonic-gate my($self,$file) = @_; 105*0Sstevel@tonic-gate my @e = exists($ENV{'PATHEXT'}) 106*0Sstevel@tonic-gate ? split(/;/, $ENV{PATHEXT}) 107*0Sstevel@tonic-gate : qw(.com .exe .bat .cmd); 108*0Sstevel@tonic-gate my $e = ''; 109*0Sstevel@tonic-gate for (@e) { $e .= "\Q$_\E|" } 110*0Sstevel@tonic-gate chop $e; 111*0Sstevel@tonic-gate # see if file ends in one of the known extensions 112*0Sstevel@tonic-gate if ($file =~ /($e)$/i) { 113*0Sstevel@tonic-gate return $file if -e $file; 114*0Sstevel@tonic-gate } 115*0Sstevel@tonic-gate else { 116*0Sstevel@tonic-gate for (@e) { 117*0Sstevel@tonic-gate return "$file$_" if -e "$file$_"; 118*0Sstevel@tonic-gate } 119*0Sstevel@tonic-gate } 120*0Sstevel@tonic-gate return; 121*0Sstevel@tonic-gate} 122*0Sstevel@tonic-gate 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gate=item B<find_tests> 125*0Sstevel@tonic-gate 126*0Sstevel@tonic-gateThe Win9x shell does not expand globs and I'll play it safe and assume 127*0Sstevel@tonic-gateother Windows variants don't either. 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gateSo we do it for them. 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate=cut 132*0Sstevel@tonic-gate 133*0Sstevel@tonic-gatesub find_tests { 134*0Sstevel@tonic-gate return join(' ', <t\\*.t>); 135*0Sstevel@tonic-gate} 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate 138*0Sstevel@tonic-gate=item B<init_DIRFILESEP> 139*0Sstevel@tonic-gate 140*0Sstevel@tonic-gateUsing \ for Windows. 141*0Sstevel@tonic-gate 142*0Sstevel@tonic-gate=cut 143*0Sstevel@tonic-gate 144*0Sstevel@tonic-gatesub init_DIRFILESEP { 145*0Sstevel@tonic-gate my($self) = shift; 146*0Sstevel@tonic-gate 147*0Sstevel@tonic-gate # The ^ makes sure its not interpreted as an escape in nmake 148*0Sstevel@tonic-gate $self->{DIRFILESEP} = $NMAKE ? '^\\' : 149*0Sstevel@tonic-gate $DMAKE ? '\\\\' 150*0Sstevel@tonic-gate : '\\'; 151*0Sstevel@tonic-gate} 152*0Sstevel@tonic-gate 153*0Sstevel@tonic-gate=item B<init_others> 154*0Sstevel@tonic-gate 155*0Sstevel@tonic-gateOverride some of the Unix specific commands with portable 156*0Sstevel@tonic-gateExtUtils::Command ones. 157*0Sstevel@tonic-gate 158*0Sstevel@tonic-gateAlso provide defaults for LD and AR in case the %Config values aren't 159*0Sstevel@tonic-gateset. 160*0Sstevel@tonic-gate 161*0Sstevel@tonic-gateLDLOADLIBS's default is changed to $Config{libs}. 162*0Sstevel@tonic-gate 163*0Sstevel@tonic-gateAdjustments are made for Borland's quirks needing -L to come first. 164*0Sstevel@tonic-gate 165*0Sstevel@tonic-gate=cut 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gatesub init_others { 168*0Sstevel@tonic-gate my ($self) = @_; 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate # Used in favor of echo because echo won't strip quotes. :( 171*0Sstevel@tonic-gate $self->{ECHO} ||= $self->oneliner('print qq{@ARGV}', ['-l']); 172*0Sstevel@tonic-gate $self->{ECHO_N} ||= $self->oneliner('print qq{@ARGV}'); 173*0Sstevel@tonic-gate 174*0Sstevel@tonic-gate $self->{TOUCH} ||= '$(PERLRUN) -MExtUtils::Command -e touch'; 175*0Sstevel@tonic-gate $self->{CHMOD} ||= '$(PERLRUN) -MExtUtils::Command -e chmod'; 176*0Sstevel@tonic-gate $self->{CP} ||= '$(PERLRUN) -MExtUtils::Command -e cp'; 177*0Sstevel@tonic-gate $self->{RM_F} ||= '$(PERLRUN) -MExtUtils::Command -e rm_f'; 178*0Sstevel@tonic-gate $self->{RM_RF} ||= '$(PERLRUN) -MExtUtils::Command -e rm_rf'; 179*0Sstevel@tonic-gate $self->{MV} ||= '$(PERLRUN) -MExtUtils::Command -e mv'; 180*0Sstevel@tonic-gate $self->{NOOP} ||= 'rem'; 181*0Sstevel@tonic-gate $self->{TEST_F} ||= '$(PERLRUN) -MExtUtils::Command -e test_f'; 182*0Sstevel@tonic-gate $self->{DEV_NULL} ||= '> NUL'; 183*0Sstevel@tonic-gate 184*0Sstevel@tonic-gate $self->{LD} ||= $Config{ld} || 'link'; 185*0Sstevel@tonic-gate $self->{AR} ||= $Config{ar} || 'lib'; 186*0Sstevel@tonic-gate 187*0Sstevel@tonic-gate $self->SUPER::init_others; 188*0Sstevel@tonic-gate 189*0Sstevel@tonic-gate # Setting SHELL from $Config{sh} can break dmake. Its ok without it. 190*0Sstevel@tonic-gate delete $self->{SHELL}; 191*0Sstevel@tonic-gate 192*0Sstevel@tonic-gate $self->{LDLOADLIBS} ||= $Config{libs}; 193*0Sstevel@tonic-gate # -Lfoo must come first for Borland, so we put it in LDDLFLAGS 194*0Sstevel@tonic-gate if ($BORLAND) { 195*0Sstevel@tonic-gate my $libs = $self->{LDLOADLIBS}; 196*0Sstevel@tonic-gate my $libpath = ''; 197*0Sstevel@tonic-gate while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) { 198*0Sstevel@tonic-gate $libpath .= ' ' if length $libpath; 199*0Sstevel@tonic-gate $libpath .= $1; 200*0Sstevel@tonic-gate } 201*0Sstevel@tonic-gate $self->{LDLOADLIBS} = $libs; 202*0Sstevel@tonic-gate $self->{LDDLFLAGS} ||= $Config{lddlflags}; 203*0Sstevel@tonic-gate $self->{LDDLFLAGS} .= " $libpath"; 204*0Sstevel@tonic-gate } 205*0Sstevel@tonic-gate 206*0Sstevel@tonic-gate return 1; 207*0Sstevel@tonic-gate} 208*0Sstevel@tonic-gate 209*0Sstevel@tonic-gate 210*0Sstevel@tonic-gate=item init_platform (o) 211*0Sstevel@tonic-gate 212*0Sstevel@tonic-gateAdd MM_Win32_VERSION. 213*0Sstevel@tonic-gate 214*0Sstevel@tonic-gate=item platform_constants (o) 215*0Sstevel@tonic-gate 216*0Sstevel@tonic-gate=cut 217*0Sstevel@tonic-gate 218*0Sstevel@tonic-gatesub init_platform { 219*0Sstevel@tonic-gate my($self) = shift; 220*0Sstevel@tonic-gate 221*0Sstevel@tonic-gate $self->{MM_Win32_VERSION} = $VERSION; 222*0Sstevel@tonic-gate} 223*0Sstevel@tonic-gate 224*0Sstevel@tonic-gatesub platform_constants { 225*0Sstevel@tonic-gate my($self) = shift; 226*0Sstevel@tonic-gate my $make_frag = ''; 227*0Sstevel@tonic-gate 228*0Sstevel@tonic-gate foreach my $macro (qw(MM_Win32_VERSION)) 229*0Sstevel@tonic-gate { 230*0Sstevel@tonic-gate next unless defined $self->{$macro}; 231*0Sstevel@tonic-gate $make_frag .= "$macro = $self->{$macro}\n"; 232*0Sstevel@tonic-gate } 233*0Sstevel@tonic-gate 234*0Sstevel@tonic-gate return $make_frag; 235*0Sstevel@tonic-gate} 236*0Sstevel@tonic-gate 237*0Sstevel@tonic-gate 238*0Sstevel@tonic-gate=item special_targets (o) 239*0Sstevel@tonic-gate 240*0Sstevel@tonic-gateAdd .USESHELL target for dmake. 241*0Sstevel@tonic-gate 242*0Sstevel@tonic-gate=cut 243*0Sstevel@tonic-gate 244*0Sstevel@tonic-gatesub special_targets { 245*0Sstevel@tonic-gate my($self) = @_; 246*0Sstevel@tonic-gate 247*0Sstevel@tonic-gate my $make_frag = $self->SUPER::special_targets; 248*0Sstevel@tonic-gate 249*0Sstevel@tonic-gate $make_frag .= <<'MAKE_FRAG' if $DMAKE; 250*0Sstevel@tonic-gate.USESHELL : 251*0Sstevel@tonic-gateMAKE_FRAG 252*0Sstevel@tonic-gate 253*0Sstevel@tonic-gate return $make_frag; 254*0Sstevel@tonic-gate} 255*0Sstevel@tonic-gate 256*0Sstevel@tonic-gate 257*0Sstevel@tonic-gate=item static_lib (o) 258*0Sstevel@tonic-gate 259*0Sstevel@tonic-gateChanges how to run the linker. 260*0Sstevel@tonic-gate 261*0Sstevel@tonic-gateThe rest is duplicate code from MM_Unix. Should move the linker code 262*0Sstevel@tonic-gateto its own method. 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gate=cut 265*0Sstevel@tonic-gate 266*0Sstevel@tonic-gatesub static_lib { 267*0Sstevel@tonic-gate my($self) = @_; 268*0Sstevel@tonic-gate return '' unless $self->has_link_code; 269*0Sstevel@tonic-gate 270*0Sstevel@tonic-gate my(@m); 271*0Sstevel@tonic-gate push(@m, <<'END'); 272*0Sstevel@tonic-gate$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists 273*0Sstevel@tonic-gate $(RM_RF) $@ 274*0Sstevel@tonic-gateEND 275*0Sstevel@tonic-gate 276*0Sstevel@tonic-gate # If this extension has its own library (eg SDBM_File) 277*0Sstevel@tonic-gate # then copy that to $(INST_STATIC) and add $(OBJECT) into it. 278*0Sstevel@tonic-gate push @m, <<'MAKE_FRAG' if $self->{MYEXTLIB}; 279*0Sstevel@tonic-gate $(CP) $(MYEXTLIB) $@ 280*0Sstevel@tonic-gateMAKE_FRAG 281*0Sstevel@tonic-gate 282*0Sstevel@tonic-gate push @m, 283*0Sstevel@tonic-gateq{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")' 284*0Sstevel@tonic-gate : ($GCC ? '-ru $@ $(OBJECT)' 285*0Sstevel@tonic-gate : '-out:$@ $(OBJECT)')).q{ 286*0Sstevel@tonic-gate $(CHMOD) $(PERM_RWX) $@ 287*0Sstevel@tonic-gate $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld 288*0Sstevel@tonic-gate}; 289*0Sstevel@tonic-gate 290*0Sstevel@tonic-gate # Old mechanism - still available: 291*0Sstevel@tonic-gate push @m, <<'MAKE_FRAG' if $self->{PERL_SRC} && $self->{EXTRALIBS}; 292*0Sstevel@tonic-gate $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs 293*0Sstevel@tonic-gateMAKE_FRAG 294*0Sstevel@tonic-gate 295*0Sstevel@tonic-gate push @m, "\n", $self->dir_target('$(INST_ARCHAUTODIR)'); 296*0Sstevel@tonic-gate join('', @m); 297*0Sstevel@tonic-gate} 298*0Sstevel@tonic-gate 299*0Sstevel@tonic-gate 300*0Sstevel@tonic-gate=item dynamic_lib (o) 301*0Sstevel@tonic-gate 302*0Sstevel@tonic-gateComplicated stuff for Win32 that I don't understand. :( 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gate=cut 305*0Sstevel@tonic-gate 306*0Sstevel@tonic-gatesub dynamic_lib { 307*0Sstevel@tonic-gate my($self, %attribs) = @_; 308*0Sstevel@tonic-gate return '' unless $self->needs_linking(); #might be because of a subdir 309*0Sstevel@tonic-gate 310*0Sstevel@tonic-gate return '' unless $self->has_link_code; 311*0Sstevel@tonic-gate 312*0Sstevel@tonic-gate my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': ''); 313*0Sstevel@tonic-gate my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || ""; 314*0Sstevel@tonic-gate my($ldfrom) = '$(LDFROM)'; 315*0Sstevel@tonic-gate my(@m); 316*0Sstevel@tonic-gate 317*0Sstevel@tonic-gate# one thing for GCC/Mingw32: 318*0Sstevel@tonic-gate# we try to overcome non-relocateable-DLL problems by generating 319*0Sstevel@tonic-gate# a (hopefully unique) image-base from the dll's name 320*0Sstevel@tonic-gate# -- BKS, 10-19-1999 321*0Sstevel@tonic-gate if ($GCC) { 322*0Sstevel@tonic-gate my $dllname = $self->{BASEEXT} . "." . $self->{DLEXT}; 323*0Sstevel@tonic-gate $dllname =~ /(....)(.{0,4})/; 324*0Sstevel@tonic-gate my $baseaddr = unpack("n", $1 ^ $2); 325*0Sstevel@tonic-gate $otherldflags .= sprintf("-Wl,--image-base,0x%x0000 ", $baseaddr); 326*0Sstevel@tonic-gate } 327*0Sstevel@tonic-gate 328*0Sstevel@tonic-gate push(@m,' 329*0Sstevel@tonic-gate# This section creates the dynamically loadable $(INST_DYNAMIC) 330*0Sstevel@tonic-gate# from $(OBJECT) and possibly $(MYEXTLIB). 331*0Sstevel@tonic-gateOTHERLDFLAGS = '.$otherldflags.' 332*0Sstevel@tonic-gateINST_DYNAMIC_DEP = '.$inst_dynamic_dep.' 333*0Sstevel@tonic-gate 334*0Sstevel@tonic-gate$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP) 335*0Sstevel@tonic-gate'); 336*0Sstevel@tonic-gate if ($GCC) { 337*0Sstevel@tonic-gate push(@m, 338*0Sstevel@tonic-gate q{ dlltool --def $(EXPORT_LIST) --output-exp dll.exp 339*0Sstevel@tonic-gate $(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp 340*0Sstevel@tonic-gate dlltool --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp 341*0Sstevel@tonic-gate $(LD) -o $@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp }); 342*0Sstevel@tonic-gate } elsif ($BORLAND) { 343*0Sstevel@tonic-gate push(@m, 344*0Sstevel@tonic-gate q{ $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) }.$ldfrom.q{,$@,,} 345*0Sstevel@tonic-gate .($DMAKE ? q{$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) } 346*0Sstevel@tonic-gate .q{$(MYEXTLIB:s,/,\,),$(EXPORT_LIST:s,/,\,)} 347*0Sstevel@tonic-gate : q{$(subst /,\,$(PERL_ARCHIVE)) $(subst /,\,$(LDLOADLIBS)) } 348*0Sstevel@tonic-gate .q{$(subst /,\,$(MYEXTLIB)),$(subst /,\,$(EXPORT_LIST))}) 349*0Sstevel@tonic-gate .q{,$(RESFILES)}); 350*0Sstevel@tonic-gate } else { # VC 351*0Sstevel@tonic-gate push(@m, 352*0Sstevel@tonic-gate q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) } 353*0Sstevel@tonic-gate .q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)}); 354*0Sstevel@tonic-gate } 355*0Sstevel@tonic-gate push @m, ' 356*0Sstevel@tonic-gate $(CHMOD) $(PERM_RWX) $@ 357*0Sstevel@tonic-gate'; 358*0Sstevel@tonic-gate 359*0Sstevel@tonic-gate push @m, $self->dir_target('$(INST_ARCHAUTODIR)'); 360*0Sstevel@tonic-gate join('',@m); 361*0Sstevel@tonic-gate} 362*0Sstevel@tonic-gate 363*0Sstevel@tonic-gate=item clean 364*0Sstevel@tonic-gate 365*0Sstevel@tonic-gateClean out some extra dll.{base,exp} files which might be generated by 366*0Sstevel@tonic-gategcc. Otherwise, take out all *.pdb files. 367*0Sstevel@tonic-gate 368*0Sstevel@tonic-gate=cut 369*0Sstevel@tonic-gate 370*0Sstevel@tonic-gatesub clean 371*0Sstevel@tonic-gate{ 372*0Sstevel@tonic-gate my ($self) = shift; 373*0Sstevel@tonic-gate my $s = $self->SUPER::clean(@_); 374*0Sstevel@tonic-gate my $clean = $GCC ? 'dll.base dll.exp' : '*.pdb'; 375*0Sstevel@tonic-gate $s .= <<END; 376*0Sstevel@tonic-gateclean :: 377*0Sstevel@tonic-gate -\$(RM_F) $clean 378*0Sstevel@tonic-gate 379*0Sstevel@tonic-gateEND 380*0Sstevel@tonic-gate return $s; 381*0Sstevel@tonic-gate} 382*0Sstevel@tonic-gate 383*0Sstevel@tonic-gate=item init_linker 384*0Sstevel@tonic-gate 385*0Sstevel@tonic-gate=cut 386*0Sstevel@tonic-gate 387*0Sstevel@tonic-gatesub init_linker { 388*0Sstevel@tonic-gate my $self = shift; 389*0Sstevel@tonic-gate 390*0Sstevel@tonic-gate $self->{PERL_ARCHIVE} = "\$(PERL_INC)\\$Config{libperl}"; 391*0Sstevel@tonic-gate $self->{PERL_ARCHIVE_AFTER} = ''; 392*0Sstevel@tonic-gate $self->{EXPORT_LIST} = '$(BASEEXT).def'; 393*0Sstevel@tonic-gate} 394*0Sstevel@tonic-gate 395*0Sstevel@tonic-gate 396*0Sstevel@tonic-gate=item perl_script 397*0Sstevel@tonic-gate 398*0Sstevel@tonic-gateChecks for the perl program under several common perl extensions. 399*0Sstevel@tonic-gate 400*0Sstevel@tonic-gate=cut 401*0Sstevel@tonic-gate 402*0Sstevel@tonic-gatesub perl_script { 403*0Sstevel@tonic-gate my($self,$file) = @_; 404*0Sstevel@tonic-gate return $file if -r $file && -f _; 405*0Sstevel@tonic-gate return "$file.pl" if -r "$file.pl" && -f _; 406*0Sstevel@tonic-gate return "$file.plx" if -r "$file.plx" && -f _; 407*0Sstevel@tonic-gate return "$file.bat" if -r "$file.bat" && -f _; 408*0Sstevel@tonic-gate return; 409*0Sstevel@tonic-gate} 410*0Sstevel@tonic-gate 411*0Sstevel@tonic-gate 412*0Sstevel@tonic-gate=item xs_o (o) 413*0Sstevel@tonic-gate 414*0Sstevel@tonic-gateThis target is stubbed out. Not sure why. 415*0Sstevel@tonic-gate 416*0Sstevel@tonic-gate=cut 417*0Sstevel@tonic-gate 418*0Sstevel@tonic-gatesub xs_o { 419*0Sstevel@tonic-gate return '' 420*0Sstevel@tonic-gate} 421*0Sstevel@tonic-gate 422*0Sstevel@tonic-gate 423*0Sstevel@tonic-gate=item pasthru (o) 424*0Sstevel@tonic-gate 425*0Sstevel@tonic-gateAll we send is -nologo to nmake to prevent it from printing its damned 426*0Sstevel@tonic-gatebanner. 427*0Sstevel@tonic-gate 428*0Sstevel@tonic-gate=cut 429*0Sstevel@tonic-gate 430*0Sstevel@tonic-gatesub pasthru { 431*0Sstevel@tonic-gate my($self) = shift; 432*0Sstevel@tonic-gate return "PASTHRU = " . ($NMAKE ? "-nologo" : ""); 433*0Sstevel@tonic-gate} 434*0Sstevel@tonic-gate 435*0Sstevel@tonic-gate 436*0Sstevel@tonic-gate=item oneliner (o) 437*0Sstevel@tonic-gate 438*0Sstevel@tonic-gateThese are based on what command.com does on Win98. They may be wrong 439*0Sstevel@tonic-gatefor other Windows shells, I don't know. 440*0Sstevel@tonic-gate 441*0Sstevel@tonic-gate=cut 442*0Sstevel@tonic-gate 443*0Sstevel@tonic-gatesub oneliner { 444*0Sstevel@tonic-gate my($self, $cmd, $switches) = @_; 445*0Sstevel@tonic-gate $switches = [] unless defined $switches; 446*0Sstevel@tonic-gate 447*0Sstevel@tonic-gate # Strip leading and trailing newlines 448*0Sstevel@tonic-gate $cmd =~ s{^\n+}{}; 449*0Sstevel@tonic-gate $cmd =~ s{\n+$}{}; 450*0Sstevel@tonic-gate 451*0Sstevel@tonic-gate $cmd = $self->quote_literal($cmd); 452*0Sstevel@tonic-gate $cmd = $self->escape_newlines($cmd); 453*0Sstevel@tonic-gate 454*0Sstevel@tonic-gate $switches = join ' ', @$switches; 455*0Sstevel@tonic-gate 456*0Sstevel@tonic-gate return qq{\$(PERLRUN) $switches -e $cmd}; 457*0Sstevel@tonic-gate} 458*0Sstevel@tonic-gate 459*0Sstevel@tonic-gate 460*0Sstevel@tonic-gatesub quote_literal { 461*0Sstevel@tonic-gate my($self, $text) = @_; 462*0Sstevel@tonic-gate 463*0Sstevel@tonic-gate # I don't know if this is correct, but it seems to work on 464*0Sstevel@tonic-gate # Win98's command.com 465*0Sstevel@tonic-gate $text =~ s{"}{\\"}g; 466*0Sstevel@tonic-gate 467*0Sstevel@tonic-gate # dmake eats '{' inside double quotes and leaves alone { outside double 468*0Sstevel@tonic-gate # quotes; however it transforms {{ into { either inside and outside double 469*0Sstevel@tonic-gate # quotes. It also translates }} into }. The escaping below is not 470*0Sstevel@tonic-gate # 100% correct. 471*0Sstevel@tonic-gate if( $DMAKE ) { 472*0Sstevel@tonic-gate $text =~ s/{/{{/g; 473*0Sstevel@tonic-gate $text =~ s/}}/}}}/g; 474*0Sstevel@tonic-gate } 475*0Sstevel@tonic-gate 476*0Sstevel@tonic-gate return qq{"$text"}; 477*0Sstevel@tonic-gate} 478*0Sstevel@tonic-gate 479*0Sstevel@tonic-gate 480*0Sstevel@tonic-gatesub escape_newlines { 481*0Sstevel@tonic-gate my($self, $text) = @_; 482*0Sstevel@tonic-gate 483*0Sstevel@tonic-gate # Escape newlines 484*0Sstevel@tonic-gate $text =~ s{\n}{\\\n}g; 485*0Sstevel@tonic-gate 486*0Sstevel@tonic-gate return $text; 487*0Sstevel@tonic-gate} 488*0Sstevel@tonic-gate 489*0Sstevel@tonic-gate 490*0Sstevel@tonic-gate=item max_exec_len 491*0Sstevel@tonic-gate 492*0Sstevel@tonic-gatenmake 1.50 limits command length to 2048 characters. 493*0Sstevel@tonic-gate 494*0Sstevel@tonic-gate=cut 495*0Sstevel@tonic-gate 496*0Sstevel@tonic-gatesub max_exec_len { 497*0Sstevel@tonic-gate my $self = shift; 498*0Sstevel@tonic-gate 499*0Sstevel@tonic-gate return $self->{_MAX_EXEC_LEN} ||= 2 * 1024; 500*0Sstevel@tonic-gate} 501*0Sstevel@tonic-gate 502*0Sstevel@tonic-gate 503*0Sstevel@tonic-gate=item os_flavor 504*0Sstevel@tonic-gate 505*0Sstevel@tonic-gateWindows is Win32. 506*0Sstevel@tonic-gate 507*0Sstevel@tonic-gate=cut 508*0Sstevel@tonic-gate 509*0Sstevel@tonic-gatesub os_flavor { 510*0Sstevel@tonic-gate return('Win32'); 511*0Sstevel@tonic-gate} 512*0Sstevel@tonic-gate 513*0Sstevel@tonic-gate 514*0Sstevel@tonic-gate1; 515*0Sstevel@tonic-gate__END__ 516*0Sstevel@tonic-gate 517*0Sstevel@tonic-gate=back 518*0Sstevel@tonic-gate 519*0Sstevel@tonic-gate=cut 520*0Sstevel@tonic-gate 521*0Sstevel@tonic-gate 522