Is there a way to have a custom Makefile target to be generated by ExtUtils::MakeMaker? Say, I'd like to do some specific things that only a developer is interested in, like running pod and regression tests; I can use env variables for that but that's a bit unwieldy to remember things like that. Being able to run something like make devtest
instead would be mighty handy.
Asked
Active
Viewed 441 times
6

Alex Tokarev
- 4,821
- 1
- 20
- 30
1 Answers
3
Regression Testing with ExtUtils::MakeMaker
By default, MakeMaker makefiles come with a test
target which runs all of the regression tests in test.pl
in the current directory as well as all files matching glob("t/*.t")
when you run make test
. Your typical usage should be:
perl Makefile.PL
make
make test
make install
You can define your own make
targets, there's some information about the variables you can set in the CPAN documentation for the module as well as the manpage.
This is the example from the CPAN article:
sub MY::postamble {
return <<'MAKE_FRAG';
$(MYEXTLIB): sdbm/Makefile
cd sdbm && $(MAKE) all
MAKE_FRAG
}

Glitch Desire
- 14,632
- 7
- 43
- 55
-
1I've read the CPAN doc for MakeMaker, it's extremely vague on how to do this. – mcandre Feb 12 '14 at 18:15
-
Not sure where exactly you've seen the information on how to define custom make targets in MakeMaker docs; please clarify. – Alex Tokarev Feb 12 '14 at 18:50
-
@AlexTokarev I've added the example of a custom target [from here](http://www.cse.unsw.edu.au/~cs2041/doc/perldoc-html-5.10.0/ExtUtils/MakeMaker.html#Overriding-MakeMaker-Methods) to my answer. – Glitch Desire Feb 13 '14 at 11:05
-
Thanks, that should work! That paragraph is really tiny, no wonder I overlooked it. – Alex Tokarev Feb 13 '14 at 18:43