use ExtUtils::MakeMaker;
use Config;
use English;

@extras = ();

push(@extras,
     CAPI => 'TRUE')
    if ($PERL_VERSION >= 5.005 and $OSNAME eq 'MSWin32'
	and $Config{archname} =~ /-object\b/i);

push(@extras,
     ABSTRACT => 'XML processing modules',
     AUTHOR   => 'Eric Prud\'hommeaux (eric@w3.org)')
    if ($ExtUtils::MakeMaker::Version >= 5.4301);
     
WriteMakefile(
              NAME         => 'W3C::XML::Kit',
              VERSION => 1.0,
              PREREQ_PM    => { W3C::Util::Exception => 1.0, URI => 0, XML::DOM => 0 },
              dist      => {COMPRESS => 'gzip', SUFFIX => '.gz'},
	      @extras
             );

sub MY::postamble {
    return <<EOF;

PARSERS = RelaxNGParser.pm \\
	  XPathParser.pm \\
	  XPathRegexpParser.pm

YAPPS := \$(patsubst \%.pm,\%.yp,\$(PARSERS))

parsers: \$(PARSERS)

\$(PARSERS): \%.pm: \%.yp
	yapp -m W3C::XML::_\$(basename \$\@) -v -o \$\@ -b '/usr/bin/perl' \$\<
	perl -pi -e "s/use Parse::Yapp::Driver;/# use Parse::Yapp::Driver; @@ replaced by W3C::Util::YappDriver/g" \$\@

EOF
}
