Permalink
Browse files

Call `perl Makefile.PL -PROFILE` to use gcov/gprov

  • Loading branch information...
1 parent 15f58ce commit e48e3c4d9fd12e016a97a603d08f0989dedaa2e6 @stash committed Sep 16, 2010
Showing with 34 additions and 1 deletion.
  1. +3 −0 .gitignore
  2. +31 −1 Makefile.PL
View
@@ -6,3 +6,6 @@ Makefile
Makefile.old
blib/
pm_to_blib
+*.gcno
+*.gcda
+*.gcov
View
@@ -2,6 +2,35 @@ use 5.008007;
use ExtUtils::MakeMaker;
use EV::MakeMaker qw/ev_args/;
+
+{
+ package MY;
+ sub test_via_harness {
+ my($self, $perl, $tests) = @_;
+ local $_ = $self->SUPER::test_via_harness($perl, $tests);
+ s/PERL_DL_NONLAZY=1//g;
+ return $_;
+ }
+ sub test_via_script {
+ my($self, $perl, $tests) = @_;
+ local $_ = $self->SUPER::test_via_script($perl, $tests);
+ s/PERL_DL_NONLAZY=1//g;
+ return $_;
+ }
+}
+
+my $otherldflags = '';
+if ($ARGV[0] eq '-DEBUG') {
+ shift @ARGV;
+ unshift @ARGV, "OPTIMIZE=-DDEBUG -DDEBUGGING -g";
+}
+elsif ($ARGV[0] eq '-PROFILE') {
+ shift @ARGV;
+ unshift @ARGV, "OPTIMIZE=-g -pg -fprofile-arcs -ftest-coverage";
+ $otherldflags = '-lgcov';
+}
+
+
# Set this to false if you get core-dumps.
# Look for FEERSUM_STEAL in the code to see what this does.
my $steal = 1;
@@ -23,9 +52,10 @@ WriteMakefile(ev_args(
'Test::Differences' => 0,
'Test::Exception' => 0,
},
- LIBS => [''], # e.g., '-lm'
+ LIBS => [''],
DEFINE => ($steal ? '-DFEERSUM_STEAL' : ''),
INC => '-I.', # e.g., '-I. -I/usr/include/other'
# Un-comment this if you add C files to link with later:
# OBJECT => '$(O_FILES)', # link all the C files too
+ dynamic_lib => {OTHERLDFLAGS => $otherldflags},
));

0 comments on commit e48e3c4

Please sign in to comment.