home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl_mlb.zip / ExtUtils / MM_Win32.pm < prev    next >
Text File  |  1997-11-25  |  21KB  |  785 lines

  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.       unless $self->{SKIPHASH}{'all'};
  626.     
  627.     push @m, '
  628. pure_all :: config pm_to_blib subdirs linkext
  629.     '.$self->{NOECHO}.'$(NOOP)
  630.  
  631. subdirs :: $(MYEXTLIB)
  632.     '.$self->{NOECHO}.'$(NOOP)
  633.  
  634. config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)\.exists
  635.     '.$self->{NOECHO}.'$(NOOP)
  636.  
  637. config :: $(INST_ARCHAUTODIR)\.exists
  638.     '.$self->{NOECHO}.'$(NOOP)
  639.  
  640. config :: $(INST_AUTODIR)\.exists
  641.     '.$self->{NOECHO}.'$(NOOP)
  642. ';
  643.  
  644.     push @m, qq{
  645. config :: Version_check
  646.     $self->{NOECHO}\$(NOOP)
  647.  
  648. } unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC};
  649.  
  650.     push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
  651.  
  652.     if (%{$self->{MAN1PODS}}) {
  653.     push @m, qq[
  654. config :: \$(INST_MAN1DIR)\\.exists
  655.     $self->{NOECHO}\$(NOOP)
  656.  
  657. ];
  658.     push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
  659.     }
  660.     if (%{$self->{MAN3PODS}}) {
  661.     push @m, qq[
  662. config :: \$(INST_MAN3DIR)\\.exists
  663.     $self->{NOECHO}\$(NOOP)
  664.  
  665. ];
  666.     push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
  667.     }
  668.  
  669.     push @m, '
  670. $(O_FILES): $(H_FILES)
  671. ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
  672.  
  673.     push @m, q{
  674. help:
  675.     perldoc ExtUtils::MakeMaker
  676. };
  677.  
  678.     push @m, q{
  679. Version_check:
  680.     }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
  681.         -MExtUtils::MakeMaker=Version_check \
  682.         -e "Version_check('$(MM_VERSION)')"
  683. };
  684.  
  685.     join('',@m);
  686. }
  687.  
  688. =item manifypods (o)
  689.  
  690. We don't want manpage process.  XXX add pod2html support later.
  691.  
  692. =cut
  693.  
  694. sub manifypods {
  695.     return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n";
  696. }
  697.  
  698. =item dist_ci (o)
  699.  
  700. Same as MM_Unix version (changes command-line quoting).
  701.  
  702. =cut
  703.  
  704. sub dist_ci {
  705.     my($self) = shift;
  706.     my @m;
  707.     push @m, q{
  708. ci :
  709.     $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\
  710.         -e "@all = keys %{ maniread() };" \\
  711.         -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\
  712.         -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");"
  713. };
  714.     join "", @m;
  715. }
  716.  
  717. =item dist_core (o)
  718.  
  719. Same as MM_Unix version (changes command-line quoting).
  720.  
  721. =cut
  722.  
  723. sub dist_core {
  724.     my($self) = shift;
  725.     my @m;
  726.     push @m, q{
  727. dist : $(DIST_DEFAULT)
  728.     }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \
  729.         -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";"
  730.  
  731. tardist : $(DISTVNAME).tar$(SUFFIX)
  732.  
  733. zipdist : $(DISTVNAME).zip
  734.  
  735. $(DISTVNAME).tar$(SUFFIX) : distdir
  736.     $(PREOP)
  737.     $(TO_UNIX)
  738.     $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
  739.     $(RM_RF) $(DISTVNAME)
  740.     $(COMPRESS) $(DISTVNAME).tar
  741.     $(POSTOP)
  742.  
  743. $(DISTVNAME).zip : distdir
  744.     $(PREOP)
  745.     $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
  746.     $(RM_RF) $(DISTVNAME)
  747.     $(POSTOP)
  748.  
  749. uutardist : $(DISTVNAME).tar$(SUFFIX)
  750.     uuencode $(DISTVNAME).tar$(SUFFIX) \\
  751.         $(DISTVNAME).tar$(SUFFIX) > \\
  752.         $(DISTVNAME).tar$(SUFFIX)_uu
  753.  
  754. shdist : distdir
  755.     $(PREOP)
  756.     $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
  757.     $(RM_RF) $(DISTVNAME)
  758.     $(POSTOP)
  759. };
  760.     join "", @m;
  761. }
  762.  
  763. =item pasthru (o)
  764.  
  765. Defines the string that is passed to recursive make calls in
  766. subdirectories.
  767.  
  768. =cut
  769.  
  770. sub pasthru {
  771.     my($self) = shift;
  772.     return "PASTHRU = " . ($NMAKE ? "-nologo" : "");
  773. }
  774.  
  775.  
  776.  
  777. 1;
  778. __END__
  779.  
  780. =back
  781.  
  782. =cut 
  783.  
  784.