1package ExtUtils::MM_Any;
2
3use strict;
4use vars qw($VERSION @ISA);
5$VERSION = '0.13';
6
7use File::Spec;
8BEGIN { @ISA = qw(File::Spec); }
9
10# We need $Verbose
11use ExtUtils::MakeMaker qw($Verbose);
12
13use ExtUtils::MakeMaker::Config;
14
15
16# So we don't have to keep calling the methods over and over again,
17# we have these globals to cache the values.  Faster and shrtr.
18my $Curdir  = __PACKAGE__->curdir;
19my $Rootdir = __PACKAGE__->rootdir;
20my $Updir   = __PACKAGE__->updir;
21
22
23=head1 NAME
24
25ExtUtils::MM_Any - Platform-agnostic MM methods
26
27=head1 SYNOPSIS
28
29  FOR INTERNAL USE ONLY!
30
31  package ExtUtils::MM_SomeOS;
32
33  # Temporarily, you have to subclass both.  Put MM_Any first.
34  require ExtUtils::MM_Any;
35  require ExtUtils::MM_Unix;
36  @ISA = qw(ExtUtils::MM_Any ExtUtils::Unix);
37
38=head1 DESCRIPTION
39
40B<FOR INTERNAL USE ONLY!>
41
42ExtUtils::MM_Any is a superclass for the ExtUtils::MM_* set of
43modules.  It contains methods which are either inherently
44cross-platform or are written in a cross-platform manner.
45
46Subclass off of ExtUtils::MM_Any I<and> ExtUtils::MM_Unix.  This is a
47temporary solution.
48
49B<THIS MAY BE TEMPORARY!>
50
51
52=head1 METHODS
53
54Any methods marked I<Abstract> must be implemented by subclasses.
55
56
57=head2 Cross-platform helper methods
58
59These are methods which help writing cross-platform code.
60
61
62
63=head3 os_flavor  I<Abstract>
64
65    my @os_flavor = $mm->os_flavor;
66
67@os_flavor is the style of operating system this is, usually
68corresponding to the MM_*.pm file we're using.
69
70The first element of @os_flavor is the major family (ie. Unix,
71Windows, VMS, OS/2, etc...) and the rest are sub families.
72
73Some examples:
74
75    Cygwin98       ('Unix',  'Cygwin', 'Cygwin9x')
76    Windows NT     ('Win32', 'WinNT')
77    Win98          ('Win32', 'Win9x')
78    Linux          ('Unix',  'Linux')
79    MacOS X        ('Unix',  'Darwin', 'MacOS', 'MacOS X')
80    OS/2           ('OS/2')
81
82This is used to write code for styles of operating system.
83See os_flavor_is() for use.
84
85
86=head3 os_flavor_is
87
88    my $is_this_flavor = $mm->os_flavor_is($this_flavor);
89    my $is_this_flavor = $mm->os_flavor_is(@one_of_these_flavors);
90
91Checks to see if the current operating system is one of the given flavors.
92
93This is useful for code like:
94
95    if( $mm->os_flavor_is('Unix') ) {
96        $out = `foo 2>&1`;
97    }
98    else {
99        $out = `foo`;
100    }
101
102=cut
103
104sub os_flavor_is {
105    my $self = shift;
106    my %flavors = map { ($_ => 1) } $self->os_flavor;
107    return (grep { $flavors{$_} } @_) ? 1 : 0;
108}
109
110
111=head3 split_command
112
113    my @cmds = $MM->split_command($cmd, @args);
114
115Most OS have a maximum command length they can execute at once.  Large
116modules can easily generate commands well past that limit.  Its
117necessary to split long commands up into a series of shorter commands.
118
119C<split_command> will return a series of @cmds each processing part of
120the args.  Collectively they will process all the arguments.  Each
121individual line in @cmds will not be longer than the
122$self->max_exec_len being careful to take into account macro expansion.
123
124$cmd should include any switches and repeated initial arguments.
125
126If no @args are given, no @cmds will be returned.
127
128Pairs of arguments will always be preserved in a single command, this
129is a heuristic for things like pm_to_blib and pod2man which work on
130pairs of arguments.  This makes things like this safe:
131
132    $self->split_command($cmd, %pod2man);
133
134
135=cut
136
137sub split_command {
138    my($self, $cmd, @args) = @_;
139
140    my @cmds = ();
141    return(@cmds) unless @args;
142
143    # If the command was given as a here-doc, there's probably a trailing
144    # newline.
145    chomp $cmd;
146
147    # set aside 20% for macro expansion.
148    my $len_left = int($self->max_exec_len * 0.80);
149    $len_left -= length $self->_expand_macros($cmd);
150
151    do {
152        my $arg_str = '';
153        my @next_args;
154        while( @next_args = splice(@args, 0, 2) ) {
155            # Two at a time to preserve pairs.
156            my $next_arg_str = "\t  ". join ' ', @next_args, "\n";
157
158            if( !length $arg_str ) {
159                $arg_str .= $next_arg_str
160            }
161            elsif( length($arg_str) + length($next_arg_str) > $len_left ) {
162                unshift @args, @next_args;
163                last;
164            }
165            else {
166                $arg_str .= $next_arg_str;
167            }
168        }
169        chop $arg_str;
170
171        push @cmds, $self->escape_newlines("$cmd \n$arg_str");
172    } while @args;
173
174    return @cmds;
175}
176
177
178sub _expand_macros {
179    my($self, $cmd) = @_;
180
181    $cmd =~ s{\$\((\w+)\)}{
182        defined $self->{$1} ? $self->{$1} : "\$($1)"
183    }e;
184    return $cmd;
185}
186
187
188=head3 echo
189
190    my @commands = $MM->echo($text);
191    my @commands = $MM->echo($text, $file);
192    my @commands = $MM->echo($text, $file, $appending);
193
194Generates a set of @commands which print the $text to a $file.
195
196If $file is not given, output goes to STDOUT.
197
198If $appending is true the $file will be appended to rather than
199overwritten.
200
201=cut
202
203sub echo {
204    my($self, $text, $file, $appending) = @_;
205    $appending ||= 0;
206
207    my @cmds = map { '$(NOECHO) $(ECHO) '.$self->quote_literal($_) }
208               split /\n/, $text;
209    if( $file ) {
210        my $redirect = $appending ? '>>' : '>';
211        $cmds[0] .= " $redirect $file";
212        $_ .= " >> $file" foreach @cmds[1..$#cmds];
213    }
214
215    return @cmds;
216}
217
218
219=head3 wraplist
220
221  my $args = $mm->wraplist(@list);
222
223Takes an array of items and turns them into a well-formatted list of
224arguments.  In most cases this is simply something like:
225
226    FOO \
227    BAR \
228    BAZ
229
230=cut
231
232sub wraplist {
233    my $self = shift;
234    return join " \\\n\t", @_;
235}
236
237
238=head3 cd  I<Abstract>
239
240  my $subdir_cmd = $MM->cd($subdir, @cmds);
241
242This will generate a make fragment which runs the @cmds in the given
243$dir.  The rough equivalent to this, except cross platform.
244
245  cd $subdir && $cmd
246
247Currently $dir can only go down one level.  "foo" is fine.  "foo/bar" is
248not.  "../foo" is right out.
249
250The resulting $subdir_cmd has no leading tab nor trailing newline.  This
251makes it easier to embed in a make string.  For example.
252
253      my $make = sprintf <<'CODE', $subdir_cmd;
254  foo :
255      $(ECHO) what
256      %s
257      $(ECHO) mouche
258  CODE
259
260
261=head3 oneliner  I<Abstract>
262
263  my $oneliner = $MM->oneliner($perl_code);
264  my $oneliner = $MM->oneliner($perl_code, \@switches);
265
266This will generate a perl one-liner safe for the particular platform
267you're on based on the given $perl_code and @switches (a -e is
268assumed) suitable for using in a make target.  It will use the proper
269shell quoting and escapes.
270
271$(PERLRUN) will be used as perl.
272
273Any newlines in $perl_code will be escaped.  Leading and trailing
274newlines will be stripped.  Makes this idiom much easier:
275
276    my $code = $MM->oneliner(<<'CODE', [...switches...]);
277some code here
278another line here
279CODE
280
281Usage might be something like:
282
283    # an echo emulation
284    $oneliner = $MM->oneliner('print "Foo\n"');
285    $make = '$oneliner > somefile';
286
287All dollar signs must be doubled in the $perl_code if you expect them
288to be interpreted normally, otherwise it will be considered a make
289macro.  Also remember to quote make macros else it might be used as a
290bareword.  For example:
291
292    # Assign the value of the $(VERSION_FROM) make macro to $vf.
293    $oneliner = $MM->oneliner('$$vf = "$(VERSION_FROM)"');
294
295Its currently very simple and may be expanded sometime in the figure
296to include more flexible code and switches.
297
298
299=head3 quote_literal  I<Abstract>
300
301    my $safe_text = $MM->quote_literal($text);
302
303This will quote $text so it is interpreted literally in the shell.
304
305For example, on Unix this would escape any single-quotes in $text and
306put single-quotes around the whole thing.
307
308
309=head3 escape_newlines  I<Abstract>
310
311    my $escaped_text = $MM->escape_newlines($text);
312
313Shell escapes newlines in $text.
314
315
316=head3 max_exec_len  I<Abstract>
317
318    my $max_exec_len = $MM->max_exec_len;
319
320Calculates the maximum command size the OS can exec.  Effectively,
321this is the max size of a shell command line.
322
323=for _private
324$self->{_MAX_EXEC_LEN} is set by this method, but only for testing purposes.
325
326
327
328
329
330=head2 Targets
331
332These are methods which produce make targets.
333
334
335=head3 all_target
336
337Generate the default target 'all'.
338
339=cut
340
341sub all_target {
342    my $self = shift;
343
344    return <<'MAKE_EXT';
345all :: pure_all
346	$(NOECHO) $(NOOP)
347MAKE_EXT
348
349}
350
351
352=head3 blibdirs_target
353
354    my $make_frag = $mm->blibdirs_target;
355
356Creates the blibdirs target which creates all the directories we use
357in blib/.
358
359The blibdirs.ts target is deprecated.  Depend on blibdirs instead.
360
361
362=cut
363
364sub blibdirs_target {
365    my $self = shift;
366
367    my @dirs = map { uc "\$(INST_$_)" } qw(libdir archlib
368                                           autodir archautodir
369                                           bin script
370                                           man1dir man3dir
371                                          );
372
373    my @exists = map { $_.'$(DFSEP).exists' } @dirs;
374
375    my $make = sprintf <<'MAKE', join(' ', @exists);
376blibdirs : %s
377	$(NOECHO) $(NOOP)
378
379# Backwards compat with 6.18 through 6.25
380blibdirs.ts : blibdirs
381	$(NOECHO) $(NOOP)
382
383MAKE
384
385    $make .= $self->dir_target(@dirs);
386
387    return $make;
388}
389
390
391=head3 clean (o)
392
393Defines the clean target.
394
395=cut
396
397sub clean {
398# --- Cleanup and Distribution Sections ---
399
400    my($self, %attribs) = @_;
401    my @m;
402    push(@m, '
403# Delete temporary files but do not touch installed files. We don\'t delete
404# the Makefile here so a later make realclean still has a makefile to use.
405
406clean :: clean_subdirs
407');
408
409    my @files = values %{$self->{XS}}; # .c files from *.xs files
410    my @dirs  = qw(blib);
411
412    # Normally these are all under blib but they might have been
413    # redefined.
414    # XXX normally this would be a good idea, but the Perl core sets
415    # INST_LIB = ../../lib rather than actually installing the files.
416    # So a "make clean" in an ext/ directory would blow away lib.
417    # Until the core is adjusted let's leave this out.
418#     push @dirs, qw($(INST_ARCHLIB) $(INST_LIB)
419#                    $(INST_BIN) $(INST_SCRIPT)
420#                    $(INST_MAN1DIR) $(INST_MAN3DIR)
421#                    $(INST_LIBDIR) $(INST_ARCHLIBDIR) $(INST_AUTODIR)
422#                    $(INST_STATIC) $(INST_DYNAMIC) $(INST_BOOT)
423#                 );
424
425
426    if( $attribs{FILES} ) {
427        # Use @dirs because we don't know what's in here.
428        push @dirs, ref $attribs{FILES}                ?
429                        @{$attribs{FILES}}             :
430                        split /\s+/, $attribs{FILES}   ;
431    }
432
433    push(@files, qw[$(MAKE_APERL_FILE)
434                    perlmain.c tmon.out mon.out so_locations
435                    blibdirs.ts pm_to_blib pm_to_blib.ts
436                    *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT)
437                    $(BOOTSTRAP) $(BASEEXT).bso
438                    $(BASEEXT).def lib$(BASEEXT).def
439                    $(BASEEXT).exp $(BASEEXT).x
440                   ]);
441
442    push(@files, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
443    push(@files, $self->catfile('$(INST_ARCHAUTODIR)','extralibs.ld'));
444
445    # core files
446    push(@files, qw[core core.*perl.*.? *perl.core]);
447    push(@files, map { "core." . "[0-9]"x$_ } (1..5));
448
449    # OS specific things to clean up.  Use @dirs since we don't know
450    # what might be in here.
451    push @dirs, $self->extra_clean_files;
452
453    # Occasionally files are repeated several times from different sources
454    { my(%f) = map { ($_ => 1) } @files; @files = keys %f; }
455    { my(%d) = map { ($_ => 1) } @dirs;  @dirs  = keys %d; }
456
457    push @m, map "\t$_\n", $self->split_command('- $(RM_F)',  @files);
458    push @m, map "\t$_\n", $self->split_command('- $(RM_RF)', @dirs);
459
460    # Leave Makefile.old around for realclean
461    push @m, <<'MAKE';
462	- $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL)
463MAKE
464
465    push(@m, "\t$attribs{POSTOP}\n")   if $attribs{POSTOP};
466
467    join("", @m);
468}
469
470
471=head3 clean_subdirs_target
472
473  my $make_frag = $MM->clean_subdirs_target;
474
475Returns the clean_subdirs target.  This is used by the clean target to
476call clean on any subdirectories which contain Makefiles.
477
478=cut
479
480sub clean_subdirs_target {
481    my($self) = shift;
482
483    # No subdirectories, no cleaning.
484    return <<'NOOP_FRAG' unless @{$self->{DIR}};
485clean_subdirs :
486	$(NOECHO) $(NOOP)
487NOOP_FRAG
488
489
490    my $clean = "clean_subdirs :\n";
491
492    for my $dir (@{$self->{DIR}}) {
493        my $subclean = $self->oneliner(sprintf <<'CODE', $dir);
494chdir '%s';  system '$(MAKE) clean' if -f '$(FIRST_MAKEFILE)';
495CODE
496
497        $clean .= "\t$subclean\n";
498    }
499
500    return $clean;
501}
502
503
504=head3 dir_target
505
506    my $make_frag = $mm->dir_target(@directories);
507
508Generates targets to create the specified directories and set its
509permission to 0755.
510
511Because depending on a directory to just ensure it exists doesn't work
512too well (the modified time changes too often) dir_target() creates a
513.exists file in the created directory.  It is this you should depend on.
514For portability purposes you should use the $(DIRFILESEP) macro rather
515than a '/' to seperate the directory from the file.
516
517    yourdirectory$(DIRFILESEP).exists
518
519=cut
520
521sub dir_target {
522    my($self, @dirs) = @_;
523
524    my $make = '';
525    foreach my $dir (@dirs) {
526        $make .= sprintf <<'MAKE', ($dir) x 7;
527%s$(DFSEP).exists :: Makefile.PL
528	$(NOECHO) $(MKPATH) %s
529	$(NOECHO) $(CHMOD) 755 %s
530	$(NOECHO) $(TOUCH) %s$(DFSEP).exists
531
532MAKE
533
534    }
535
536    return $make;
537}
538
539
540=head3 distdir
541
542Defines the scratch directory target that will hold the distribution
543before tar-ing (or shar-ing).
544
545=cut
546
547# For backwards compatibility.
548*dist_dir = *distdir;
549
550sub distdir {
551    my($self) = shift;
552
553    my $meta_target = $self->{NO_META} ? '' : 'distmeta';
554    my $sign_target = !$self->{SIGN}   ? '' : 'distsignature';
555
556    return sprintf <<'MAKE_FRAG', $meta_target, $sign_target;
557create_distdir :
558	$(RM_RF) $(DISTVNAME)
559	$(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
560		-e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
561
562distdir : create_distdir %s %s
563	$(NOECHO) $(NOOP)
564
565MAKE_FRAG
566
567}
568
569
570=head3 dist_test
571
572Defines a target that produces the distribution in the
573scratchdirectory, and runs 'perl Makefile.PL; make ;make test' in that
574subdirectory.
575
576=cut
577
578sub dist_test {
579    my($self) = shift;
580
581    my $mpl_args = join " ", map qq["$_"], @ARGV;
582
583    my $test = $self->cd('$(DISTVNAME)',
584                         '$(ABSPERLRUN) Makefile.PL '.$mpl_args,
585                         '$(MAKE) $(PASTHRU)',
586                         '$(MAKE) test $(PASTHRU)'
587                        );
588
589    return sprintf <<'MAKE_FRAG', $test;
590disttest : distdir
591	%s
592
593MAKE_FRAG
594
595
596}
597
598
599=head3 dynamic (o)
600
601Defines the dynamic target.
602
603=cut
604
605sub dynamic {
606# --- Dynamic Loading Sections ---
607
608    my($self) = shift;
609    '
610dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
611	$(NOECHO) $(NOOP)
612';
613}
614
615
616=head3 makemakerdflt_target
617
618  my $make_frag = $mm->makemakerdflt_target
619
620Returns a make fragment with the makemakerdeflt_target specified.
621This target is the first target in the Makefile, is the default target
622and simply points off to 'all' just in case any make variant gets
623confused or something gets snuck in before the real 'all' target.
624
625=cut
626
627sub makemakerdflt_target {
628    return <<'MAKE_FRAG';
629makemakerdflt: all
630	$(NOECHO) $(NOOP)
631MAKE_FRAG
632
633}
634
635
636=head3 manifypods_target
637
638  my $manifypods_target = $self->manifypods_target;
639
640Generates the manifypods target.  This target generates man pages from
641all POD files in MAN1PODS and MAN3PODS.
642
643=cut
644
645sub manifypods_target {
646    my($self) = shift;
647
648    my $man1pods      = '';
649    my $man3pods      = '';
650    my $dependencies  = '';
651
652    # populate manXpods & dependencies:
653    foreach my $name (keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}}) {
654        $dependencies .= " \\\n\t$name";
655    }
656
657    foreach my $name (keys %{$self->{MAN3PODS}}) {
658        $dependencies .= " \\\n\t$name"
659    }
660
661    my $manify = <<END;
662manifypods : pure_all $dependencies
663END
664
665    my @man_cmds;
666    foreach my $section (qw(1 3)) {
667        my $pods = $self->{"MAN${section}PODS"};
668	my $s = $section eq '3' ? '3p' : $section;
669        push @man_cmds, $self->split_command(<<CMD, %$pods);
670	\$(NOECHO) \$(POD2MAN) --section=$s --perm_rw=\$(PERM_RW)
671CMD
672    }
673
674    $manify .= "\t\$(NOECHO) \$(NOOP)\n" unless @man_cmds;
675    $manify .= join '', map { "$_\n" } @man_cmds;
676
677    return $manify;
678}
679
680
681=head3 metafile_target
682
683    my $target = $mm->metafile_target;
684
685Generate the metafile target.
686
687Writes the file META.yml YAML encoded meta-data about the module in
688the distdir.  The format follows Module::Build's as closely as
689possible.  Additionally, we include:
690
691    version_from
692    installdirs
693
694=cut
695
696sub metafile_target {
697    my $self = shift;
698
699    return <<'MAKE_FRAG' if $self->{NO_META};
700metafile:
701	$(NOECHO) $(NOOP)
702MAKE_FRAG
703
704    my $prereq_pm = '';
705    foreach my $mod ( sort { lc $a cmp lc $b } keys %{$self->{PREREQ_PM}} ) {
706        my $ver = $self->{PREREQ_PM}{$mod};
707        $prereq_pm .= sprintf "    %-30s %s\n", "$mod:", $ver;
708    }
709
710    my $meta = <<YAML;
711# http://module-build.sourceforge.net/META-spec.html
712#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
713name:         $self->{DISTNAME}
714version:      $self->{VERSION}
715version_from: $self->{VERSION_FROM}
716installdirs:  $self->{INSTALLDIRS}
717requires:
718$prereq_pm
719distribution_type: module
720generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
721YAML
722
723    my @write_meta = $self->echo($meta, 'META_new.yml');
724
725    return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta);
726metafile : create_distdir
727	$(NOECHO) $(ECHO) Generating META.yml
728	%s
729	-$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml
730MAKE_FRAG
731
732}
733
734
735=head3 distmeta_target
736
737    my $make_frag = $mm->distmeta_target;
738
739Generates the distmeta target to add META.yml to the MANIFEST in the
740distdir.
741
742=cut
743
744sub distmeta_target {
745    my $self = shift;
746
747    my $add_meta = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']);
748eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) }
749    or print "Could not add META.yml to MANIFEST: $${'@'}\n"
750CODE
751
752    my $add_meta_to_distdir = $self->cd('$(DISTVNAME)', $add_meta);
753
754    return sprintf <<'MAKE', $add_meta_to_distdir;
755distmeta : create_distdir metafile
756	$(NOECHO) %s
757
758MAKE
759
760}
761
762
763=head3 realclean (o)
764
765Defines the realclean target.
766
767=cut
768
769sub realclean {
770    my($self, %attribs) = @_;
771
772    my @dirs  = qw($(DISTVNAME));
773    my @files = qw($(FIRST_MAKEFILE) $(MAKEFILE_OLD));
774
775    # Special exception for the perl core where INST_* is not in blib.
776    # This cleans up the files built from the ext/ directory (all XS).
777    if( $self->{PERL_CORE} ) {
778	push @dirs, qw($(INST_AUTODIR) $(INST_ARCHAUTODIR));
779        push @files, values %{$self->{PM}};
780    }
781
782    if( $self->has_link_code ){
783        push @files, qw($(OBJECT));
784    }
785
786    if( $attribs{FILES} ) {
787        if( ref $attribs{FILES} ) {
788            push @dirs, @{ $attribs{FILES} };
789        }
790        else {
791            push @dirs, split /\s+/, $attribs{FILES};
792        }
793    }
794
795    # Occasionally files are repeated several times from different sources
796    { my(%f) = map { ($_ => 1) } @files;  @files = keys %f; }
797    { my(%d) = map { ($_ => 1) } @dirs;   @dirs  = keys %d; }
798
799    my $rm_cmd  = join "\n\t", map { "$_" }
800                    $self->split_command('- $(RM_F)',  @files);
801    my $rmf_cmd = join "\n\t", map { "$_" }
802                    $self->split_command('- $(RM_RF)', @dirs);
803
804    my $m = sprintf <<'MAKE', $rm_cmd, $rmf_cmd;
805# Delete temporary files (via clean) and also delete dist files
806realclean purge ::  clean realclean_subdirs
807	%s
808	%s
809MAKE
810
811    $m .= "\t$attribs{POSTOP}\n" if $attribs{POSTOP};
812
813    return $m;
814}
815
816
817=head3 realclean_subdirs_target
818
819  my $make_frag = $MM->realclean_subdirs_target;
820
821Returns the realclean_subdirs target.  This is used by the realclean
822target to call realclean on any subdirectories which contain Makefiles.
823
824=cut
825
826sub realclean_subdirs_target {
827    my $self = shift;
828
829    return <<'NOOP_FRAG' unless @{$self->{DIR}};
830realclean_subdirs :
831	$(NOECHO) $(NOOP)
832NOOP_FRAG
833
834    my $rclean = "realclean_subdirs :\n";
835
836    foreach my $dir (@{$self->{DIR}}) {
837        foreach my $makefile ('$(MAKEFILE_OLD)', '$(FIRST_MAKEFILE)' ) {
838            my $subrclean .= $self->oneliner(sprintf <<'CODE', $dir, ($makefile) x 2);
839chdir '%s';  system '$(MAKE) $(USEMAKEFILE) %s realclean' if -f '%s';
840CODE
841
842            $rclean .= sprintf <<'RCLEAN', $subrclean;
843	- %s
844RCLEAN
845
846        }
847    }
848
849    return $rclean;
850}
851
852
853=head3 signature_target
854
855    my $target = $mm->signature_target;
856
857Generate the signature target.
858
859Writes the file SIGNATURE with "cpansign -s".
860
861=cut
862
863sub signature_target {
864    my $self = shift;
865
866    return <<'MAKE_FRAG';
867signature :
868	cpansign -s
869MAKE_FRAG
870
871}
872
873
874=head3 distsignature_target
875
876    my $make_frag = $mm->distsignature_target;
877
878Generates the distsignature target to add SIGNATURE to the MANIFEST in the
879distdir.
880
881=cut
882
883sub distsignature_target {
884    my $self = shift;
885
886    my $add_sign = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']);
887eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) }
888    or print "Could not add SIGNATURE to MANIFEST: $${'@'}\n"
889CODE
890
891    my $sign_dist        = $self->cd('$(DISTVNAME)' => 'cpansign -s');
892
893    # cpansign -s complains if SIGNATURE is in the MANIFEST yet does not
894    # exist
895    my $touch_sig        = $self->cd('$(DISTVNAME)' => '$(TOUCH) SIGNATURE');
896    my $add_sign_to_dist = $self->cd('$(DISTVNAME)' => $add_sign );
897
898    return sprintf <<'MAKE', $add_sign_to_dist, $touch_sig, $sign_dist
899distsignature : create_distdir
900	$(NOECHO) %s
901	$(NOECHO) %s
902	%s
903
904MAKE
905
906}
907
908
909=head3 special_targets
910
911  my $make_frag = $mm->special_targets
912
913Returns a make fragment containing any targets which have special
914meaning to make.  For example, .SUFFIXES and .PHONY.
915
916=cut
917
918sub special_targets {
919    my $make_frag = <<'MAKE_FRAG';
920.SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
921
922.PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir
923
924MAKE_FRAG
925
926    $make_frag .= <<'MAKE_FRAG' if $ENV{CLEARCASE_ROOT};
927.NO_CONFIG_REC: Makefile
928
929MAKE_FRAG
930
931    return $make_frag;
932}
933
934
935
936
937=head2 Init methods
938
939Methods which help initialize the MakeMaker object and macros.
940
941
942=head3 init_INST
943
944    $mm->init_INST;
945
946Called by init_main.  Sets up all INST_* variables except those related
947to XS code.  Those are handled in init_xs.
948
949=cut
950
951sub init_INST {
952    my($self) = shift;
953
954    $self->{INST_ARCHLIB} ||= $self->catdir($Curdir,"blib","arch");
955    $self->{INST_BIN}     ||= $self->catdir($Curdir,'blib','bin');
956
957    # INST_LIB typically pre-set if building an extension after
958    # perl has been built and installed. Setting INST_LIB allows
959    # you to build directly into, say $Config{privlibexp}.
960    unless ($self->{INST_LIB}){
961	if ($self->{PERL_CORE}) {
962            if (defined $Cross::platform) {
963                $self->{INST_LIB} = $self->{INST_ARCHLIB} =
964                  $self->catdir($self->{PERL_LIB},"..","xlib",
965                                     $Cross::platform);
966            }
967            else {
968                $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB};
969            }
970	} else {
971	    $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib");
972	}
973    }
974
975    my @parentdir = split(/::/, $self->{PARENT_NAME});
976    $self->{INST_LIBDIR}      = $self->catdir('$(INST_LIB)',     @parentdir);
977    $self->{INST_ARCHLIBDIR}  = $self->catdir('$(INST_ARCHLIB)', @parentdir);
978    $self->{INST_AUTODIR}     = $self->catdir('$(INST_LIB)', 'auto',
979                                              '$(FULLEXT)');
980    $self->{INST_ARCHAUTODIR} = $self->catdir('$(INST_ARCHLIB)', 'auto',
981                                              '$(FULLEXT)');
982
983    $self->{INST_SCRIPT}  ||= $self->catdir($Curdir,'blib','script');
984
985    $self->{INST_MAN1DIR} ||= $self->catdir($Curdir,'blib','man1');
986    $self->{INST_MAN3DIR} ||= $self->catdir($Curdir,'blib','man3');
987
988    return 1;
989}
990
991
992=head3 init_INSTALL
993
994    $mm->init_INSTALL;
995
996Called by init_main.  Sets up all INSTALL_* variables (except
997INSTALLDIRS) and *PREFIX.
998
999=cut
1000
1001sub init_INSTALL {
1002    my($self) = shift;
1003
1004    if( $self->{ARGS}{INSTALLBASE} and $self->{ARGS}{PREFIX} ) {
1005        die "Only one of PREFIX or INSTALLBASE can be given.  Not both.\n";
1006    }
1007
1008    if( $self->{ARGS}{INSTALLBASE} ) {
1009        $self->init_INSTALL_from_INSTALLBASE;
1010    }
1011    else {
1012        $self->init_INSTALL_from_PREFIX;
1013    }
1014}
1015
1016
1017=head3 init_INSTALL_from_PREFIX
1018
1019  $mm->init_INSTALL_from_PREFIX;
1020
1021=cut
1022
1023sub init_INSTALL_from_PREFIX {
1024    my $self = shift;
1025
1026    $self->init_lib2arch;
1027
1028    # There are often no Config.pm defaults for these new man variables so
1029    # we fall back to the old behavior which is to use installman*dir
1030    foreach my $num (1, 3) {
1031        my $k = 'installsiteman'.$num.'dir';
1032
1033        $self->{uc $k} ||= uc "\$(installman${num}dir)"
1034          unless $Config{$k};
1035    }
1036
1037    foreach my $num (1, 3) {
1038        my $k = 'installvendorman'.$num.'dir';
1039
1040        unless( $Config{$k} ) {
1041            $self->{uc $k}  ||= $Config{usevendorprefix}
1042                              ? uc "\$(installman${num}dir)"
1043                              : '';
1044        }
1045    }
1046
1047    $self->{INSTALLSITEBIN} ||= '$(INSTALLBIN)'
1048      unless $Config{installsitebin};
1049
1050    unless( $Config{installvendorbin} ) {
1051        $self->{INSTALLVENDORBIN} ||= $Config{usevendorprefix}
1052                                    ? $Config{installbin}
1053                                    : '';
1054    }
1055
1056
1057    my $iprefix = $Config{installprefixexp} || $Config{installprefix} ||
1058                  $Config{prefixexp}        || $Config{prefix} || '';
1059    my $vprefix = $Config{usevendorprefix}  ? $Config{vendorprefixexp} : '';
1060    my $sprefix = $Config{siteprefixexp}    || '';
1061
1062    # 5.005_03 doesn't have a siteprefix.
1063    $sprefix = $iprefix unless $sprefix;
1064
1065
1066    $self->{PREFIX}       ||= '';
1067
1068    if( $self->{PREFIX} ) {
1069        @{$self}{qw(PERLPREFIX SITEPREFIX VENDORPREFIX)} =
1070          ('$(PREFIX)') x 3;
1071    }
1072    else {
1073        $self->{PERLPREFIX}   ||= $iprefix;
1074        $self->{SITEPREFIX}   ||= $sprefix;
1075        $self->{VENDORPREFIX} ||= $vprefix;
1076
1077        # Lots of MM extension authors like to use $(PREFIX) so we
1078        # put something sensible in there no matter what.
1079        $self->{PREFIX} = '$('.uc $self->{INSTALLDIRS}.'PREFIX)';
1080    }
1081
1082    my $arch    = $Config{archname};
1083    my $version = $Config{version};
1084
1085    # default style
1086    my $libstyle = $Config{installstyle} || 'lib/perl5';
1087    my $manstyle = '';
1088
1089    if( $self->{LIBSTYLE} ) {
1090        $libstyle = $self->{LIBSTYLE};
1091        $manstyle = $self->{LIBSTYLE} eq 'lib/perl5' ? 'lib/perl5' : '';
1092    }
1093
1094    # Some systems, like VOS, set installman*dir to '' if they can't
1095    # read man pages.
1096    for my $num (1, 3) {
1097        $self->{'INSTALLMAN'.$num.'DIR'} ||= 'none'
1098          unless $Config{'installman'.$num.'dir'};
1099    }
1100
1101    my %bin_layouts =
1102    (
1103        bin         => { s => $iprefix,
1104                         t => 'perl',
1105                         d => 'bin' },
1106        vendorbin   => { s => $vprefix,
1107                         t => 'vendor',
1108                         d => 'bin' },
1109        sitebin     => { s => $sprefix,
1110                         t => 'site',
1111                         d => 'bin' },
1112        script      => { s => $iprefix,
1113                         t => 'perl',
1114                         d => 'bin' },
1115    );
1116
1117    my %man_layouts =
1118    (
1119        man1dir         => { s => $iprefix,
1120                             t => 'perl',
1121                             d => 'man/man1',
1122                             style => $manstyle, },
1123        siteman1dir     => { s => $sprefix,
1124                             t => 'site',
1125                             d => 'man/man1',
1126                             style => $manstyle, },
1127        vendorman1dir   => { s => $vprefix,
1128                             t => 'vendor',
1129                             d => 'man/man1',
1130                             style => $manstyle, },
1131
1132        man3dir         => { s => $iprefix,
1133                             t => 'perl',
1134                             d => 'man/man3',
1135                             style => $manstyle, },
1136        siteman3dir     => { s => $sprefix,
1137                             t => 'site',
1138                             d => 'man/man3',
1139                             style => $manstyle, },
1140        vendorman3dir   => { s => $vprefix,
1141                             t => 'vendor',
1142                             d => 'man/man3',
1143                             style => $manstyle, },
1144    );
1145
1146    my %lib_layouts =
1147    (
1148        privlib     => { s => $iprefix,
1149                         t => 'perl',
1150                         d => '',
1151                         style => $libstyle, },
1152        vendorlib   => { s => $vprefix,
1153                         t => 'vendor',
1154                         d => '',
1155                         style => $libstyle, },
1156        sitelib     => { s => $sprefix,
1157                         t => 'site',
1158                         d => 'site_perl',
1159                         style => $libstyle, },
1160
1161        archlib     => { s => $iprefix,
1162                         t => 'perl',
1163                         d => "$version/$arch",
1164                         style => $libstyle },
1165        vendorarch  => { s => $vprefix,
1166                         t => 'vendor',
1167                         d => "$version/$arch",
1168                         style => $libstyle },
1169        sitearch    => { s => $sprefix,
1170                         t => 'site',
1171                         d => "site_perl/$version/$arch",
1172                         style => $libstyle },
1173    );
1174
1175
1176    # Special case for LIB.
1177    if( $self->{LIB} ) {
1178        foreach my $var (keys %lib_layouts) {
1179            my $Installvar = uc "install$var";
1180
1181            if( $var =~ /arch/ ) {
1182                $self->{$Installvar} ||=
1183                  $self->catdir($self->{LIB}, $Config{archname});
1184            }
1185            else {
1186                $self->{$Installvar} ||= $self->{LIB};
1187            }
1188        }
1189    }
1190
1191    my %type2prefix = ( perl    => 'PERLPREFIX',
1192                        site    => 'SITEPREFIX',
1193                        vendor  => 'VENDORPREFIX'
1194                      );
1195
1196    my %layouts = (%bin_layouts, %man_layouts, %lib_layouts);
1197    while( my($var, $layout) = each(%layouts) ) {
1198        my($s, $t, $d, $style) = @{$layout}{qw(s t d style)};
1199        my $r = '$('.$type2prefix{$t}.')';
1200
1201        print STDERR "Prefixing $var\n" if $Verbose >= 2;
1202
1203        my $installvar = "install$var";
1204        my $Installvar = uc $installvar;
1205        next if $self->{$Installvar};
1206
1207        $d = "$style/$d" if $style;
1208        $self->prefixify($installvar, $s, $r, $d);
1209
1210        print STDERR "  $Installvar == $self->{$Installvar}\n"
1211          if $Verbose >= 2;
1212    }
1213
1214    # Generate these if they weren't figured out.
1215    $self->{VENDORARCHEXP} ||= $self->{INSTALLVENDORARCH};
1216    $self->{VENDORLIBEXP}  ||= $self->{INSTALLVENDORLIB};
1217
1218    return 1;
1219}
1220
1221
1222=head3 init_from_INSTALLBASE
1223
1224    $mm->init_from_INSTALLBASE
1225
1226=cut
1227
1228my %map = (
1229           lib      => [qw(lib perl5)],
1230           arch     => [('lib', 'perl5', $Config{archname})],
1231           bin      => [qw(bin)],
1232           man1dir  => [qw(man man1)],
1233           man3dir  => [qw(man man3)]
1234          );
1235$map{script} = $map{bin};
1236
1237sub init_INSTALL_from_INSTALLBASE {
1238    my $self = shift;
1239
1240    @{$self}{qw(PREFIX VENDORPREFIX SITEPREFIX PERLPREFIX)} =
1241                                                         '$(INSTALLBASE)';
1242
1243    my %install;
1244    foreach my $thing (keys %map) {
1245        foreach my $dir (('', 'SITE', 'VENDOR')) {
1246            my $uc_thing = uc $thing;
1247            my $key = "INSTALL".$dir.$uc_thing;
1248
1249            $install{$key} ||=
1250              $self->catdir('$(INSTALLBASE)', @{$map{$thing}});
1251        }
1252    }
1253
1254    # Adjust for variable quirks.
1255    $install{INSTALLARCHLIB} ||= delete $install{INSTALLARCH};
1256    $install{INSTALLPRIVLIB} ||= delete $install{INSTALLLIB};
1257    delete @install{qw(INSTALLVENDORSCRIPT INSTALLSITESCRIPT)};
1258
1259    foreach my $key (keys %install) {
1260        $self->{$key} ||= $install{$key};
1261    }
1262
1263    return 1;
1264}
1265
1266
1267=head3 init_VERSION  I<Abstract>
1268
1269    $mm->init_VERSION
1270
1271Initialize macros representing versions of MakeMaker and other tools
1272
1273MAKEMAKER: path to the MakeMaker module.
1274
1275MM_VERSION: ExtUtils::MakeMaker Version
1276
1277MM_REVISION: ExtUtils::MakeMaker version control revision (for backwards
1278             compat)
1279
1280VERSION: version of your module
1281
1282VERSION_MACRO: which macro represents the version (usually 'VERSION')
1283
1284VERSION_SYM: like version but safe for use as an RCS revision number
1285
1286DEFINE_VERSION: -D line to set the module version when compiling
1287
1288XS_VERSION: version in your .xs file.  Defaults to $(VERSION)
1289
1290XS_VERSION_MACRO: which macro represents the XS version.
1291
1292XS_DEFINE_VERSION: -D line to set the xs version when compiling.
1293
1294Called by init_main.
1295
1296=cut
1297
1298sub init_VERSION {
1299    my($self) = shift;
1300
1301    $self->{MAKEMAKER}  = $ExtUtils::MakeMaker::Filename;
1302    $self->{MM_VERSION} = $ExtUtils::MakeMaker::VERSION;
1303    $self->{MM_REVISION}= $ExtUtils::MakeMaker::Revision;
1304    $self->{VERSION_FROM} ||= '';
1305
1306    if ($self->{VERSION_FROM}){
1307        $self->{VERSION} = $self->parse_version($self->{VERSION_FROM});
1308        if( $self->{VERSION} eq 'undef' ) {
1309            require Carp;
1310            Carp::carp("WARNING: Setting VERSION via file ".
1311                       "'$self->{VERSION_FROM}' failed\n");
1312        }
1313    }
1314
1315    # strip blanks
1316    if (defined $self->{VERSION}) {
1317        $self->{VERSION} =~ s/^\s+//;
1318        $self->{VERSION} =~ s/\s+$//;
1319    }
1320    else {
1321        $self->{VERSION} = '';
1322    }
1323
1324
1325    $self->{VERSION_MACRO}  = 'VERSION';
1326    ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g;
1327    $self->{DEFINE_VERSION} = '-D$(VERSION_MACRO)=\"$(VERSION)\"';
1328
1329
1330    # Graham Barr and Paul Marquess had some ideas how to ensure
1331    # version compatibility between the *.pm file and the
1332    # corresponding *.xs file. The bottomline was, that we need an
1333    # XS_VERSION macro that defaults to VERSION:
1334    $self->{XS_VERSION} ||= $self->{VERSION};
1335
1336    $self->{XS_VERSION_MACRO}  = 'XS_VERSION';
1337    $self->{XS_DEFINE_VERSION} = '-D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"';
1338
1339}
1340
1341
1342=head3 init_others  I<Abstract>
1343
1344    $MM->init_others();
1345
1346Initializes the macro definitions used by tools_other() and places them
1347in the $MM object.
1348
1349If there is no description, its the same as the parameter to
1350WriteMakefile() documented in ExtUtils::MakeMaker.
1351
1352Defines at least these macros.
1353
1354  Macro             Description
1355
1356  NOOP              Do nothing
1357  NOECHO            Tell make not to display the command itself
1358
1359  MAKEFILE
1360  FIRST_MAKEFILE
1361  MAKEFILE_OLD
1362  MAKE_APERL_FILE   File used by MAKE_APERL
1363
1364  SHELL             Program used to run
1365                    shell commands
1366
1367  ECHO              Print text adding a newline on the end
1368  RM_F              Remove a file
1369  RM_RF             Remove a directory
1370  TOUCH             Update a file's timestamp
1371  TEST_F            Test for a file's existence
1372  CP                Copy a file
1373  MV                Move a file
1374  CHMOD             Change permissions on a
1375                    file
1376
1377  UMASK_NULL        Nullify umask
1378  DEV_NULL          Supress all command output
1379
1380
1381=head3 init_DIRFILESEP  I<Abstract>
1382
1383  $MM->init_DIRFILESEP;
1384  my $dirfilesep = $MM->{DIRFILESEP};
1385
1386Initializes the DIRFILESEP macro which is the seperator between the
1387directory and filename in a filepath.  ie. / on Unix, \ on Win32 and
1388nothing on VMS.
1389
1390For example:
1391
1392    # instead of $(INST_ARCHAUTODIR)/extralibs.ld
1393    $(INST_ARCHAUTODIR)$(DIRFILESEP)extralibs.ld
1394
1395Something of a hack but it prevents a lot of code duplication between
1396MM_* variants.
1397
1398Do not use this as a seperator between directories.  Some operating
1399systems use different seperators between subdirectories as between
1400directories and filenames (for example:  VOLUME:[dir1.dir2]file on VMS).
1401
1402=head3 init_linker  I<Abstract>
1403
1404    $mm->init_linker;
1405
1406Initialize macros which have to do with linking.
1407
1408PERL_ARCHIVE: path to libperl.a equivalent to be linked to dynamic
1409extensions.
1410
1411PERL_ARCHIVE_AFTER: path to a library which should be put on the
1412linker command line I<after> the external libraries to be linked to
1413dynamic extensions.  This may be needed if the linker is one-pass, and
1414Perl includes some overrides for C RTL functions, such as malloc().
1415
1416EXPORT_LIST: name of a file that is passed to linker to define symbols
1417to be exported.
1418
1419Some OSes do not need these in which case leave it blank.
1420
1421
1422=head3 init_platform
1423
1424    $mm->init_platform
1425
1426Initialize any macros which are for platform specific use only.
1427
1428A typical one is the version number of your OS specific mocule.
1429(ie. MM_Unix_VERSION or MM_VMS_VERSION).
1430
1431=cut
1432
1433sub init_platform {
1434    return '';
1435}
1436
1437
1438
1439
1440
1441=head2 Tools
1442
1443A grab bag of methods to generate specific macros and commands.
1444
1445
1446
1447=head3 manifypods
1448
1449Defines targets and routines to translate the pods into manpages and
1450put them into the INST_* directories.
1451
1452=cut
1453
1454sub manifypods {
1455    my $self          = shift;
1456
1457    my $POD2MAN_macro = $self->POD2MAN_macro();
1458    my $manifypods_target = $self->manifypods_target();
1459
1460    return <<END_OF_TARGET;
1461
1462$POD2MAN_macro
1463
1464$manifypods_target
1465
1466END_OF_TARGET
1467
1468}
1469
1470
1471=head3 POD2MAN_macro
1472
1473  my $pod2man_macro = $self->POD2MAN_macro
1474
1475Returns a definition for the POD2MAN macro.  This is a program
1476which emulates the pod2man utility.  You can add more switches to the
1477command by simply appending them on the macro.
1478
1479Typical usage:
1480
1481    $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) podfile1 man_page1 ...
1482
1483=cut
1484
1485sub POD2MAN_macro {
1486    my $self = shift;
1487
1488# Need the trailing '--' so perl stops gobbling arguments and - happens
1489# to be an alternative end of line seperator on VMS so we quote it
1490    return <<'END_OF_DEF';
1491POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--"
1492POD2MAN = $(POD2MAN_EXE)
1493END_OF_DEF
1494}
1495
1496
1497=head3 test_via_harness
1498
1499  my $command = $mm->test_via_harness($perl, $tests);
1500
1501Returns a $command line which runs the given set of $tests with
1502Test::Harness and the given $perl.
1503
1504Used on the t/*.t files.
1505
1506=cut
1507
1508sub test_via_harness {
1509    my($self, $perl, $tests) = @_;
1510
1511    return qq{\t$perl "-MExtUtils::Command::MM" }.
1512           qq{"-e" "test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests\n};
1513}
1514
1515=head3 test_via_script
1516
1517  my $command = $mm->test_via_script($perl, $script);
1518
1519Returns a $command line which just runs a single test without
1520Test::Harness.  No checks are done on the results, they're just
1521printed.
1522
1523Used for test.pl, since they don't always follow Test::Harness
1524formatting.
1525
1526=cut
1527
1528sub test_via_script {
1529    my($self, $perl, $script) = @_;
1530    return qq{\t$perl "-I\$(INST_LIB)" "-I\$(INST_ARCHLIB)" $script\n};
1531}
1532
1533
1534=head3 tool_autosplit
1535
1536Defines a simple perl call that runs autosplit. May be deprecated by
1537pm_to_blib soon.
1538
1539=cut
1540
1541sub tool_autosplit {
1542    my($self, %attribs) = @_;
1543
1544    my $maxlen = $attribs{MAXLEN} ? '$$AutoSplit::Maxlen=$attribs{MAXLEN};'
1545                                  : '';
1546
1547    my $asplit = $self->oneliner(sprintf <<'PERL_CODE', $maxlen);
1548use AutoSplit; %s autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1)
1549PERL_CODE
1550
1551    return sprintf <<'MAKE_FRAG', $asplit;
1552# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
1553AUTOSPLITFILE = %s
1554
1555MAKE_FRAG
1556
1557}
1558
1559
1560
1561
1562=head2 File::Spec wrappers
1563
1564ExtUtils::MM_Any is a subclass of File::Spec.  The methods noted here
1565override File::Spec.
1566
1567
1568
1569=head3 catfile
1570
1571File::Spec <= 0.83 has a bug where the file part of catfile is not
1572canonicalized.  This override fixes that bug.
1573
1574=cut
1575
1576sub catfile {
1577    my $self = shift;
1578    return $self->canonpath($self->SUPER::catfile(@_));
1579}
1580
1581
1582
1583=head2 Misc
1584
1585Methods I can't really figure out where they should go yet.
1586
1587
1588=head3 find_tests
1589
1590  my $test = $mm->find_tests;
1591
1592Returns a string suitable for feeding to the shell to return all
1593tests in t/*.t.
1594
1595=cut
1596
1597sub find_tests {
1598    my($self) = shift;
1599    return -d 't' ? 't/*.t' : '';
1600}
1601
1602
1603=head3 extra_clean_files
1604
1605    my @files_to_clean = $MM->extra_clean_files;
1606
1607Returns a list of OS specific files to be removed in the clean target in
1608addition to the usual set.
1609
1610=cut
1611
1612# An empty method here tickled a perl 5.8.1 bug and would return its object.
1613sub extra_clean_files {
1614    return;
1615}
1616
1617
1618=head3 installvars
1619
1620    my @installvars = $mm->installvars;
1621
1622A list of all the INSTALL* variables without the INSTALL prefix.  Useful
1623for iteration or building related variable sets.
1624
1625=cut
1626
1627sub installvars {
1628    return qw(PRIVLIB SITELIB  VENDORLIB
1629              ARCHLIB SITEARCH VENDORARCH
1630              BIN     SITEBIN  VENDORBIN
1631              SCRIPT
1632              MAN1DIR SITEMAN1DIR VENDORMAN1DIR
1633              MAN3DIR SITEMAN3DIR VENDORMAN3DIR
1634             );
1635}
1636
1637
1638=head3 libscan
1639
1640  my $wanted = $self->libscan($path);
1641
1642Takes a path to a file or dir and returns an empty string if we don't
1643want to include this file in the library.  Otherwise it returns the
1644the $path unchanged.
1645
1646Mainly used to exclude version control administrative directories from
1647installation.
1648
1649=cut
1650
1651sub libscan {
1652    my($self,$path) = @_;
1653    my($dirs,$file) = ($self->splitpath($path))[1,2];
1654    return '' if grep /^(?:RCS|CVS|SCCS|\.svn|_darcs)$/,
1655                     $self->splitdir($dirs), $file;
1656
1657    return $path;
1658}
1659
1660
1661=head3 platform_constants
1662
1663    my $make_frag = $mm->platform_constants
1664
1665Returns a make fragment defining all the macros initialized in
1666init_platform() rather than put them in constants().
1667
1668=cut
1669
1670sub platform_constants {
1671    return '';
1672}
1673
1674
1675=head1 AUTHOR
1676
1677Michael G Schwern <schwern@pobox.com> and the denizens of
1678makemaker@perl.org with code from ExtUtils::MM_Unix and
1679ExtUtils::MM_Win32.
1680
1681
1682=cut
1683
16841;
1685