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