This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make hv_notallowed a static as suggested by Nicholas Clark;
[perl5.git] / lib / ExtUtils / MM_Win32.pm
CommitLineData
68dc0745 1package ExtUtils::MM_Win32;
2
b75c8c73 3
68dc0745 4=head1 NAME
5
6ExtUtils::MM_Win32 - methods to override UN*X behaviour in ExtUtils::MakeMaker
7
8=head1 SYNOPSIS
9
10 use ExtUtils::MM_Win32; # Done internally by ExtUtils::MakeMaker if needed
11
12=head1 DESCRIPTION
13
14See ExtUtils::MM_Unix for a documentation of the methods provided
15there. This package overrides the implementation of these methods, not
16the semantics.
17
bbc7dcd2 18=over 4
68dc0745 19
20=cut
21
3e3baf6d 22use Config;
68dc0745 23use File::Basename;
ecf68df6 24use File::Spec;
f6d6199c 25use ExtUtils::MakeMaker qw( neatvalue );
68dc0745 26
f6d6199c
MS
27use vars qw(@ISA $VERSION $BORLAND $GCC $DMAKE $NMAKE $PERLMAKE);
28
29require ExtUtils::MM_Any;
30require ExtUtils::MM_Unix;
31@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
75e2e551 32$VERSION = '1.04_01';
68dc0745 33
34$ENV{EMXSHELL} = 'sh'; # to run `commands`
68dc0745 35
3e3baf6d 36$BORLAND = 1 if $Config{'cc'} =~ /^bcc/i;
5b0d9cbe 37$GCC = 1 if $Config{'cc'} =~ /^gcc/i;
3e3baf6d
TB
38$DMAKE = 1 if $Config{'make'} =~ /^dmake/i;
39$NMAKE = 1 if $Config{'make'} =~ /^nmake/i;
dc0d354b 40$PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i;
3e3baf6d 41
68dc0745 42sub dlsyms {
43 my($self,%attribs) = @_;
44
45 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
46 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
762efda7 47 my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
68dc0745 48 my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
49 my(@m);
50 (my $boot = $self->{NAME}) =~ s/:/_/g;
51
52 if (not $self->{SKIPHASH}{'dynamic'}) {
53 push(@m,"
54$self->{BASEEXT}.def: Makefile.PL
55",
f6d6199c 56 q! $(PERLRUN) -MExtUtils::Mksymlists \\
5e687e55
NK
57 -e "Mksymlists('NAME'=>\"!, $self->{NAME},
58 q!\", 'DLBASE' => '!,$self->{DLBASE},
59 # The above two lines quoted differently to work around
60 # a bug in the 4DOS/4NT command line interpreter. The visible
61 # result of the bug was files named q('extension_name',) *with the
62 # single quotes and the comma* in the extension build directories.
68dc0745 63 q!', 'DL_FUNCS' => !,neatvalue($funcs),
762efda7 64 q!, 'FUNCLIST' => !,neatvalue($funclist),
68dc0745 65 q!, 'IMPORTS' => !,neatvalue($imports),
66 q!, 'DL_VARS' => !, neatvalue($vars), q!);"
67!);
68 }
69 join('',@m);
70}
71
72sub replace_manpage_separator {
73 my($self,$man) = @_;
74 $man =~ s,/+,.,g;
75 $man;
76}
77
78sub maybe_command {
79 my($self,$file) = @_;
846f184a
GS
80 my @e = exists($ENV{'PATHEXT'})
81 ? split(/;/, $ENV{PATHEXT})
82 : qw(.com .exe .bat .cmd);
83 my $e = '';
84 for (@e) { $e .= "\Q$_\E|" }
85 chop $e;
86 # see if file ends in one of the known extensions
2b2708c8 87 if ($file =~ /($e)$/i) {
846f184a
GS
88 return $file if -e $file;
89 }
90 else {
91 for (@e) {
92 return "$file$_" if -e "$file$_";
93 }
94 }
68dc0745 95 return;
96}
97
68dc0745 98
99sub find_perl {
100 my($self, $ver, $names, $dirs, $trace) = @_;
39234879
MS
101 $trace ||= 0;
102
68dc0745 103 my($name, $dir);
104 if ($trace >= 2){
105 print "Looking for perl $ver by these names:
106@$names
107in these dirs:
108@$dirs
109";
110 }
111 foreach $dir (@$dirs){
112 next unless defined $dir; # $self->{PERL_SRC} may be undefined
113 foreach $name (@$names){
114 my ($abs, $val);
f6d6199c 115 if (File::Spec->file_name_is_absolute($name)) { # /foo/bar
68dc0745 116 $abs = $name;
f6d6199c
MS
117 } elsif (File::Spec->canonpath($name) eq
118 File::Spec->canonpath(basename($name))) # foo
119 {
ecf68df6 120 $abs = File::Spec->catfile($dir, $name);
f6d6199c
MS
121 } else { # foo/bar
122 $abs = File::Spec->canonpath(
123 File::Spec->catfile(File::Spec->curdir, $name)
124 );
68dc0745 125 }
126 print "Checking $abs\n" if ($trace >= 2);
127 next unless $self->maybe_command($abs);
128 print "Executing $abs\n" if ($trace >= 2);
f6d6199c
MS
129 (my($safe_abs) = $abs) =~ s{(\s)}{\\$1}g;
130 $val = `$safe_abs -e "require $ver;" 2>&1`;
68dc0745 131 if ($? == 0) {
132 print "Using PERL=$abs\n" if $trace;
133 return $abs;
134 } elsif ($trace >= 2) {
135 print "Result: `$val'\n";
136 }
137 }
138 }
139 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
140 0; # false and not empty
141}
142
68dc0745 143sub init_others
144{
145 my ($self) = @_;
f6d6199c
MS
146 $self->SUPER::init_others;
147 $self->{'TOUCH'} = '$(PERLRUN) -MExtUtils::Command -e touch';
148 $self->{'CHMOD'} = '$(PERLRUN) -MExtUtils::Command -e chmod';
149 $self->{'CP'} = '$(PERLRUN) -MExtUtils::Command -e cp';
150 $self->{'RM_F'} = '$(PERLRUN) -MExtUtils::Command -e rm_f';
151 $self->{'RM_RF'} = '$(PERLRUN) -MExtUtils::Command -e rm_rf';
152 $self->{'MV'} = '$(PERLRUN) -MExtUtils::Command -e mv';
68dc0745 153 $self->{'NOOP'} = 'rem';
f6d6199c 154 $self->{'TEST_F'} = '$(PERLRUN) -MExtUtils::Command -e test_f';
3e3baf6d
TB
155 $self->{'LD'} = $Config{'ld'} || 'link';
156 $self->{'AR'} = $Config{'ar'} || 'lib';
944acd49 157 $self->{'LDLOADLIBS'} ||= $Config{'libs'};
e47a9bbc 158 # -Lfoo must come first for Borland, so we put it in LDDLFLAGS
944acd49
GS
159 if ($BORLAND) {
160 my $libs = $self->{'LDLOADLIBS'};
161 my $libpath = '';
e47a9bbc 162 while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) {
944acd49
GS
163 $libpath .= ' ' if length $libpath;
164 $libpath .= $1;
165 }
166 $self->{'LDLOADLIBS'} = $libs;
167 $self->{'LDDLFLAGS'} ||= $Config{'lddlflags'};
168 $self->{'LDDLFLAGS'} .= " $libpath";
169 }
68dc0745 170 $self->{'DEV_NULL'} = '> NUL';
68dc0745 171}
172
3e3baf6d
TB
173
174=item constants (o)
175
176Initializes lots of constants and .SUFFIXES and .PHONY
177
178=cut
179
180sub constants {
181 my($self) = @_;
182 my(@m,$tmp);
183
184 for $tmp (qw/
185
186 AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
187 VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
188 INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
189 INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
190 INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
191 PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
192 FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC
75e2e551
MS
193 PERL_INC PERL FULLPERL PERLRUN FULLPERLRUN PERLRUNINST
194 FULLPERLRUNINST TEST_LIBS FULL_AR PERL_CORE
3e3baf6d
TB
195
196 / ) {
197 next unless defined $self->{$tmp};
198 push @m, "$tmp = $self->{$tmp}\n";
199 }
200
201 push @m, qq{
202VERSION_MACRO = VERSION
203DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
204XS_VERSION_MACRO = XS_VERSION
205XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
206};
207
208 push @m, qq{
39234879 209MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'}
3e3baf6d
TB
210MM_VERSION = $ExtUtils::MakeMaker::VERSION
211};
212
213 push @m, q{
214# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
215# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
3e3baf6d
TB
216# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
217# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
218};
219
220 for $tmp (qw/
221 FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
222 LDFROM LINKTYPE
223 / ) {
224 next unless defined $self->{$tmp};
225 push @m, "$tmp = $self->{$tmp}\n";
226 }
227
228 push @m, "
229# Handy lists of source code files:
230XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
231C_FILES = ".join(" \\\n\t", @{$self->{C}})."
232O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
233H_FILES = ".join(" \\\n\t", @{$self->{H}})."
234MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
235MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
236";
237
238 for $tmp (qw/
cae6c631
JD
239 INST_MAN1DIR INSTALLMAN1DIR MAN1EXT
240 INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
3e3baf6d
TB
241 /) {
242 next unless defined $self->{$tmp};
243 push @m, "$tmp = $self->{$tmp}\n";
244 }
245
246 push @m, qq{
247.USESHELL :
248} if $DMAKE;
249
250 push @m, q{
251.NO_CONFIG_REC: Makefile
252} if $ENV{CLEARCASE_ROOT};
253
254 # why not q{} ? -- emacs
255 push @m, qq{
256# work around a famous dec-osf make(1) feature(?):
257makemakerdflt: all
258
259.SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT)
260
39234879
MS
261# Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to
262# recall, that some make implementations will delete the Makefile when we
263# rebuild it. Because we call false(1) when we rebuild it. So make(1) is
264# not completely wrong when it does so. Our milage may vary.
3e3baf6d
TB
265# .PRECIOUS: Makefile # seems to be not necessary anymore
266
267.PHONY: all config static dynamic test linkext manifest
268
269# Where is the Config information that we are using/depend on
270CONFIGDEP = \$(PERL_ARCHLIB)\\Config.pm \$(PERL_INC)\\config.h
271};
272
273 my @parentdir = split(/::/, $self->{PARENT_NAME});
274 push @m, q{
275# Where to put things:
ecf68df6
DR
276INST_LIBDIR = }. File::Spec->catdir('$(INST_LIB)',@parentdir) .q{
277INST_ARCHLIBDIR = }. File::Spec->catdir('$(INST_ARCHLIB)',@parentdir) .q{
3e3baf6d 278
ecf68df6
DR
279INST_AUTODIR = }. File::Spec->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{
280INST_ARCHAUTODIR = }. File::Spec->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{
3e3baf6d
TB
281};
282
283 if ($self->has_link_code()) {
284 push @m, '
285INST_STATIC = $(INST_ARCHAUTODIR)\$(BASEEXT)$(LIB_EXT)
286INST_DYNAMIC = $(INST_ARCHAUTODIR)\$(DLBASE).$(DLEXT)
287INST_BOOT = $(INST_ARCHAUTODIR)\$(BASEEXT).bs
288';
289 } else {
290 push @m, '
291INST_STATIC =
292INST_DYNAMIC =
293INST_BOOT =
294';
295 }
296
297 $tmp = $self->export_list;
298 push @m, "
299EXPORT_LIST = $tmp
300";
301 $tmp = $self->perl_archive;
302 push @m, "
303PERL_ARCHIVE = $tmp
304";
305
3e3baf6d
TB
306 push @m, q{
307TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{
308
309PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
310};
311
312 join('',@m);
313}
314
315
68dc0745 316=item static_lib (o)
317
318Defines how to produce the *.a (or equivalent) files.
319
320=cut
321
322sub static_lib {
323 my($self) = @_;
324# Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC
325# return '' unless $self->needs_linking(); #might be because of a subdir
326
327 return '' unless $self->has_link_code;
328
329 my(@m);
330 push(@m, <<'END');
3e3baf6d 331$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)\.exists
68dc0745 332 $(RM_RF) $@
333END
022735b4 334 # If this extension has its own library (eg SDBM_File)
68dc0745 335 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
336 push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
337
338 push @m,
910dfcc8
GS
339q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")'
340 : ($GCC ? '-ru $@ $(OBJECT)'
341 : '-out:$@ $(OBJECT)')).q{
3e3baf6d 342 }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld
68dc0745 343 $(CHMOD) 755 $@
344};
345
346# Old mechanism - still available:
347
3e3baf6d 348 push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs}."\n\n"
68dc0745 349 if $self->{PERL_SRC};
350
351 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
352 join('', "\n",@m);
353}
354
3e3baf6d
TB
355=item dynamic_bs (o)
356
357Defines targets for bootstrap files.
358
359=cut
68dc0745 360
3e3baf6d
TB
361sub dynamic_bs {
362 my($self, %attribs) = @_;
363 return '
364BOOTSTRAP =
365' unless $self->has_link_code();
366
367 return '
368BOOTSTRAP = '."$self->{BASEEXT}.bs".'
369
370# As Mkbootstrap might not write a file (if none is required)
371# we use touch to prevent make continually trying to remake it.
372# The DynaLoader only reads a non-empty file.
373$(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)\.exists
374 '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
f6d6199c 375 '.$self->{NOECHO}.'$(PERLRUN) \
3e3baf6d
TB
376 -MExtUtils::Mkbootstrap \
377 -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
378 '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
379 $(CHMOD) 644 $@
380
381$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists
382 '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT)
383 -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)
384 $(CHMOD) 644 $@
385';
386}
68dc0745 387
388=item dynamic_lib (o)
389
390Defines how to produce the *.so (or equivalent) files.
391
392=cut
393
394sub dynamic_lib {
395 my($self, %attribs) = @_;
396 return '' unless $self->needs_linking(); #might be because of a subdir
397
398 return '' unless $self->has_link_code;
399
3e3baf6d 400 my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': '');
68dc0745 401 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
402 my($ldfrom) = '$(LDFROM)';
403 my(@m);
7a958ec3 404
5db10396
GS
405# one thing for GCC/Mingw32:
406# we try to overcome non-relocateable-DLL problems by generating
7a958ec3
BS
407# a (hopefully unique) image-base from the dll's name
408# -- BKS, 10-19-1999
409 if ($GCC) {
7a958ec3
BS
410 my $dllname = $self->{BASEEXT} . "." . $self->{DLEXT};
411 $dllname =~ /(....)(.{0,4})/;
412 my $baseaddr = unpack("n", $1 ^ $2);
413 $otherldflags .= sprintf("-Wl,--image-base,0x%x0000 ", $baseaddr);
414 }
415
68dc0745 416 push(@m,'
417# This section creates the dynamically loadable $(INST_DYNAMIC)
418# from $(OBJECT) and possibly $(MYEXTLIB).
419OTHERLDFLAGS = '.$otherldflags.'
420INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
421
3e3baf6d 422$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
68dc0745 423');
5b0d9cbe
NIS
424 if ($GCC) {
425 push(@m,
910dfcc8
GS
426 q{ dlltool --def $(EXPORT_LIST) --output-exp dll.exp
427 $(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp
5b0d9cbe
NIS
428 dlltool --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp
429 $(LD) -o $@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp });
dc0d354b
GS
430 } elsif ($BORLAND) {
431 push(@m,
432 q{ $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) }.$ldfrom.q{,$@,,}
433 .($DMAKE ? q{$(PERL_ARCHIVE:s,/,\,) $(LDLOADLIBS:s,/,\,) }
434 .q{$(MYEXTLIB:s,/,\,),$(EXPORT_LIST:s,/,\,)}
435 : q{$(subst /,\,$(PERL_ARCHIVE)) $(subst /,\,$(LDLOADLIBS)) }
436 .q{$(subst /,\,$(MYEXTLIB)),$(subst /,\,$(EXPORT_LIST))})
437 .q{,$(RESFILES)});
438 } else { # VC
439 push(@m,
440 q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) }
441 .q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)});
5b0d9cbe 442 }
68dc0745 443 push @m, '
444 $(CHMOD) 755 $@
445';
446
447 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
448 join('',@m);
449}
450
562c1c19
NIS
451sub clean
452{
f6d6199c
MS
453 my ($self) = shift;
454 my $s = $self->SUPER::clean(@_);
1f50c5a9
GS
455 my $clean = $GCC ? 'dll.base dll.exp' : '*.pdb';
456 $s .= <<END;
562c1c19 457clean ::
1f50c5a9 458 -\$(RM_F) $clean
562c1c19
NIS
459
460END
1f50c5a9 461 return $s;
562c1c19
NIS
462}
463
464
465
68dc0745 466sub perl_archive
467{
e3b8966e 468 my ($self) = @_;
eda5ff31 469 return '$(PERL_INC)\\'.$Config{'libperl'};
68dc0745 470}
471
472sub export_list
473{
474 my ($self) = @_;
475 return "$self->{BASEEXT}.def";
476}
477
478=item canonpath
479
480No physical check on the filesystem, but a logical cleanup of a
481path. On UNIX eliminated successive slashes and successive "/.".
482
483=cut
484
485sub canonpath {
486 my($self,$path) = @_;
96e4d5b1 487 $path =~ s/^([a-z]:)/\u$1/;
68dc0745 488 $path =~ s|/|\\|g;
3e3baf6d 489 $path =~ s|(.)\\+|$1\\|g ; # xx////xx -> xx/xx
68dc0745 490 $path =~ s|(\\\.)+\\|\\|g ; # xx/././xx -> xx/xx
491 $path =~ s|^(\.\\)+|| unless $path eq ".\\"; # ./xx -> xx
492 $path =~ s|\\$||
493 unless $path =~ m#^([a-z]:)?\\#; # xx/ -> xx
494 $path .= '.' if $path =~ m#\\$#;
495 $path;
496}
497
498=item perl_script
499
500Takes one argument, a file name, and returns the file name, if the
501argument is likely to be a perl script. On MM_Unix this is true for
502any ordinary, readable file.
503
504=cut
505
506sub perl_script {
507 my($self,$file) = @_;
cae6c631 508 return $file if -r $file && -f _;
68dc0745 509 return "$file.pl" if -r "$file.pl" && -f _;
cae6c631 510 return "$file.bat" if -r "$file.bat" && -f _;
68dc0745 511 return;
512}
513
514=item pm_to_blib
515
516Defines target that copies all files in the hash PM to their
517destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
518
519=cut
520
521sub pm_to_blib {
522 my $self = shift;
ecf68df6 523 my($autodir) = File::Spec->catdir('$(INST_LIB)','auto');
68dc0745 524 return q{
525pm_to_blib: $(TO_INST_PM)
f6d6199c 526 }.$self->{NOECHO}.q{$(PERLRUNINST) -MExtUtils::Install \
dc0d354b
GS
527 -e "pm_to_blib(}.
528 ($NMAKE ? 'qw[ <<pmfiles.dat ],'
529 : $DMAKE ? 'qw[ $(mktmp,pmfiles.dat $(PM_TO_BLIB:s,\\,\\\\,)\n) ],'
530 : '{ qw[$(PM_TO_BLIB)] },'
131aa089 531 ).q{'}.$autodir.q{','$(PM_FILTER)')"
3e3baf6d 532 }. ($NMAKE ? q{
68dc0745 533$(PM_TO_BLIB)
534<<
3e3baf6d 535 } : '') . $self->{NOECHO}.q{$(TOUCH) $@
68dc0745 536};
537}
538
3e3baf6d 539
68dc0745 540=item tool_autosplit (override)
541
542Use Win32 quoting on command line.
543
544=cut
545
546sub tool_autosplit{
547 my($self, %attribs) = @_;
548 my($asl) = "";
549 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
550 q{
551# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
f6d6199c 552AUTOSPLITFILE = $(PERLRUN) -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);"
68dc0745 553};
554}
555
556=item tools_other (o)
557
558Win32 overrides.
559
560Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in
561the Makefile. Also defines the perl programs MKPATH,
562WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.
563
564=cut
565
566sub tools_other {
567 my($self) = shift;
568 my @m;
569 my $bin_sh = $Config{sh} || 'cmd /c';
570 push @m, qq{
571SHELL = $bin_sh
3e3baf6d 572} unless $DMAKE; # dmake determines its own shell
68dc0745 573
574 for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) {
575 push @m, "$_ = $self->{$_}\n";
576 }
577
578 push @m, q{
579# The following is a portable way to say mkdir -p
580# To see which directories are created, change the if 0 to if 1
f6d6199c 581MKPATH = $(PERLRUN) -MExtUtils::Command -e mkpath
68dc0745 582
583# This helps us to minimize the effect of the .exists files A yet
584# better solution would be to have a stable file in the perl
585# distribution with a timestamp of zero. But this solution doesn't
586# need any changes to the core distribution and works with older perls
f6d6199c 587EQUALIZE_TIMESTAMP = $(PERLRUN) -MExtUtils::Command -e eqtime
68dc0745 588};
589
590
591 return join "", @m if $self->{PARENT};
592
593 push @m, q{
594# Here we warn users that an old packlist file was found somewhere,
595# and that they should call some uninstall routine
596WARN_IF_OLD_PACKLIST = $(PERL) -lwe "exit unless -f $$ARGV[0];" \\
597-e "print 'WARNING: I have found an old package in';" \\
598-e "print ' ', $$ARGV[0], '.';" \\
599-e "print 'Please make sure the two installations are not conflicting';"
600
601UNINST=0
602VERBINST=1
603
604MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
3e3baf6d 605-e "install({ @ARGV },'$(VERBINST)',0,'$(UNINST)');"
68dc0745 606
607DOC_INSTALL = $(PERL) -e "$$\=\"\n\n\";" \
83bb2f05 608-e "print '=head2 ', scalar(localtime), ': C<', shift, '>', ' L<', $$arg=shift, '|', $$arg, '>';" \
68dc0745 609-e "print '=over 4';" \
3e3baf6d 610-e "while (defined($$key = shift) and defined($$val = shift)) { print '=item *';print 'C<', \"$$key: $$val\", '>'; }" \
68dc0745 611-e "print '=back';"
612
613UNINSTALL = $(PERL) -MExtUtils::Install \
614-e "uninstall($$ARGV[0],1,1); print \"\nUninstall is deprecated. Please check the";" \
615-e "print \" packlist above carefully.\n There may be errors. Remove the\";" \
616-e "print \" appropriate files manually.\n Sorry for the inconveniences.\n\""
617};
618
619 return join "", @m;
620}
621
3e3baf6d
TB
622=item xs_o (o)
623
624Defines suffix rules to go from XS to object files directly. This is
625only intended for broken make implementations.
626
627=cut
628
629sub xs_o { # many makes are too dumb to use xs_c then c_o
630 my($self) = shift;
631 return ''
632}
633
634=item top_targets (o)
635
636Defines the targets all, subdirs, config, and O_FILES
637
638=cut
639
640sub top_targets {
641# --- Target Sections ---
642
643 my($self) = shift;
644 my(@m);
3e3baf6d
TB
645
646 push @m, '
f6d6199c 647all :: pure_all manifypods
3e3baf6d
TB
648 '.$self->{NOECHO}.'$(NOOP)
649'
650 unless $self->{SKIPHASH}{'all'};
651
652 push @m, '
653pure_all :: config pm_to_blib subdirs linkext
654 '.$self->{NOECHO}.'$(NOOP)
655
656subdirs :: $(MYEXTLIB)
657 '.$self->{NOECHO}.'$(NOOP)
658
659config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)\.exists
660 '.$self->{NOECHO}.'$(NOOP)
661
662config :: $(INST_ARCHAUTODIR)\.exists
663 '.$self->{NOECHO}.'$(NOOP)
664
665config :: $(INST_AUTODIR)\.exists
666 '.$self->{NOECHO}.'$(NOOP)
667';
668
3e3baf6d
TB
669 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
670
671 if (%{$self->{MAN1PODS}}) {
672 push @m, qq[
673config :: \$(INST_MAN1DIR)\\.exists
674 $self->{NOECHO}\$(NOOP)
675
676];
677 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
678 }
679 if (%{$self->{MAN3PODS}}) {
680 push @m, qq[
681config :: \$(INST_MAN3DIR)\\.exists
682 $self->{NOECHO}\$(NOOP)
683
684];
685 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
686 }
687
688 push @m, '
689$(O_FILES): $(H_FILES)
690' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
691
692 push @m, q{
693help:
694 perldoc ExtUtils::MakeMaker
695};
696
3e3baf6d
TB
697 join('',@m);
698}
699
68dc0745 700=item manifypods (o)
701
cae6c631 702We don't want manpage process.
68dc0745 703
704=cut
705
706sub manifypods {
846f184a 707 my($self) = shift;
68dc0745 708 return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n";
709}
710
711=item dist_ci (o)
712
713Same as MM_Unix version (changes command-line quoting).
714
715=cut
716
717sub dist_ci {
718 my($self) = shift;
719 my @m;
720 push @m, q{
721ci :
f6d6199c 722 $(PERLRUN) -MExtUtils::Manifest=maniread \\
68dc0745 723 -e "@all = keys %{ maniread() };" \\
724 -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\
725 -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");"
726};
727 join "", @m;
728}
729
730=item dist_core (o)
731
732Same as MM_Unix version (changes command-line quoting).
733
734=cut
735
736sub dist_core {
737 my($self) = shift;
738 my @m;
739 push @m, q{
740dist : $(DIST_DEFAULT)
741 }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \
742 -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";"
743
744tardist : $(DISTVNAME).tar$(SUFFIX)
745
746zipdist : $(DISTVNAME).zip
747
748$(DISTVNAME).tar$(SUFFIX) : distdir
749 $(PREOP)
750 $(TO_UNIX)
751 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
752 $(RM_RF) $(DISTVNAME)
753 $(COMPRESS) $(DISTVNAME).tar
754 $(POSTOP)
755
756$(DISTVNAME).zip : distdir
757 $(PREOP)
758 $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
759 $(RM_RF) $(DISTVNAME)
760 $(POSTOP)
761
762uutardist : $(DISTVNAME).tar$(SUFFIX)
763 uuencode $(DISTVNAME).tar$(SUFFIX) \\
764 $(DISTVNAME).tar$(SUFFIX) > \\
765 $(DISTVNAME).tar$(SUFFIX)_uu
766
767shdist : distdir
768 $(PREOP)
769 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
770 $(RM_RF) $(DISTVNAME)
771 $(POSTOP)
772};
773 join "", @m;
774}
775
776=item pasthru (o)
777
778Defines the string that is passed to recursive make calls in
779subdirectories.
780
781=cut
782
783sub pasthru {
784 my($self) = shift;
3e3baf6d 785 return "PASTHRU = " . ($NMAKE ? "-nologo" : "");
68dc0745 786}
787
788
789
7901;
791__END__
792
793=back
794
795=cut
796
5b0d9cbe 797