⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 make.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 5 页
字号:
target is a directory or the target is a prerequisite of the special target <b>.PRECIOUS</b> or unless one of the <b>-n</b>,<b>-p</b>, or <b>-q</b> options was specified. Any targets removed in this manner shall be reported in diagnostic messages ofunspecified format, written to standard error. After this cleanup process, if any, <i>make</i> shall take the standard action forall other signals.</p></blockquote><h4><a name="tag_04_84_10"></a>STDOUT</h4><blockquote><p>The <i>make</i> utility shall write all commands to be executed to standard output unless the <b>-s</b> option was specified,the command is prefixed with an at sign, or the special target <b>.SILENT</b> has either the current target as a prerequisite orhas no prerequisites. If <i>make</i> is invoked without any work needing to be done, it shall write a message to standard outputindicating that no action was taken. If the <b>-t</b> option is present and a file is touched, <i>make</i> shall write to standardoutput a message of unspecified format indicating that the file was touched, including the filename of the file.</p></blockquote><h4><a name="tag_04_84_11"></a>STDERR</h4><blockquote><p>The standard error shall be used only for diagnostic messages.</p></blockquote><h4><a name="tag_04_84_12"></a>OUTPUT FILES</h4><blockquote><p>Files can be created when the <b>-t</b> option is present. Additional files can also be created by the utilities invoked by<i>make</i>.</p></blockquote><h4><a name="tag_04_84_13"></a>EXTENDED DESCRIPTION</h4><blockquote><p>The <i>make</i> utility attempts to perform the actions required to ensure that the specified targets are up-to-date. A targetis considered out-of-date if it is older than any of its prerequisites or if it does not exist. The <i>make</i> utility shall treatall prerequisites as targets themselves and recursively ensure that they are up-to-date, processing them in the order in which theyappear in the rule. The <i>make</i> utility shall use the modification times of files to determine whether the correspondingtargets are out-of-date.</p><p>After <i>make</i> has ensured that all of the prerequisites of a target are up-to-date and if the target is out-of-date, thecommands associated with the target entry shall be executed. If there are no commands listed for the target, the target shall betreated as up-to-date.</p><h5><a name="tag_04_84_13_01"></a>Makefile Syntax</h5><p>A makefile can contain rules, macro definitions (see <a href="#tag_04_84_13_04">Macros</a> ), and comments. There are two kindsof rules: <i>inference rules</i> and <i>target rules</i>. The <i>make</i> utility shall contain a set of built-in inference rules.If the <b>-r</b> option is present, the built-in rules shall not be used and the suffix list shall be cleared. Additional rules ofboth types can be specified in a makefile. If a rule is defined more than once, the value of the rule shall be that of the last onespecified. Macros can also be defined more than once, and the value of the macro is specified in <a href="#tag_04_84_13_04">Macros</a> . Comments start with a number sign ( <tt>'#'</tt> ) and continue until an unescaped &lt;newline&gt;is reached.</p><p>By default, the following files shall be tried in sequence: <b>./makefile</b> and <b>./Makefile</b>. If neither<b>./makefile</b> or <b>./Makefile</b> are found, other implementation-defined files may also be tried. <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;OnXSI-conformant systems, the additional files <b>./s.makefile</b>, <b>SCCS/s.makefile</b>, <b>./s.Makefile</b>, and<b>SCCS/s.Makefile</b> shall also be tried. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><p>The <b>-f</b> option shall direct <i>make</i> to ignore any of these default files and use the specified argument as a makefileinstead. If the <tt>'-'</tt> argument is specified, standard input shall be used.</p><p>The term <i>makefile</i> is used to refer to any rules provided by the user, whether in <b>./makefile</b> or its variants, orspecified by the <b>-f</b> option.</p><p>The rules in makefiles shall consist of the following types of lines: target rules, including special targets (see <a href="#tag_04_84_13_03">Target Rules</a> ), inference rules (see <a href="#tag_04_84_13_05">Inference Rules</a> ), macro definitions(see <a href="#tag_04_84_13_04">Macros</a> ), empty lines, and comments.</p><p>When an escaped &lt;newline&gt; (one preceded by a backslash) is found anywhere in the makefile except in a command line, itshall be replaced, along with any leading white space on the following line, with a single &lt;space&gt;. When an escaped&lt;newline&gt; is found in a command line in a makefile, the command line shall contain the backslash, the &lt;newline&gt;, andthe next line, except that the first character of the next line shall not be included if it is a &lt;tab&gt;.</p><h5><a name="tag_04_84_13_02"></a>Makefile Execution</h5><p>Makefile command lines shall be processed one at a time by writing the makefile command line to the standard output (unless oneof the conditions listed under <tt>'@'</tt> suppresses the writing) and executing the command(s) in the line. A &lt;tab&gt; mayprecede the command to standard output. Command execution shall be as if the makefile command line were the argument to the <ahref="../functions/system.html"><i>system</i>()</a> function. The environment for the command being executed shall contain all ofthe variables in the environment of <i>make</i>.</p><p>By default, when <i>make</i> receives a non-zero status from the execution of a command, it shall terminate with an errormessage to standard error.</p><p>Makefile command lines can have one or more of the following prefixes: a hyphen ( <tt>'-'</tt> ), an at sign ( <tt>'@'</tt> ),or a plus sign ( <tt>'+'</tt> ). These shall modify the way in which <i>make</i> processes the command. When a command is writtento standard output, the prefix shall not be included in the output.</p><dl compact><dt><tt>-</tt></dt><dd>If the command prefix contains a hyphen, or the <b>-i</b> option is present, or the special target <b>.IGNORE</b> has eitherthe current target as a prerequisite or has no prerequisites, any error found while executing the command shall be ignored.</dd><dt><tt>@</tt></dt><dd>If the command prefix contains an at sign and the <i>make</i> utility command line <b>-n</b> option is not specified, or the<b>-s</b> option is present, or the special target <b>.SILENT</b> has either the current target as a prerequisite or has noprerequisites, the command shall not be written to standard output before it is executed.</dd><dt><tt>+</tt></dt><dd>If the command prefix contains a plus sign, this indicates a makefile command line that shall be executed even if <b>-n</b>,<b>-q</b>, or <b>-t</b> is specified.</dd></dl><h5><a name="tag_04_84_13_03"></a>Target Rules</h5><p>Target rules are formatted as follows:</p><pre><i>target</i> <b>[</b><i>target</i><tt>...</tt><b>]</b><tt>:</tt> <b>[</b><i>prerequisite</i><tt>...</tt><b>][;</b><i>command</i><b>][</b><tt>&lt;tab&gt;</tt><i>command</i><tt>&lt;tab&gt;</tt><i>command</i><tt>...</tt><b>]</b><tt><br></tt><i>line that does not begin with</i> <tt>&lt;tab&gt;</tt></pre><p>Target entries are specified by a &lt;blank&gt;-separated, non-null list of targets, then a colon, then a&lt;blank&gt;-separated, possibly empty list of prerequisites. Text following a semicolon, if any, and all following lines thatbegin with a &lt;tab&gt;, are makefile command lines to be executed to update the target. The first non-empty line that does notbegin with a &lt;tab&gt; or <tt>'#'</tt> shall begin a new entry. An empty or blank line, or a line beginning with <tt>'#'</tt> ,may begin a new entry.</p><p>Applications shall select target names from the set of characters consisting solely of periods, underscores, digits, andalphabetics from the portable character set (see the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap06.html#tag_06_01">Section 6.1, Portable Character Set</a>). Implementations may allow other characters intarget names as extensions. The interpretation of targets containing the characters <tt>'%'</tt> and <tt>''</tt> isimplementation-defined.</p><p>A target that has prerequisites, but does not have any commands, can be used to add to the prerequisite list for that target.Only one target rule for any given target can contain commands.</p><p>Lines that begin with one of the following are called <i>special targets</i> and control the operation of <i>make</i>:</p><dl compact><dt><b>.DEFAULT</b></dt><dd>If the makefile uses this special target, the application shall ensure that it is specified with commands, but withoutprerequisites. The commands shall be used by <i>make</i> if there are no other rules available to build a target.</dd><dt><b>.IGNORE</b></dt><dd>Prerequisites of this special target are targets themselves; this shall cause errors from commands associated with them to beignored in the same manner as specified by the <b>-i</b> option. Subsequent occurrences of <b>.IGNORE</b> shall add to the list oftargets ignoring command errors. If no prerequisites are specified, <i>make</i> shall behave as if the <b>-i</b> option had beenspecified and errors from all commands associated with all targets shall be ignored.</dd><dt><b>.POSIX</b></dt><dd>The application shall ensure that this special target is specified without prerequisites or commands. If it appears as thefirst non-comment line in the makefile, <i>make</i> shall process the makefile as specified by this section; otherwise, thebehavior of <i>make</i> is unspecified.</dd><dt><b>.PRECIOUS</b></dt><dd>Prerequisites of this special target shall not be removed if <i>make</i> receives one of the asynchronous events explicitlydescribed in the ASYNCHRONOUS EVENTS section. Subsequent occurrences of <b>.PRECIOUS</b> shall add to the list of precious files.If no prerequisites are specified, all targets in the makefile shall be treated as if specified with <b>.PRECIOUS</b>.</dd><dt><b>.SCCS_GET</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The application shall ensure that this special target is specified without prerequisites. If this special target is included in amakefile, the commands specified with this target shall replace the default commands associated with this special target (see <ahref="#tag_04_84_13_08">Default Rules</a> ). The commands specified with this target are used to get all SCCS files that are notfound in the current directory. <p>When source files are named in a dependency list, <i>make</i> shall treat them just like any other target. Because the sourcefile is presumed to be present in the directory, there is no need to add an entry for it to the makefile. When a target has nodependencies, but is present in the directory, <i>make</i> shall assume that that file is up-to-date. If, however, an SCCS filenamed <b>SCCS/s.</b> <i>source_file</i> is found for a target <i>source_file</i>, <i>make</i> compares the timestamp of the targetfile with that of the <b>SCCS/s.source_file</b> to ensure the target is up-to-date. If the target is missing, or if the SCCS fileis newer, <i>make</i> shall automatically issue the commands specified for the <b>.SCCS_GET</b> special target to retrieve the mostrecent version. However, if the target is writable by anyone, <i>make</i> shall not retrieve a new version. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></dd><dt><b>.SILENT</b></dt><dd>Prerequisites of this special target are targets themselves; this shall cause commands associated with them not to be writtento the standard output before they are executed. Subsequent occurrences of <b>.SILENT</b> shall add to the list of targets withsilent commands. If no prerequisites are specified, <i>make</i> shall behave as if the <b>-s</b> option had been specified and nocommands or touch messages associated with any target shall be written to standard output.</dd><dt><b>.SUFFIXES</b></dt><dd>Prerequisites of <b>.SUFFIXES</b> shall be appended to the list of known suffixes and are used in conjunction with theinference rules (see <a href="#tag_04_84_13_05">Inference Rules</a> ). If <b>.SUFFIXES</b> does not have any prerequisites, thelist of known suffixes shall be cleared.</dd></dl><p>The special targets <b>.IGNORE</b>, <b>.POSIX</b>, <b>.PRECIOUS</b>, <b>.SILENT</b>, and <b>.SUFFIXES</b> shall be specifiedwithout commands.</p><p>Targets with names consisting of a leading period followed by the uppercase letters <tt>"POSIX"</tt> and then any othercharacters are reserved for future standardization. Targets with names consisting of a leading period followed by one or moreuppercase letters are reserved for implementation extensions.</p><h5><a name="tag_04_84_13_04"></a>Macros</h5><p>Macro definitions are in the form:</p><pre><i>string1</i> <tt>=</tt> <b>[</b><i>string2</i><b>]</b></pre><p>The macro named <i>string1</i> is defined as having the value of <i>string2</i>, where <i>string2</i> is defined as allcharacters, if any, after the equal sign, up to a comment character ( <tt>'#'</tt> ) or an unescaped &lt;newline&gt;. Any&lt;blank&gt;s immediately before or after the equal sign shall be ignored.</p><p>Applications shall select macro names from the set of characters consisting solely of periods, underscores, digits, andalphabetics from the portable character set (see the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap06.html#tag_06_01">Section 6.1, Portable Character Set</a>). A macro name shall not contain an equals sign.Implementations may allow other characters in macro names as extensions.</p><p>Macros can appear anywhere in the makefile. Macro expansions using the forms $( <i>string1</i>) or ${ <i>string1</i>} shall bereplaced by <i>string2</i>, as follows:</p><ul><li><p>Macros in target lines shall be evaluated when the target line is read.</p></li><li><p>Macros in makefile command lines shall be evaluated when the command is executed.</p></li><li><p>Macros in the string before the equals sign in a macro definition shall be evaluated when the macro assignment is made.</p></li><li><p>Macros after the equals sign in a macro definition shall not be evaluated until the defined macro is used in a rule or command,or before the equals sign in a macro definition.</p></li></ul><p>The parentheses or braces are optional if <i>string1</i> is a single character. The macro $$ shall be replaced by the singlecharacter <tt>'$'</tt> . If <i>string1</i> in a macro expansion contains a macro expansion, the results are unspecified.</p><p>Macro expansions using the forms $( <i>string1</i> <b>[:</b> <i>subst1</i> <b>=[</b> <i>subst2</i> <b>]]</b>) or ${<i>string1</i> <b>[:</b> <i>subst1</i> <b>=[</b> <i>subst2</i> <b>]]</b>} can be used to replace all occurrences of <i>subst1</i>with <i>subst2</i> when the macro substitution is performed. The <i>subst1</i> to be replaced shall be recognized when it is asuffix at the end of a word in <i>string1</i> (where a <i>word</i>, in this context, is defined to be a string delimited by thebeginning of the line, a &lt;blank&gt;, or a &lt;newline&gt;). If <i>string1</i> in a macro expansion contains a macro expansion,the results are unspecified.</p><p>Macro expansions in <i>string1</i> of macro definition lines shall be evaluated when read. Macro expansions in <i>string2</i> ofmacro definition lines shall be performed when the macro identified by <i>string1</i> is expanded in a rule or command.</p><p>Macro definitions shall be taken from the following sources, in the following logical order, before the makefile(s) areread.</p><ol><li><p>Macros specified on the <i>make</i> utility command line, in the order specified on the command line. It is unspecified whetherthe internal macros defined in <a href="#tag_04_84_13_07">Internal Macros</a> are accepted from this source.</p></li><li><p>Macros defined by the <i>MAKEFLAGS</i> environment variable, in the order specified in the environment variable. It isunspecified whether the internal macros defined in <a href="#tag_04_84_13_07">Internal Macros</a> are accepted from thissource.</p></li><li>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -