use strict;
use warnings;
-use Config;
-use ExtUtils::MakeMaker;
-
-warn <<'EOF';
-
- ********************************* WARNING **********************************
-
- This module uses Dist::Zilla for development. This Makefile.PL will let you
- run the tests, but you are encouraged to install Dist::Zilla and the needed
- plugins if you intend on doing any serious hacking.
-
- ****************************************************************************
-
-EOF
-
-my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.';
-$ccflags .= ' -Wall -Wdeclaration-after-statement';
-
-my %mm = ( CCFLAGS => $ccflags );
-
-{
- my (@OBJECT, %XS);
-
- for my $xs (<xs/*.xs>) {
- (my $c = $xs) =~ s/\.xs$/.c/i;
- (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i;
-
- $XS{$xs} = $c;
- push @OBJECT, $o;
+BEGIN {
+ eval { require ExtUtils::MakeMaker::Dist::Zilla::Develop };
+ if ($@) {
+ warn
+ "You need to install ExtUtils::MakeMaker::Dist::Zilla::Develop to run this Makefile.PL\n";
+ exit 1;
}
- for my $c (<*.c>) {
- (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i;
- push @OBJECT, $o;
+ eval { require Test::Inline };
+ if ($@) {
+ warn "You need to install Test::Inline to run this Makefile.PL\n";
+ exit 1;
}
- %mm = (
- %mm,
- clean => { FILES => join( q{ }, @OBJECT ) },
- OBJECT => join( q{ }, @OBJECT ),
- XS => \%XS,
- );
+ ExtUtils::MakeMaker::Dist::Zilla::Develop->import();
}
-WriteMakefile(
- NAME => 'Moose',
- %mm,
-);
-
-package MY;
+use lib 'inc';
-use Config;
+use MMHelper;
+use MyInline;
-sub const_cccmd {
- my $ret = shift->SUPER::const_cccmd(@_);
- return q{} unless $ret;
+system( $^X, 'author/extract-inline-tests', '--quiet' );
- if ($Config{cc} =~ /^cl\b/i) {
- warn 'you are using MSVC... my condolences.';
- $ret .= ' /Fo$@';
- }
- else {
- $ret .= ' -o $@';
- }
+eval MMHelper::my_package_subs();
- return $ret;
-}
-
-sub postamble {
- return <<'EOF';
-$(OBJECT) : mop.h
-EOF
-}
+WriteMakefile(
+ NAME => 'Moose',
+ test => { TESTS => 't/*.t t/*/*.t' },
+ CCFLAGS => MMHelper::ccflags_static('dev'),
+ MMHelper::mm_args(),
+);