The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
BEGIN{if ($^O =~ /MSWin/) {
  print "getting dosglob...\n";
  require File::DosGlob;
  File::DosGlob->import('glob');}
}
use ExtUtils::MakeMaker;

@pods = map { $_=~s/.pod//; $_ } grep { ! m/Index.pod/ } glob("*.pod");


# do we want to create PP-Inline?
eval 'require Pod::Select';
if (!$@ && $] >= 5.005 ) {
    push @pods, 'PP-Inline' unless grep {/PP-Inline/} @pods;
}

# DISABLED
# push @pods, 'Export';


my @man1 = map { $_.".pod", '$(INST_MAN1DIR)/PDL::' . $_ . '.$(MAN1EXT)' } @pods;

my @pms  = map { $_.".pod", '$(INST_LIBDIR)/' . $_ .".pod"} @pods;

WriteMakefile(
 'NAME' =>      'PDL::pod',

 'MAN1PODS' =>  { @man1 },
 'MAN3PODS' =>  { },
 'PM'    =>     { @pms },
 'clean' => {FILES => "PP-Inline.pod"},
 'linkext' =>   {LINKTYPE => ''},  # No linking required in this directory
 (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
);

sub MY::postamble {
  my $text = '';
  eval 'require Pod::Select';
  if (!$@ && $] >= 5.005 ) {
     $text .= << "EOPS" ;

PP-Inline.pod: ../Gen/Inline/Pdlpp.pm
\t\$(PERLRUN) -MPod::Select -e "podselect('../Gen/Inline/Pdlpp.pm');" > PP-Inline.pod

EOPS

  }
  $text;
}