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