📄 make.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>make</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="make"></a> <a name="tag_04_84"></a><!-- make --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_84_01"></a>NAME</h4><blockquote>make - maintain, update, and regenerate groups of programs (<b>DEVELOPMENT</b>)</blockquote><h4><a name="tag_04_84_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('SD')">SD</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> make</tt> <b>[</b><tt>-einpqrst</tt><b>][</b><tt>-f</tt> <i>makefile</i><b>]</b><tt>...</tt><b>[</b><tt>-k| -S</tt><b>][</b><i>macro</i><tt>=</tt><i>value</i><b>]</b><tt>...<br> </tt> <b>[</b><i>target_name</i><tt>...</tt><b>]</b><tt><img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div></blockquote><h4><a name="tag_04_84_03"></a>DESCRIPTION</h4><blockquote><p>The <i>make</i> utility shall update files that are derived from other files. A typical case is one where object files arederived from the corresponding source files. The <i>make</i> utility examines time relationships and shall update those derivedfiles (called targets) that have modified times earlier than the modified times of the files (called prerequisites) from which theyare derived. A description file (makefile) contains a description of the relationships between files, and the commands that need tobe executed to update the targets to reflect changes in their prerequisites. Each specification, or rule, shall consist of atarget, optional prerequisites, and optional commands to be executed when a prerequisite is newer than the target. There are twotypes of rule:</p><ol><li><p><i>Inference rules</i>, which have one target name with at least one period ( <tt>'.'</tt> ) and no slash ( <tt>'/'</tt> )</p></li><li><p><i>Target rules</i>, which can have more than one target name</p></li></ol><p>In addition, <i>make</i> shall have a collection of built-in macros and inference rules that infer prerequisite relationships tosimplify maintenance of programs.</p><p>To receive exactly the behavior described in this section, the user shall ensure that a portable makefile shall:</p><ul><li><p>Include the special target <b>.POSIX</b></p></li><li><p>Omit any special target reserved for implementations (a leading period followed by uppercase letters) that has not beenspecified by this section</p></li></ul><p>The behavior of <i>make</i> is unspecified if either or both of these conditions are not met.</p></blockquote><h4><a name="tag_04_84_04"></a>OPTIONS</h4><blockquote><p>The <i>make</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p><p>The following options shall be supported:</p><dl compact><dt><b>-e</b></dt><dd>Cause environment variables, including those with null values, to override macro assignments within makefiles.</dd><dt><b>-f </b> <i>makefile</i></dt><dd>Specify a different makefile. The argument <i>makefile</i> is a pathname of a description file, which is also referred to asthe <i>makefile</i>. A pathname of <tt>'-'</tt> shall denote the standard input. There can be multiple instances of this option,and they shall be processed in the order specified. The effect of specifying the same option-argument more than once isunspecified.</dd><dt><b>-i</b></dt><dd>Ignore error codes returned by invoked commands. This mode is the same as if the special target <b>.IGNORE</b> were specifiedwithout prerequisites.</dd><dt><b>-k</b></dt><dd>Continue to update other targets that do not depend on the current target if a non-ignored error occurs while executing thecommands to bring a target up-to-date.</dd><dt><b>-n</b></dt><dd>Write commands that would be executed on standard output, but do not execute them. However, lines with a plus sign (<tt>'+'</tt> ) prefix shall be executed. In this mode, lines with an at sign ( <tt>'@'</tt> ) character prefix shall be written tostandard output.</dd><dt><b>-p</b></dt><dd>Write to standard output the complete set of macro definitions and target descriptions. The output format is unspecified.</dd><dt><b>-q</b></dt><dd>Return a zero exit value if the target file is up-to-date; otherwise, return an exit value of 1. Targets shall not be updatedif this option is specified. However, a makefile command line (associated with the targets) with a plus sign ( <tt>'+'</tt> )prefix shall be executed.</dd><dt><b>-r</b></dt><dd>Clear the suffix list and do not use the built-in rules.</dd><dt><b>-S</b></dt><dd>Terminate <i>make</i> if an error occurs while executing the commands to bring a target up-to-date. This shall be the defaultand the opposite of <b>-k</b>.</dd><dt><b>-s</b></dt><dd>Do not write makefile command lines or touch messages (see <b>-t</b>) to standard output before executing. This mode shall bethe same as if the special target <b>.SILENT</b> were specified without prerequisites.</dd><dt><b>-t</b></dt><dd>Update the modification time of each target as though a <a href="../utilities/touch.html"><i>touch</i></a> <i>target</i> hadbeen executed. Targets that have prerequisites but no commands (see <a href="#tag_04_84_13_03">Target Rules</a> ), or that arealready up-to-date, shall not be touched in this manner. Write messages to standard output for each target file indicating the nameof the file and that it was touched. Normally, the <i>makefile</i> command lines associated with each target are not executed.However, a command line with a plus sign ( <tt>'+'</tt> ) prefix shall be executed.</dd></dl><p>Any options specified in the <i>MAKEFLAGS</i> environment variable shall be evaluated before any options specified on the<i>make</i> utility command line. If the <b>-k</b> and <b>-S</b> options are both specified on the <i>make</i> utility command lineor by the <i>MAKEFLAGS</i> environment variable, the last option specified shall take precedence. If the <b>-f</b> or <b>-p</b>options appear in the <i>MAKEFLAGS</i> environment variable, the result is undefined.</p></blockquote><h4><a name="tag_04_84_05"></a>OPERANDS</h4><blockquote><p>The following operands shall be supported:</p><dl compact><dt><i>target_name</i></dt><dd>Target names, as defined in the EXTENDED DESCRIPTION section. If no target is specified, while <i>make</i> is processing themakefiles, the first target that <i>make</i> encounters that is not a special target or an inference rule shall be used.</dd><dt><i>macro</i>=<i>value</i></dt><dd>Macro definitions, as defined in <a href="#tag_04_84_13_04">Macros</a> .</dd></dl><p>If the <i>target_name</i> and <i>macro</i>= <i>value</i> operands are intermixed on the <i>make</i> utility command line, theresults are unspecified.</p></blockquote><h4><a name="tag_04_84_06"></a>STDIN</h4><blockquote><p>The standard input shall be used only if the <i>makefile</i> option-argument is <tt>'-'</tt> . See the INPUT FILES section.</p></blockquote><h4><a name="tag_04_84_07"></a>INPUT FILES</h4><blockquote><p>The input file, otherwise known as the makefile, is a text file containing rules, macro definitions, and comments. See theEXTENDED DESCRIPTION section.</p></blockquote><h4><a name="tag_04_84_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>The following environment variables shall affect the execution of <i>make</i>:</p><dl compact><dt><i>LANG</i></dt><dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> forthe precedence of internationalization variables used to determine the values of locale categories.)</dd><dt><i>LC_ALL</i></dt><dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd><dt><i>LC_CTYPE</i></dt><dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte asopposed to multi-byte characters in arguments and input files).</dd><dt><i>LC_MESSAGES</i></dt><dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standarderror.</dd><dt><i>MAKEFLAGS</i></dt><dd><br>This variable shall be interpreted as a character string representing a series of option characters to be used as the defaultoptions. The implementation shall accept both of the following formats (but need not accept them when intermixed): <ul><li><p>The characters are option letters without the leading hyphens or <blank> separation used on a <i>make</i> utility commandline.</p></li><li><p>The characters are formatted in a manner similar to a portion of the <i>make</i> utility command line: options are preceded byhyphens and <blank>-separated as described in the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>. The <i>macro</i>= <i>value</i> macrodefinition operands can also be included. The difference between the contents of <i>MAKEFLAGS</i> and the <i>make</i> utilitycommand line is that the contents of the variable shall not be subjected to the word expansions (see <a href="xcu_chap02.html#tag_02_06"><i>Word Expansions</i></a> ) associated with parsing the command line values.</p></li></ul></dd><dt><i>NLSPATH</i></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><i>PROJECTDIR</i></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"><br>Provide a directory to be used to search for SCCS files not found in the current directory. In all of the following cases, thesearch for SCCS files is made in the directory <b>SCCS</b> in the identified directory. If the value of <i>PROJECTDIR</i> beginswith a slash, it shall be considered an absolute pathname; otherwise, the value of <i>PROJECTDIR</i> is treated as a user name andthat user's initial working directory shall be examined for a subdirectory <b>src</b> or <b>source</b>. If such a directory isfound, it shall be used. Otherwise, the value is used as a relative pathname. <p>If <i>PROJECTDIR</i> is not set or has a null value, the search for SCCS files shall be made in the directory <b>SCCS</b> in thecurrent directory.</p><p>The setting of <i>PROJECTDIR</i> affects all files listed in the remainder of this utility description for files with acomponent named <b>SCCS</b>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></dd></dl><p>The value of the <i>SHELL</i> environment variable shall not be used as a macro and shall not be modified by defining the<b>SHELL</b> macro in a makefile or on the command line. All other environment variables, including those with null values, shallbe used as macros, as defined in <a href="#tag_04_84_13_04">Macros</a> .</p></blockquote><h4><a name="tag_04_84_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>If not already ignored, <i>make</i> shall trap SIGHUP, SIGTERM, SIGINT, and SIGQUIT and remove the current target unless the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -