📄 ch08_74.htm
字号:
<html><head><title>ExtUtils::MakeMaker (Perl in a Nutshell, 2nd Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Stephen Spainhour" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly & Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="0596002416L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="Perl in a Nutshell, 2nd Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" usemap="#banner-map" border="0" alt="Book Home" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Java and XSLT" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch08_73.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228" /><td align="right" valign="top" width="228"><a href="ch08_75.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h2 class="sect1">8.74. ExtUtils::MakeMaker</h2><p><a name="INDEX-1419" />Writes a Makefile for moduleinstallation. Provides a function, <tt class="literal">WriteMakefile</tt>,which creates an object with attributes that are set from varioussources and that actually write the Makefile. See <a href="ch02_01.htm">Chapter 2, "Installing Perl"</a> for information about the using the Makefileand MakeMaker during module installation. This section explains thedetails of actually creating the Makefile with MakeMaker. It assumesan understanding of <em class="emphasis">make</em> and Makefiles.</p><p>If you are a Perl programmer writing a module, you should run<em class="emphasis">h2xs</em> to generate the template for your module.Among other things, <em class="emphasis">h2xs</em> creates a file called<em class="emphasis">Makefile.PL</em>, and it's<em class="emphasis">Makefile.PL</em> that runs MakeMaker. On the otherhand, if you are installing a module, you can usually just run the<em class="emphasis">Makefile.PL</em> that came with the module, perhapsadding a PREFIX argument if you are installing the module locally(see <a href="ch02_01.htm">Chapter 2, "Installing Perl"</a>). In either case, youshouldn't need to run ExtUtils::MakeMaker directlyunless you have special requirements.</p><p>A typical call to MakeMaker might look like this example from the CGIdistribution:</p><blockquote><pre class="code">use ExtUtils::MakeMaker;WriteMakefile( NAME => "CGI", DISTNAME => "CGI-modules", VERSION => "2.76", linkext => { LINKTYPE => '' }, dist => {COMPRESS=>'gzip -9f', SUFFIX => 'gz'},);</pre></blockquote><p>MakeMaker attributes can be passed as arguments to<tt class="literal">WriteMakefile</tt>, as in the example, or they can bepassed as <em class="emphasis">name=value</em> pairs on the command line:</p><blockquote><pre class="code">perl Makefile.PL PREFIX=/home/mydir/Perl/Modules</pre></blockquote><p>To see what MakeMaker is doing, you can say: </p><blockquote><pre class="code">perl Makefile.PL verbose</pre></blockquote><p>The following attributes can be specified:</p><dl><dt><i>C</i></dt><dd>Reference to array of <em class="emphasis">*.c</em> filenames. Initializedfrom a directory scan and the values portion of the XS attributehash. Not currently used by MakeMaker but may be handy in<em class="emphasis">Makefile.PL</em>s.</p></dd><dt><i>CCFLAGS</i></dt><dd>String to be included in the compiler call command line between theINC and OPTIMIZE arguments.</p></dd><dt><i>CONFIG</i></dt><dd>An array reference containing a list of attributes to get from<tt class="literal">%Config</tt>. The following values are always added toCONFIG:</p><blockquote><pre class="code">ar cc cccdlflags ccdlflagsdlext dlsrc ld lddlflagsldflags libc lib_ext obj_extranlib sitelibexp sitearchexp so</pre></blockquote></dd><dt><i>CONFIGURE</i></dt><dd>Reference to a subroutine that should return a hash reference. Thehash may contain further attributes that need to be determined bysome evaluation method.</p></dd><dt><i>DEFINE</i></dt><dd>An attribute containing additional defines.</p></dd><dt><i>DIR</i></dt><dd>Reference to array of subdirectories containing<em class="emphasis">Makefile.PL</em> files.</p></dd><dt><i>DISTNAME</i></dt><dd>Your name for distributing the package (by <em class="emphasis">tar</em>file). Defaults to NAME, which is described below.</p></dd><dt><i>DL_FUNCS</i></dt><dd>Reference to a hash of symbol names for routines to be made availableas universal symbols. Each key/value pair consists of the packagename and an array of routine names in that package. Used only underAIX (export lists) and VMS (linker options) at present. Defaults to<tt class="literal">"$PKG" => ["boot_$PKG"]</tt>.</p></dd><dt><i>DL_VARS</i></dt><dd>Array of symbol names for variables to be made available as universalsymbols. Used only under AIX (export lists) and VMS (linker options)at present. Defaults to <tt class="literal">[]</tt>.</p></dd><dt><i>EXCLUDE_EXT</i></dt><dd>Array of module names to exclude when doing a static build. Ignoredif INCLUDE_EXT is present.</p></dd><dt><i>EXE_FILES</i></dt><dd>Reference to array of executable files to be copied to theINST_SCRIPT directory. <em class="emphasis">make realclean</em> deletesthem from there.</p></dd><dt><i>NO_VC</i></dt><dd>If set, the Makefile does not check the current version of MakeMakeragainst the version the Makefile was built under. Should be usedinteractively, not written into your <em class="emphasis">Makefile.PL</em>file.</p></dd><dt><i>FIRST_MAKEFILE</i></dt><dd>Name of the Makefile to be produced. Defaults to the contents ofMAKEFILE, but can be overridden.</p></dd><dt><i>FULLPERL</i></dt><dd>Perl binary that can run this module.</p></dd><dt><i>H</i></dt><dd>Reference to array of <em class="emphasis">*.h</em> filenames. Similar toC attribute.</p></dd><dt><i>IMPORTS</i></dt><dd>Used only on OS/2.</p></dd><dt><i>INC</i></dt><dd>Directories containing include files, in <em class="emphasis">-I</em>form. For example:</p><blockquote><pre class="code">INC => "-I/usr/5include -I/path/to/inc"</pre></blockquote></dd><dt><i>INCLUDE_EXT</i></dt><dd>Array of module names to be included when doing a static build. Ifpresent, only those modules that are explicitly mentioned are usedfor the build (instead of all installed extensions). It is notnecessary to mention DynaLoader or the current module when filling inINCLUDE_EXT—they are always included.</p></dd><dt><i>INSTALLARCHLIB</i></dt><dd>Used by <em class="emphasis">make install</em>, which copies files fromINST_ARCHLIB to this directory if INSTALLDIRS is set to<em class="emphasis">perl</em>.</p></dd><dt><i>INSTALLBIN</i></dt><dd>Directory to install binary files into.</p></dd><dt><i>INSTALLDIRS</i></dt><dd>Determines which of the two sets of installation directories tochoose. There are two possible values:</p><dl><dt><b><tt class="literal">perl</tt></b></dt><dd>Uses INSTALLLPRIVLIB and INSTALLARCHLIB directories.</p></dd><dt><b><tt class="literal">site</tt></b></dt><dd>The default. Uses INSTALLSITELIB and INSTALLSITEARCH directories.</p></dd></dl></dd><dt><i>INSTALLMAN1DIR</i></dt><dd>Directory where command manpages are put during <em class="emphasis">makeinstall</em>. Defaults to<tt class="literal">$Config{installman1dir}</tt>.</p></dd><dt><i>INSTALLMAN3DIR</i></dt><dd>Directory where library manpages are put during <em class="emphasis">makeinstall</em>. Defaults to<tt class="literal">$Config{installman3dir}</tt>.</p></dd><dt><i>INSTALLPRIVLIB</i></dt><dd>Used by <em class="emphasis">make install</em>, which copies files fromINST_LIB to this directory if INSTALLDIRS is set to<tt class="literal">perl</tt>.</p></dd><dt><i>INSTALLSCRIPT</i></dt><dd>Used by <em class="emphasis">make install</em>, which copies files fromINST_SCRIPT to this directory.</p></dd><dt><i>INSTALLSITELIB</i></dt><dd>Used by <em class="emphasis">make install</em>, which copies files fromINST_LIB to this directory if INSTALLDIRS is set to<tt class="literal">site</tt> (the default).</p></dd><dt><i>INSTALLSITEARCH</i></dt><dd>Used by <em class="emphasis">make install</em>, which copies files fromINST_ARCHLIB to this directory if INSTALLDIRS is set to<tt class="literal">site</tt> (the default).</p></dd><dt><i>INST_ARCHLIB</i></dt><dd>Same as INST_LIB for architecture-dependent files.</p></dd><dt><i>INST_BIN</i></dt><dd>Directory where real binary files are put during<em class="emphasis">make</em>, for later copying to INSTALLBIN during<em class="emphasis">make install</em>.</p></dd><dt><i>INST_EXE</i></dt><dd>Deprecated. Old name for INST_SCRIPT, which you should use instead.</p></dd><dt><i>INST_LIB</i></dt><dd>Directory to hold library files for this module while it is beingbuilt.</p></dd><dt><i>INST_MAN1DIR</i></dt><dd>Directory to hold the command manpages at <em class="emphasis">make</em>time.</p></dd><dt><i>INST_MAN3DIR</i></dt><dd>Directory to hold the library manpages at <em class="emphasis">make</em>time.</p></dd><dt><i>INST_SCRIPT</i></dt><dd>Directory where executable files should be installed during<em class="emphasis">make</em>. Defaults to<em class="emphasis">./blib/bin</em>, to have a dummy location duringtesting. <em class="emphasis">make install</em> copies the files inINST_SCRIPT to INSTALLSCRIPT.</p></dd><dt><i>LDFROM</i></dt><dd>Used by the <em class="emphasis">ld</em> command to specify the files tolink/load from. Defaults to <tt class="literal">$(OBJECT)</tt>.</p></dd><dt><i>LIBPERL_A</i></dt><dd>Filename of the Perl library that will be used with this module.Defaults to <em class="emphasis">libperl.a</em>.</p></dd>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -