WriteMakefile(
NAME => 'Moose',
test => { TESTS => 't/*.t t/*/*.t' },
- MMHelper::mm_args('dev'),
+ CCFLAGS => MMHelper::ccflags_static('dev'),
+ MMHelper::mm_args(),
);
use Cwd qw( abs_path );
use File::Basename qw( dirname );
-sub mm_args {
+sub ccflags_dyn {
my $is_dev = shift;
- my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.';
- $ccflags .= ' -Wall -Wdeclaration-after-statement'
+ my $ccflags = q<( $Config::Config{ccflags} || '' ) . ' -I.'>;
+ $ccflags .= q< . ' -Wall -Wdeclaration-after-statement'>
if $is_dev;
- my %mm = ( CCFLAGS => $ccflags );
+ return $ccflags;
+}
+
+sub ccflags_static {
+ my $is_dev = shift;
+ return eval(ccflags_dyn($is_dev));
+}
+
+sub mm_args {
my ( @object, %xs );
for my $xs ( glob "xs/*.xs" ) {
}
return (
- CCFLAGS => $ccflags,
clean => { FILES => join( q{ }, @object ) },
OBJECT => join( q{ }, @object ),
XS => \%xs,
my $tmpl = super();
+ my $ccflags = MMHelper::ccflags_dyn();
+ $tmpl =~ s/^(WriteMakefile\()/\$WriteMakefileArgs{CCFLAGS} = $ccflags;\n\n$1/m;
+
return $tmpl . "\n\n" . MMHelper::my_package_subs();
};