sub get_pp_tests {
opendir my $dh, 't' or die "Cannot read t: $!";
- return map {
- File::Spec->catfile('t', "pp_${_}")
- } grep { $_ !~ /^99/ } grep {/^\d.+\.t$/} readdir $dh;
+ return grep { $_ !~ /^99/ } grep {/^\d.+\.t$/} readdir $dh;
}
# This is EUMM voodoo
package MY;
sub postamble {
- my $pp_tests = join q{ }, ::get_pp_tests();
- my $test_dep = $::has_compiler && (::is_maintainer() || $ENV{AUTOMATED_TESTING});
- ? 'pure_all :: pp_tests'
+ my @test_files = ::get_pp_tests();
+ my $pp_tests = join q{ }, map { File::Spec->catfile('t', "pp_${_}") } @test_files;
+ my @pp_test_targets = join qq{\n}, map {
+ my $source = File::Spec->catfile('t', ${_});
+ File::Spec->catfile('t', "pp_${_}") . q{: }
+ . qq{$source t/header_pp.inc\n\t}
+ . q{$(NOECHO) $(ABSPERLRUN) "-MExtUtils::Command" -e cat t/header_pp.inc }
+ . $source . q{ > $@} . qq{\n}
+ } @test_files;
+ my $test_dep = $::has_compiler && (::is_maintainer() || $ENV{AUTOMATED_TESTING})
+ ? qq{pure_all :: pp_tests\n} . join qq{\n}, @pp_test_targets
: '';
return <<"EOM"
${test_dep}
-t/pp_%: t/% t/header_pp.inc
-\t\$(NOECHO) \$(ABSPERLRUN) "-MExtUtils::Command" -e cat t/header_pp.inc \$< > \$@
EOM
}