ExtUtils::MakeMaker

Writes a Makefile for use during module installation. Provides a function, WriteMakefile, which creates an object whose attributes are set from various sources and which actually writes the Makefile. See for information about the use of the Makefile and MakeMaker during module installation. This section explains the details of actually creating the Makefile with MakeMaker. It assumes an understanding of make and Makefiles.

If you are a Perl developer writing a module, you should run h2xs to generate the template for your module. Among other things, h2xs creates a file called Makefile.PL, and it's Makefile.PL that runs MakeMaker. On the other hand, if you are installing a module, you can usually just run the Makefile.PL that came with the module, perhaps adding a PREFIX argument if you are installing the module locally (see ). In either case, you shouldn't need to run ExtUtils::MakeMaker directly unless you have special requirements.

A typical call to MakeMaker might look like this example from the CGI distribution:

use ExtUtils::MakeMaker; WriteMakefile( NAME => "CGI", DISTNAME => "CGI-modules", VERSION => "2.76", linkext => {
 LINKTYPE => '' }, dist => {COMPRESS=>'gzip -9f', SUFFIX => 'gz'}, );


MakeMaker attributes can be passed as arguments to WriteMakefile, as in the example, or they can be passed as name=value pairs on the command line:

perl Makefile.PL PREFIX=/home/mydir/Perl/Modules


To see what MakeMaker is doing, you can say:

perl Makefile.PL verbose


The following attributes can be specified:

The following lowercase attributes can be used to pass parameters to the methods that implement the corresponding part of the Makefile:

If specifying attributes isn't sufficient to accomplish what you want, you can define your own subroutines in the Makefile.PL that returns the text to be written to the Makefile. You can also override MakeMaker's subroutines (described in "ExtUtils::MM_Unix") this way.