Un outil pour savoir si une commande est posix - retour accueil
git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |
make.html (128789B)
1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved --> 2 <!DOCTYPE HTML> 3 <html lang="en"> 4 <head> 5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0"> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 --> 8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved --> 9 <title>make</title> 10 </head> 11 <body bgcolor="white"> 12 <div class="NAVHEADER"> 13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 14 <tr class="nav"> 15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/mailx.html" accesskey="P"><<< 16 Previous</a></td> 17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/man.html" accesskey="N">Next >>></a></td> 19 </tr> 20 </table> 21 <hr align="left" width="100%"></div> 22 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> 23 <center><font size="2">The Open Group Base Specifications Issue 8<br> 24 IEEE Std 1003.1-2024<br> 25 Copyright © 2001-2024 The IEEE and The Open Group</font></center> 26 <hr size="2" noshade> 27 <a name="top" id="top"></a> <a name="make" id="make"></a> <a name="tag_20_76" id="tag_20_76"></a><!-- make --> 28 <h4 class="mansect"><a name="tag_20_76_01" id="tag_20_76_01"></a>NAME</h4> 29 <blockquote>make — maintain, update, and regenerate files (<b>DEVELOPMENT</b>)</blockquote> 30 <h4 class="mansect"><a name="tag_20_76_02" id="tag_20_76_02"></a>SYNOPSIS</h4> 31 <blockquote class="synopsis"> 32 <div class="box"><code><tt><sup>[<a href="javascript:open_code('SD')">SD</a>]</sup> <img src="../images/opt-start.gif" alt= 33 "[Option Start]" border="0"> make</tt> <b>[</b><tt>-einpqrst</tt><b>] [</b><tt>-f</tt> <i>makefile</i><b>]</b><tt>...</tt> 34 <b>[</b><tt>-j</tt> <i>maxjobs</i><b>] [</b><tt>-k|-S</tt><b>]<br></b> <tt> </tt> 35 <b>[</b><i>macro</i><b>[</b><tt>::</tt><b>[</b><tt>:</tt><b>]]</b><tt>=</tt><i>value</i><tt>...</tt><b>] 36 [</b><i>target_name</i><tt>...</tt><b>]</b> <tt><img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div> 37 </blockquote> 38 <h4 class="mansect"><a name="tag_20_76_03" id="tag_20_76_03"></a>DESCRIPTION</h4> 39 <blockquote> 40 <p>The <i>make</i> utility shall update files that are derived from other files. A typical case is one where object files are 41 derived from the corresponding source files. The <i>make</i> utility examines time relationships and shall update those derived 42 files (called targets) that have modified times earlier than the modified times of the files (called prerequisites) from which they 43 are derived. A description file (makefile) contains a description of the relationships between files, and the commands that need to 44 be executed to update the targets to reflect changes in their prerequisites. Each specification, or rule, shall consist of a 45 target, optional prerequisites, and optional commands to be executed when a prerequisite is newer than the target. There are two 46 kinds of rule:</p> 47 <ol> 48 <li> 49 <p><i>Inference rules</i>, which have one target name with at least one <period> (<tt>'.'</tt>) and no <slash> 50 (<tt>'/'</tt>)</p> 51 </li> 52 <li> 53 <p><i>Target rules</i>, which can have more than one target name</p> 54 </li> 55 </ol> 56 <p>In addition, <i>make</i> shall have a collection of built-in macros and inference rules that infer prerequisite relationships to 57 simplify maintenance of programs.</p> 58 <p>To receive exactly the behavior described in this section, a portable makefile shall:</p> 59 <ul> 60 <li> 61 <p>Include the special target <b>.POSIX</b></p> 62 </li> 63 <li> 64 <p>Omit any special target reserved for implementations (a leading period followed by uppercase letters) that has not been 65 specified by this section</p> 66 </li> 67 </ul> 68 <p>The behavior of <i>make</i> is unspecified if either or both of these conditions are not met.</p> 69 </blockquote> 70 <h4 class="mansect"><a name="tag_20_76_04" id="tag_20_76_04"></a>OPTIONS</h4> 71 <blockquote> 72 <p>The <i>make</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax 73 Guidelines</i></a> , except for Guideline 9.</p> 74 <p>The following options shall be supported:</p> 75 <dl compact> 76 <dd></dd> 77 <dt><b>-e</b></dt> 78 <dd>Cause environment variables, including those with null values, to override macro assignments within makefiles.</dd> 79 <dt><b>-f </b><i>makefile</i></dt> 80 <dd>Specify a different makefile. The argument <i>makefile</i> is a pathname of a description file, which is also referred to as 81 the <i>makefile</i>. A pathname of <tt>'-'</tt> shall denote the standard input. There can be multiple instances of this option, 82 and they shall be processed in the order specified. The effect of specifying the same option-argument more than once is 83 unspecified.</dd> 84 <dt><b>-i</b></dt> 85 <dd>Ignore error codes returned by invoked commands. This mode shall be the same as if the special target <b>.IGNORE</b> were 86 specified without prerequisites.</dd> 87 <dt><b>-j </b><i>maxjobs</i></dt> 88 <dd>Set the maximum number of targets that can be updated concurrently. If this option is specified multiple times, the last value 89 of <i>maxjobs</i> specified shall take precedence. If this option is not specified, or if <i>maxjobs</i> is 1, only one target 90 shall be updated at a time (no parallelization). If the value of <i>maxjobs</i> is non-positive, the behavior is unspecified. When 91 <i>maxjobs</i> is greater than 1, <i>make</i> shall create a pool of up to <i>maxjobs</i> - 1 tokens. (Note that implementations 92 are not required to create a pool of exactly <i>maxjobs</i> - 1 tokens. For example, an implementation could limit the pool size 93 based on the number of processors available.) If the size of the token pool would be 0, <i>make</i> need not implement a token 94 pool. 95 <p>When all of the following are true:</p> 96 <ul> 97 <li> 98 <p>There is a target with commands that is not up-to-date</p> 99 </li> 100 <li> 101 <p>The target's prerequisites (if any) are up-to-date</p> 102 </li> 103 <li> 104 <p><i>make</i> is not waiting to bring the target up-to-date (see <b>.WAIT</b>)</p> 105 </li> 106 <li> 107 <p><i>make</i> is currently bringing a different target with commands up-to-date</p> 108 </li> 109 <li> 110 <p><i>make</i> is not currently bringing <i>maxjobs</i> targets up-to-date in parallel</p> 111 </li> 112 <li> 113 <p>The special target <b>.NOTPARALLEL</b> is not specified</p> 114 </li> 115 <li> 116 <p>The token pool is not empty</p> 117 </li> 118 </ul> 119 <p>then <i>make</i> may attempt to remove one token from the pool. If a token is successfully removed, it shall attempt to bring 120 this target up-to-date in parallel, and after this processing completes shall return the token to the pool. When <i>make</i> is 121 bringing a target without commands up-to-date, it need not remove a token from the pool.</p> 122 <p>If a rule invokes a sub-<i>make</i> either via the <i>MAKE</i> macro or via a command line that begins with <tt>'+'</tt>, the 123 sub-<i>make</i> is the same implementation as the <i>make</i> that invoked the sub-<i>make</i>, and the <b>-j</b> option is passed 124 to the sub-<i>make</i> via the <i>MAKEFLAGS</i> environment variable with the same <i>maxjobs</i> value and is not overridden by a 125 <i>maxjobs</i> value from another source (even if it has the same value), the sub-<i>make</i> shall use the same token pool as its 126 invoking <i>make</i> rather than create a new token pool. Otherwise, it is unspecified whether the sub-<i>make</i> uses the same 127 token pool as its invoking <i>make</i> or creates a new token pool. If a rule executes multiple sub-<i>make</i> processes 128 asynchronously the behavior is unspecified.</p> 129 </dd> 130 <dt><b>-k</b></dt> 131 <dd>Continue to update other targets that do not depend on the current target if a non-ignored error occurs while executing the 132 commands to bring a target up-to-date.</dd> 133 <dt><b>-n</b></dt> 134 <dd>Write commands that would be executed on standard output, but do not execute them. However, lines with a <plus-sign> 135 (<tt>'+'</tt>) prefix, lines that expand the <i>MAKE</i> macro, and lines being processed in order to create an include file or to 136 bring it up-to-date (see <b>Include Lines</b> in the EXTENDED DESCRIPTION section) shall be executed. In this mode, lines with a 137 <commercial-at> (<tt>'@'</tt>) character prefix shall be written to standard output.</dd> 138 <dt><b>-p</b></dt> 139 <dd>Write to standard output the complete set of macro definitions and target descriptions. The output format is unspecified.</dd> 140 <dt><b>-q</b></dt> 141 <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 updated 142 if this option is specified. However, a makefile command line (associated with the targets) with a <plus-sign> (<tt>'+'</tt>) 143 prefix shall be executed and it is unspecified whether command lines that do not have a <plus-sign> prefix and either expand 144 the <i>MAKE</i> macro or are being processed in order to create an include file or to bring it up-to-date (see <b>Include Lines</b> 145 in the EXTENDED DESCRIPTION section) are executed.</dd> 146 <dt><b>-r</b></dt> 147 <dd>Clear the suffix list and do not use the built-in rules.</dd> 148 <dt><b>-S</b></dt> 149 <dd>Terminate <i>make</i> if an error occurs while executing the commands to bring a target up-to-date. This shall be the default 150 and the opposite of <b>-k</b>.</dd> 151 <dt><b>-s</b></dt> 152 <dd>Do not write makefile <i>execution lines</i> (see <a href="#tag_20_76_13_03">Makefile Execution</a> ) or touch messages (see 153 <b>-t</b>) to standard output before executing. This mode shall be the same as if the special target <b>.SILENT</b> were specified 154 without prerequisites.</dd> 155 <dt><b>-t</b></dt> 156 <dd>Update the modification time of each target as though a <a href="../utilities/touch.html"><i>touch</i></a> <i>target</i> had 157 been executed. Targets that have prerequisites but no commands (see <a href="#tag_20_76_13_04">Target Rules</a> ), or that are 158 already up-to-date, shall not be touched in this manner. Write messages to standard output for each target file indicating the name 159 of the file and that it was touched. Normally, the <i>makefile</i> command lines associated with each target are not executed. 160 However, a command line with a <plus-sign> (<tt>'+'</tt>) prefix shall be executed and it is unspecified whether command 161 lines that do not have a <plus-sign> prefix and either expand the <i>MAKE</i> macro or are being processed in order to create 162 an include file or to bring it up-to-date (see <b>Include Lines</b> in the EXTENDED DESCRIPTION section) are executed.</dd> 163 </dl> 164 <p>Any options specified in the <i>MAKEFLAGS</i> environment variable shall be evaluated before any options specified on the 165 <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 line 166 or by the <i>MAKEFLAGS</i> environment variable, the last option specified shall take precedence. If the <b>-f</b> or <b>-p</b> 167 options appear in the <i>MAKEFLAGS</i> environment variable, the result is undefined.</p> 168 </blockquote> 169 <h4 class="mansect"><a name="tag_20_76_05" id="tag_20_76_05"></a>OPERANDS</h4> 170 <blockquote> 171 <p>The following operands shall be supported:</p> 172 <dl compact> 173 <dd></dd> 174 <dt><i>target_name</i></dt> 175 <dd>Target names, as defined in the EXTENDED DESCRIPTION section. If no target is specified, while <i>make</i> is processing the 176 makefiles, the first target that <i>make</i> encounters that is not a special target or an inference rule shall be used.</dd> 177 <dt><i>macro</i>=<i>value</i></dt> 178 <dd></dd> 179 <dt><i>macro</i>::=<i>value</i></dt> 180 <dd></dd> 181 <dt><i>macro</i>:::=<i>value</i></dt> 182 <dd>Delayed and immediate expansion macro definitions, as defined in <a href="#tag_20_76_13_05">Macros</a> .</dd> 183 </dl> 184 <p>Delayed and immediate expansion macro definitions can be intermixed, and shall be processed in the order specified. If any macro 185 definition appears after a <i>target_name</i> operand on the <i>make</i> utility command line, the results are unspecified.</p> 186 </blockquote> 187 <h4 class="mansect"><a name="tag_20_76_06" id="tag_20_76_06"></a>STDIN</h4> 188 <blockquote> 189 <p>The standard input shall be used only if the <i>makefile</i> option-argument is <tt>'-'</tt>. See the INPUT FILES section.</p> 190 </blockquote> 191 <h4 class="mansect"><a name="tag_20_76_07" id="tag_20_76_07"></a>INPUT FILES</h4> 192 <blockquote> 193 <p>The input file, otherwise known as the makefile, is a text file containing rules, macro definitions, include lines, and 194 comments. See the EXTENDED DESCRIPTION section.</p> 195 </blockquote> 196 <h4 class="mansect"><a name="tag_20_76_08" id="tag_20_76_08"></a>ENVIRONMENT VARIABLES</h4> 197 <blockquote> 198 <p>The following environment variables shall affect the execution of <i>make</i>:</p> 199 <dl compact> 200 <dd></dd> 201 <dt><i>LANG</i></dt> 202 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href= 203 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization 204 variables used to determine the values of locale categories.)</dd> 205 <dt><i>LC_ALL</i></dt> 206 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd> 207 <dt><i>LC_CTYPE</i></dt> 208 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as 209 opposed to multi-byte characters in arguments and input files).</dd> 210 <dt><i>LC_MESSAGES</i></dt> 211 <dd><br> 212 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd> 213 <dt><i>MAKEFLAGS</i></dt> 214 <dd><br> 215 This variable shall be interpreted as a character string representing a series of option characters to be used as the default 216 options. The implementation shall accept both of the following formats (but need not accept them when intermixed): 217 <ul> 218 <li> 219 <p>The characters are option letters without the leading <hyphen-minus> characters or <blank> separation used on a 220 <i>make</i> utility command line.</p> 221 </li> 222 <li> 223 <p>The characters are formatted in a manner similar to the use of the <i>make</i> utility in shell commands: options are preceded 224 by <hyphen-minus> characters and <blank>-separated as described in XBD <a href= 225 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a> . The <i>macro</i>=<i>value</i> macro definition 226 operands can also be included. The difference between the contents of <i>MAKEFLAGS</i> and the use of the <i>make</i> utility in 227 shell commands is that the contents of the variable shall not be subjected to the word expansions (see <a href= 228 "../utilities/V3_chap02.html#tag_19_06"><i>2.6 Word Expansions</i></a> ) associated with parsing shell command lines.</p> 229 </li> 230 </ul> 231 </dd> 232 <dt><i>NLSPATH</i></dt> 233 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 234 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border= 235 "0"></dd> 236 <dt><i>PROJECTDIR</i></dt> 237 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border= 238 "0"><br> 239 Provide a directory to be used to search for SCCS files not found in the current directory. In all of the following cases, the 240 search for SCCS files is made in the directory <b>SCCS</b> in the identified directory. If the value of <i>PROJECTDIR</i> begins 241 with a <slash>, it shall be considered an absolute pathname; otherwise, the value of <i>PROJECTDIR</i> is treated as a user 242 name and that user's initial working directory shall be examined for a subdirectory <b>src</b> or <b>source</b>. If such a 243 directory is found, it shall be used. Otherwise, the value is used as a relative pathname. 244 <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 the 245 current directory.</p> 246 <p>The setting of <i>PROJECTDIR</i> affects all files listed in the remainder of this utility description for files with a 247 component named <b>SCCS</b>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p> 248 </dd> 249 </dl> 250 <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 251 <i>SHELL</i> macro in a makefile or on the command line. All other environment variables, including those with null values, shall 252 be used as macros, as defined in <a href="#tag_20_76_13_05">Macros</a> .</p> 253 </blockquote> 254 <h4 class="mansect"><a name="tag_20_76_09" id="tag_20_76_09"></a>ASYNCHRONOUS EVENTS</h4> 255 <blockquote> 256 <p>For SIGHUP, SIGINT, SIGQUIT, and SIGTERM signals, if the signal was not inherited as ignored, none of the <b>-n</b>, <b>-p</b>, 257 or <b>-q</b> options was specified, <i>make</i> is currently processing a target or inference rule, and the current target is 258 neither a directory nor a prerequisite of the special targets <b>.PHONY</b> or <b>.PRECIOUS</b>:</p> 259 <ul> 260 <li> 261 <p>The <i>make</i> utility shall catch the signal and, if the time of last data modification of the current target has changed 262 since make began processing the rule to bring that target up to date, remove that target; it may also remove that target if the 263 time of last data modification has not changed. Any targets removed in this manner shall be reported in diagnostic or informational 264 messages of unspecified format, written to standard error.</p> 265 </li> 266 <li> 267 <p>If <i>make</i> writes a diagnostic message to standard error, it shall exit with a status that indicates an error occurred; 268 otherwise, it shall set the signal to default and re-signal itself.</p> 269 </li> 270 </ul> 271 <p>In all other circumstances, <i>make</i> shall take the standard action for all signals; see <a href= 272 "../utilities/V3_chap01.html#tag_18_04"><i>1.4 Utility Description Defaults</i></a> .</p> 273 </blockquote> 274 <h4 class="mansect"><a name="tag_20_76_10" id="tag_20_76_10"></a>STDOUT</h4> 275 <blockquote> 276 <p>If <i>make</i> is invoked without any work needing to be done, it may write a message to standard output indicating that no 277 action was taken. Otherwise, the <i>make</i> utility shall write all commands to be executed (and the filenames of files touched 278 for the <b>-t</b> option in a message of unspecified format) to standard output unless the <b>-s</b> option was specified, the 279 command is prefixed with a <commercial-at> (<tt>'@'</tt>), or the special target <b>.SILENT</b> has either the current target 280 as a prerequisite or has no prerequisites.</p> 281 </blockquote> 282 <h4 class="mansect"><a name="tag_20_76_11" id="tag_20_76_11"></a>STDERR</h4> 283 <blockquote> 284 <p>The standard error shall be used for diagnostic messages and may be used for informational messages about target removals (see 285 ASYNCHRONOUS EVENTS).</p> 286 </blockquote> 287 <h4 class="mansect"><a name="tag_20_76_12" id="tag_20_76_12"></a>OUTPUT FILES</h4> 288 <blockquote> 289 <p>Files can be created when the <b>-t</b> option is present. Additional files can also be created by the utilities invoked by 290 <i>make</i>.</p> 291 </blockquote> 292 <h4 class="mansect"><a name="tag_20_76_13" id="tag_20_76_13"></a>EXTENDED DESCRIPTION</h4> 293 <blockquote> 294 <p>The <i>make</i> utility attempts to perform the actions, specified in one or more makefiles, required to ensure that specified 295 targets are up-to-date. By default, the following files shall be tried in sequence: <b>./makefile</b> and <b>./Makefile</b>. If 296 neither <b>./makefile</b> nor <b>./Makefile</b> is found, other implementation-defined files may also be tried. <sup>[<a href= 297 "javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> On 298 XSI-conformant systems, the additional files <b>./s.makefile</b>, <b>SCCS/s.makefile</b>, <b>./s.Makefile</b>, and 299 <b>SCCS/s.Makefile</b> shall also be tried. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> The <b>-f</b> 300 option shall direct <i>make</i> to ignore any of these default files and use the specified option-argument as a makefile instead. 301 If this option-argument is <tt>'-'</tt>, standard input shall be used.</p> 302 <p>The term <i>makefile</i> is used to refer to any makefile contents provided by the user, whether in <b>./makefile</b> or its 303 variants, or specified by the <b>-f</b> option.</p> 304 <p>A target shall be considered up-to-date if it exists and is newer than all of its prerequisites, or if it has already been made 305 up-to-date by the current invocation of <i>make</i> (regardless of the target's existence or age), except that targets that are 306 made up-to-date in order for them to be processed as include line pathnames (see <b>Include Lines</b> below) need not be considered 307 up-to-date during later processing. A target may also be considered up-to-date if it exists, is the same age as one or more of its 308 prerequisites, and is newer than the remaining prerequisites (if any). The <i>make</i> utility shall treat all prerequisites as 309 targets themselves and recursively ensure that they are up-to-date, processing them in the order in which they appear in the rule. 310 The <i>make</i> utility shall use the modification times of files to determine whether the corresponding targets are 311 out-of-date.</p> 312 <p>To ensure that a target is up-to-date, <i>make</i> shall ensure that all of the prerequisites of the target are up-to-date, then 313 check to see if the target itself is up-to-date. If the target is not up-to-date, the target shall be made up-to-date by executing 314 the rule's commands (if any). If the target does not exist after the target has been successfully made up-to-date, the target shall 315 be treated as being newer than any target for which it is a prerequisite.</p> 316 <p>If a target exists and there is neither a target rule nor an inference rule for the target, the target shall be considered 317 up-to-date. It shall be an error if <i>make</i> attempts to ensure that a target is up-to-date but the target does not exist and 318 there is neither a target rule nor an inference rule for the target.</p> 319 <h5><a name="tag_20_76_13_01" id="tag_20_76_13_01"></a>Makefile Syntax</h5> 320 <p>A makefile can contain rules, macro definitions (see <a href="#tag_20_76_13_05">Macros</a> ), include lines, and comments. There 321 are two kinds of rules: <i>target rules</i>, including special targets (see <a href="#tag_20_76_13_04">Target Rules</a> ), and 322 <i>inference rules</i> (see <a href="#tag_20_76_13_06">Inference Rules</a> ). The <i>make</i> utility shall contain a set of 323 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 324 cleared. Additional rules of both kinds can be specified in a makefile. If a rule is defined more than once, the value of the rule 325 shall be that of the last one specified. Macros can also be defined more than once, and the value of the macro is specified in 326 <a href="#tag_20_76_13_05">Macros</a> . There are three kinds of comments: blank lines, empty lines, and a <number-sign> 327 (<tt>'#'</tt>) and all following characters up to the first unescaped <newline> character. Blank lines, empty lines, and 328 lines with <number-sign> (<tt>'#'</tt>) as the first character on the line are also known as comment lines.</p> 329 <p>Target and inference rules can contain <i>command lines</i>. Command lines can have a prefix that shall be removed before 330 execution (see <a href="#tag_20_76_13_03">Makefile Execution</a> ).</p> 331 <p>When an escaped <newline> (one preceded by a <backslash>) is found anywhere in the makefile except in a command line 332 after macro expansion, an include line, or a line immediately preceding an include line, it shall be replaced, along with any 333 leading white space on the next line, with a single <space>. After all macro expansion is complete, when an escaped 334 <newline> is found in a command line in a makefile, the command line that is executed shall contain the <backslash>, 335 the <newline>, and the next line, except that the first character of the next line shall not be included if it is a 336 <tab>. When an escaped <newline> is found in an include line or in a line immediately preceding an include line, the 337 behavior is unspecified.</p> 338 <h5><a name="tag_20_76_13_02" id="tag_20_76_13_02"></a>Include Lines</h5> 339 <p>If the word <b>include</b>, optionally prefixed with a <hyphen-minus> character, appears at the beginning of a line and is 340 followed by one or more <blank> characters, the string formed by the remainder of the line shall be processed as follows to 341 produce one or more pathnames:</p> 342 <ul> 343 <li> 344 <p>The trailing <newline>, any <blank> characters immediately preceding a comment, and any comment shall be discarded. 345 If the resulting string contains any double-quote characters (<tt>'"'</tt> ) the behavior is unspecified.</p> 346 </li> 347 <li> 348 <p>The resulting string shall be processed for macro expansion (see <a href="#tag_20_76_13_05">Macros</a> ).</p> 349 </li> 350 <li> 351 <p>Any <blank> characters that appear after the first non-<blank> shall be used as separators to divide the 352 macro-expanded string into fields. It is unspecified whether pathname expansion (see <a href= 353 "../utilities/V3_chap02.html#tag_19_14"><i>2.14 Pattern Matching Notation</i></a> ) is also performed.</p> 354 </li> 355 <li> 356 <p>If the processing of separators and optional pathname expansion results in zero non-empty fields, the behavior is unspecified. 357 If it results in at least one non-empty field, these fields are taken as pathnames.</p> 358 </li> 359 </ul> 360 <p>For each pathname so identified, in the order specified:</p> 361 <ul> 362 <li> 363 <p>If the pathname does not begin with a <tt>'/'</tt>, it shall be treated as relative to the current working directory of the 364 process, not relative to the directory containing the makefile.</p> 365 </li> 366 <li> 367 <p>The <i>make</i> utility shall use one of the following two methods to attempt to create the file or bring it up-to-date:</p> 368 <ol> 369 <li> 370 <p>The "immediate remaking" method</p> 371 <p>If <i>make</i> uses this method, any target rules or inference rules for the pathname that were parsed before the include line 372 was parsed shall be used to attempt to create the file or to bring it up-to-date before opening the file.</p> 373 </li> 374 <li> 375 <p>The "delayed remaking" method</p> 376 <p>If <i>make</i> uses this method, no attempt shall be made to create the file or bring it up-to-date until after the makefile(s) 377 have been read. During processing of the include line, <i>make</i> shall read the current contents of the file, if it exists, or 378 treat it as an empty file if it does not exist. Once the makefile(s) have been read, <i>make</i> shall use any applicable target 379 rule or inference rule for the pathname, regardless of whether it is parsed before or after the include line, when creating the 380 file or bringing it up-to-date. Additionally in this case, the new contents of the file, if it is successfully created or updated, 381 shall be used when processing rules for the following targets after the makefile(s) have been read:</p> 382 <ul> 383 <li> 384 <p>The <i>target_name</i> operands, if any.</p> 385 </li> 386 <li> 387 <p>The first target <i>make</i> encounters that is not a special target or an inference rule, if no <i>target_name</i> operands are 388 specified.</p> 389 </li> 390 <li> 391 <p>All targets that are prerequisites, directly or recursively, of the above targets.</p> 392 </li> 393 </ul> 394 </li> 395 </ol> 396 <p>If the pathname is relative, the file does not exist, and an attempt to create it using a rule has not been made and will not be 397 made, it is unspecified whether additional directories are searched for an existing file of the same relative pathname.</p> 398 <p>If, after proceeding as described above, the file still cannot be opened:</p> 399 <ul> 400 <li> 401 <p>If the word <b>include</b> was prefixed with a <hyphen-minus> character, the file shall be ignored.</p> 402 </li> 403 <li> 404 <p>Otherwise, an error shall occur.</p> 405 </li> 406 </ul> 407 </li> 408 <li> 409 <p>The contents of the file specified by the pathname shall be read and processed as if they appeared in the makefile in place of 410 the include line. If the file ends with an escaped <newline> the behavior is unspecified.</p> 411 </li> 412 <li> 413 <p>The file may itself contain further include lines. Implementations shall support nesting of include files up to a depth of at 414 least 16.</p> 415 </li> 416 </ul> 417 <h5><a name="tag_20_76_13_03" id="tag_20_76_13_03"></a>Makefile Execution</h5> 418 <p>Makefile command lines shall be processed one at a time.</p> 419 <p>Makefile command lines can have one or more of the following prefixes: a <hyphen-minus> (<tt>'-'</tt>), a 420 <commercial-at> (<tt>'@'</tt>), or a <plus-sign> (<tt>'+'</tt>). These shall modify the way in which <i>make</i> 421 processes the command.</p> 422 <dl compact> 423 <dd></dd> 424 <dt><tt>-</tt></dt> 425 <dd>If the command prefix contains a <hyphen-minus>, or the <b>-i</b> option is present, or the special target <b>.IGNORE</b> 426 has either the current target as a prerequisite or has no prerequisites, any error found while executing the command shall be 427 ignored.</dd> 428 <dt><tt>@</tt></dt> 429 <dd>If the command prefix contains a <commercial-at> and the <i>make</i> utility command line <b>-n</b> option is not 430 specified, or the <b>-s</b> option is present, or the special target <b>.SILENT</b> has either the current target as a prerequisite 431 or has no prerequisites, the command shall not be written to standard output before it is executed.</dd> 432 <dt><tt>+</tt></dt> 433 <dd>If the command prefix contains a <plus-sign>, the command shall be executed even if <b>-n</b>, <b>-q</b>, or <b>-t</b> is 434 specified.</dd> 435 </dl> 436 <p>An <i>execution line</i> is built from the command line by removing any prefix characters. Except as described under the 437 <commercial-at> (<tt>'@'</tt>) prefix, the execution line shall be written to the standard output, optionally preceded by a 438 <tab>. The execution line shall then be executed by a shell as if it were passed as the argument to the <a href= 439 "../functions/system.html"><i>system</i>()</a> interface, except that if errors are not being ignored then the shell <b>-e</b> 440 option shall also be in effect. If errors are being ignored for the command (as a result of the <b>-i</b> option, a <tt>'-'</tt> 441 command prefix, or a <b>.IGNORE</b> special target), the shell <b>-e</b> option shall not be in effect. The environment for the 442 command being executed shall contain all of the variables in the environment of <i>make</i>.</p> 443 <p>By default, when <i>make</i> receives a non-zero status from the execution of a command, it shall terminate with an error 444 message to standard error.</p> 445 <h5><a name="tag_20_76_13_04" id="tag_20_76_13_04"></a>Target Rules</h5> 446 <p>Target rules are formatted as follows:</p> 447 <pre> 448 <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>] 449 [</b><tt><tab></tt><i>command</i><tt> 450 <tab></tt><i>command</i><tt> 451 ...</tt><b>]</b><tt> 452 </tt></pre> 453 <p>Target entries are specified by a <blank>-separated, non-null list of targets, then a <colon>, then a 454 <blank>-separated, possibly empty list of prerequisites. Text following a <semicolon>, if any, and all following lines 455 that begin with a <tab>, are makefile command lines to be executed to update the target. The first non-empty line that does 456 not begin with a <tab> or <tt>'#'</tt> shall begin a new entry. Any comment line may begin a new entry.</p> 457 <p>Applications shall select target names from the set of characters consisting solely of slashes, hyphens, periods, underscores, 458 digits, and alphabetics from the portable character set (see XBD <a href="../basedefs/V1_chap06.html#tag_06_01"><i>6.1 Portable 459 Character Set</i></a> ). Implementations may allow other characters in target names as extensions. The interpretation of targets 460 containing the characters <tt>'%'</tt> and <tt>'"'</tt> is implementation-defined.</p> 461 <p>A target that has prerequisites, but does not have any commands, can be used to add to the prerequisite list for that target. 462 Only one target rule for any given target can contain commands.</p> 463 <p>Lines that begin with one of the following are called <i>special targets</i> and control the operation of <i>make</i>:</p> 464 <dl compact> 465 <dd></dd> 466 <dt><b>.DEFAULT</b></dt> 467 <dd>If the makefile contains this special target, the application shall ensure that it is specified with commands, but without 468 prerequisites. The commands shall be used by <i>make</i> if there are no other rules available to build a target.</dd> 469 <dt><b>.IGNORE</b></dt> 470 <dd>Prerequisites of this special target are targets themselves; this shall cause errors from commands associated with them to be 471 ignored in the same manner as specified by the <b>-i</b> option. Subsequent occurrences of <b>.IGNORE</b> shall add to the list of 472 targets ignoring command errors. If no prerequisites are specified, <i>make</i> shall behave as if the <b>-i</b> option had been 473 specified and errors from all commands associated with all targets shall be ignored.</dd> 474 <dt><b>.NOTPARALLEL</b></dt> 475 <dd><br> 476 The application shall ensure that this special target is specified without prerequisites or commands. When specified, <i>make</i> 477 shall update one target at a time, regardless of whether the <b>-j</b> <i>maxjobs</i> option is specified. If the <b>-j</b> 478 <i>maxjobs</i> option is specified, the option shall continue to be passed unchanged to sub-<i>make</i> invocations via 479 <i>MAKEFLAGS .</i></dd> 480 <dt><b>.PHONY</b></dt> 481 <dd>Prerequisites of this special target are targets themselves; these targets (known as <i>phony targets</i>) shall be considered 482 always out-of-date when the <i>make</i> utility begins executing. If a phony target's commands are executed, that phony target 483 shall then be considered up-to-date until the execution of <i>make</i> completes. Subsequent occurrences of <b>.PHONY</b> shall add 484 to the list of phony targets. A <b>.PHONY</b> special target with no prerequisites shall be ignored. If the <b>-t</b> option is 485 specified, phony targets shall not be touched. Phony targets shall not be removed if <i>make</i> receives one of the asynchronous 486 events explicitly described in the ASYNCHRONOUS EVENTS section.</dd> 487 <dt><b>.POSIX</b></dt> 488 <dd>The application shall ensure that this special target is specified without prerequisites or commands. If it appears as the 489 first non-comment line in the makefile, <i>make</i> shall process the makefile as specified by this section; otherwise, the 490 behavior of <i>make</i> is unspecified.</dd> 491 <dt><b>.PRECIOUS</b></dt> 492 <dd>Prerequisites of this special target shall not be removed if <i>make</i> receives one of the asynchronous events explicitly 493 described in the ASYNCHRONOUS EVENTS section. Subsequent occurrences of <b>.PRECIOUS</b> shall add to the list of precious files. 494 If no prerequisites are specified, all targets in the makefile shall be treated as if specified with <b>.PRECIOUS</b>.</dd> 495 <dt><b>.SCCS_GET</b></dt> 496 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 497 The application shall ensure that this special target is specified without prerequisites. If this special target is included in a 498 makefile, the commands specified with this target shall replace the default commands associated with this special target (see 499 <a href="#tag_20_76_13_09">Default Rules</a> ). The commands specified with this target are used to get all SCCS files that are not 500 found in the current directory. 501 <p>When source files are named in a list of prerequisites, <i>make</i> shall treat them just like any other target. Because the 502 source file 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 503 no prerequisites, but is present in the directory, <i>make</i> shall assume that that file is up-to-date. If, however, an SCCS file 504 named <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 target 505 file 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 file 506 is newer, <i>make</i> shall automatically issue the commands specified for the <b>.SCCS_GET</b> special target to retrieve the most 507 recent version. However, if the target is writable by anyone, <i>make</i> shall not retrieve a new version. <img src= 508 "../images/opt-end.gif" alt="[Option End]" border="0"></p> 509 </dd> 510 <dt><b>.SILENT</b></dt> 511 <dd>Prerequisites of this special target are targets themselves; this shall cause commands associated with them not to be written 512 to the standard output before they are executed. Subsequent occurrences of <b>.SILENT</b> shall add to the list of targets with 513 silent commands. If no prerequisites are specified, <i>make</i> shall behave as if the <b>-s</b> option had been specified and no 514 commands or touch messages associated with any target shall be written to standard output.</dd> 515 <dt><b>.SUFFIXES</b></dt> 516 <dd>Prerequisites of <b>.SUFFIXES</b> shall be appended to the list of known suffixes and are used in conjunction with the 517 inference rules (see <a href="#tag_20_76_13_06">Inference Rules</a> ). If <b>.SUFFIXES</b> does not have any prerequisites, the 518 list of known suffixes shall be cleared.</dd> 519 <dt><b>.WAIT</b></dt> 520 <dd>The application shall ensure that this special target, if specified as a target, is specified without prerequisites or 521 commands. When <b>.WAIT</b> appears as a target, it shall have no effect. When <b>.WAIT</b> appears in a target rule as a 522 prerequisite, it shall not itself be treated as a prerequisite; however, <i>make</i> shall not recursively process the 523 prerequisites (if any) to the right of the <b>.WAIT</b> until the prerequisites (if any) to the left of it have been brought 524 up-to-date. Implementations may also enforce the same ordering between the affected prerequisites while processing other target 525 rules that have some or all of the same affected prerequisites.</dd> 526 </dl> 527 <p>The special targets <b>.IGNORE</b>, <b>.NOTPARALLEL</b>, <b>.PHONY</b>, <b>.POSIX</b>, <b>.PRECIOUS</b>, <b>.SILENT</b>, 528 <b>.SUFFIXES</b>, and <b>.WAIT</b> shall be specified without commands.</p> 529 <p>Targets and prerequisites consisting of a leading <period> followed by the uppercase letters <tt>"POSIX"</tt> and then any 530 other characters are reserved for future standardization. Targets and prerequisites consisting of a leading <period> followed 531 by one or more uppercase letters, that are not described above, are reserved for implementation extensions.</p> 532 <h5><a name="tag_20_76_13_05" id="tag_20_76_13_05"></a>Macros</h5> 533 <p>A macro can be one of two flavors, <i>delayed-expansion</i> or <i>immediate-expansion</i>.</p> 534 <p>The following form defines a delayed-expansion macro (replacing any previous definition of the macro named by 535 <i>string1</i>):</p> 536 <pre> 537 <i>string1</i><tt> = </tt><b>[</b><i>string2</i><b>]</b><tt> 538 </tt></pre> 539 <p>The following form defines an immediate-expansion macro (replacing any previous definition of the macro named by 540 <i>string1</i>):</p> 541 <pre> 542 <i>string1</i><tt> ::= </tt><b>[</b><i>string2</i><b>]</b><tt> 543 </tt></pre> 544 <p>The following form defines a delayed-expansion macro (replacing any previous definition of the macro named by 545 <i>string1</i>):</p> 546 <pre> 547 <i>string1</i><tt> :::= </tt><b>[</b><i>string2</i><b>]</b><tt> 548 </tt></pre> 549 <p>by immediately expanding macros in <i>string2</i>, if any, before assigning the value.</p> 550 <p>The following form defines a delayed-expansion macro (replacing any previous definition of the macro named by 551 <i>string1</i>):</p> 552 <pre> 553 <i>string1</i><tt> != </tt><b>[</b><i>string2</i><b>]</b><tt> 554 </tt></pre> 555 <p>by immediately expanding macros in <i>string2</i>, if any, and then executing the result as a shell command as if it were passed 556 as the argument to the <a href="../functions/system.html"><i>system</i>()</a> interface. The <i>make</i> utility shall capture the 557 standard output from the shell execution and shall remove all white space at the beginning, remove a single trailing 558 <newline> character (if there is one), and then replace all remaining <newline> characters with <space> 559 characters to produce the value assigned to the macro named by <i>string1</i>. It shall not be an error if the shell command has 560 non-zero exit status.</p> 561 <p>The following form defines a delayed-expansion macro, but only if the macro named by <i>string1</i> is not already defined:</p> 562 <pre> 563 <i>string1</i><tt> ?= </tt><b>[</b><i>string2</i><b>]</b><tt> 564 </tt></pre> 565 <p>The following form (the <i>append</i> form) appends additional text to the value of a macro:</p> 566 <pre> 567 <i>string1</i><tt> += </tt><b>[</b><i>string2</i><b>]</b><tt> 568 </tt></pre> 569 <p>When using the append form:</p> 570 <ul> 571 <li> 572 <p>If the macro named by <i>string1</i> does not exist, this form shall be equivalent to the delayed-expansion form</p> 573 <pre> 574 <i>string1</i><tt> = </tt><b>[</b><i>string2</i><b>]</b><tt> 575 </tt></pre></li> 576 <li> 577 <p>If the macro named by <i>string1</i> exists and is an immediate-expansion macro, then a <space> or <tab> character 578 followed by the evaluation of <i>string2</i> shall be appended to the value currently assigned to the macro named by 579 <i>string1</i>.</p> 580 </li> 581 <li> 582 <p>If the macro named by <i>string1</i> exists and is a delayed-expansion macro, then a <space> or <tab> character 583 followed by the unevaluated <i>string2</i> shall be appended to the value currently assigned to the macro named by 584 <i>string1</i>.</p> 585 </li> 586 </ul> 587 <p>In all cases the value of <i>string1</i> is defined as all characters from the first non-<blank> character to the last 588 non-<blank> character, inclusive, before the <tt>=</tt>, <tt>::=</tt>, <tt>:::=</tt>, <tt>!=</tt>, <tt>?=</tt>, or 589 <tt>+=</tt>. Portable applications shall ensure that a <blank> precedes the <tt>::=</tt>, <tt>:::=</tt>, <tt>!=</tt>, 590 <tt>?=</tt>, or <tt>+=</tt> in those forms to avoid any parsing ambiguity with implementations that permit <colon>, 591 <exclamation-mark>, <question-mark>, or <plus-sign> in macro names as extensions. The value of <i>string2</i> is 592 defined as all characters from the first non-<blank> character, if any, after the <equals-sign>, up to but not 593 including a comment character (<tt>'#'</tt>) or an unescaped <newline>.</p> 594 <p>Portable applications shall select macro names from the set of characters consisting solely of characters from the portable 595 filename character set. Implementations may allow other characters in macro names as extensions; however, a macro name shall not 596 contain an <equals-sign>, <blank>, or control character.</p> 597 <p>Macro expansions in <i>string1</i> of macro definition lines shall be evaluated when read. Macro expansions in <i>string2</i> of 598 macro definition lines shall be performed according to the form of macro definition used. In immediate-expansion forms (including 599 appending to an existing immediate-expansion macro), they shall be expanded in the macro definition line and the result of the 600 expansion shall not be scanned for further macros when the macro identified by <i>string1</i> is expanded. In delayed-expansion 601 forms (including appending to an existing delayed-expansion macro, and conditional assignment to a macro not previously existing), 602 they shall not be expanded in the macro definition line; they shall be expanded when the macro identified by <i>string1</i> is 603 expanded, and the result of the expansion shall be scanned for further macros. Implementations shall support at least 100 levels of 604 indirection.</p> 605 <p>Macros can appear anywhere in the makefile. Macro expansions using the forms $(<i>string1</i>) or ${<i>string1</i>} shall be 606 replaced by <i>string2</i>, as follows:</p> 607 <ul> 608 <li> 609 <p>Macros in target lines shall be evaluated when the target line is read.</p> 610 </li> 611 <li> 612 <p>Macros in makefile command lines shall be evaluated when the command is executed.</p> 613 </li> 614 <li> 615 <p>Macros in the string before the <equals-sign> in a macro definition shall be evaluated when the macro assignment is 616 made.</p> 617 </li> 618 <li> 619 <p>Immediate-expansion macros shall be evaluated immediately when the macro assignment is made, and this value shall be used as the 620 replacement until the immediate-expansion macro is redefined.</p> 621 </li> 622 <li> 623 <p>Delayed-expansion macros after the <equals-sign> in macro definitions other than the <tt>:::=</tt>, <tt>!=</tt>, and 624 <tt>+=</tt> forms, and after the <equals-sign> in <tt>+=</tt> form macro definitions where the macro named by <i>string1</i> 625 exists and is a delayed-expansion macro, shall only be evaluated when the defined macro is expanded.</p> 626 </li> 627 </ul> 628 <p>The parentheses or braces are optional if <i>string1</i> is a single character. The string <tt>"$$"</tt> shall be replaced by 629 the single character <tt>'$'</tt>, except during the immediate expansion performed for the <tt>:::=</tt> operator, where it shall 630 be left unmodified. If <i>string1</i> in a macro expansion contains a macro expansion, that inner macro expansion shall be 631 performed first and the result substituted into <i>string1</i> to produce the macro name used for the outer macro expansion.</p> 632 <p>Macro expansions using the forms $(<i>string1</i><b>:</b><i>subst1</i><b>=[</b><i>subst2</i><b>]</b>) or 633 ${<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 634 <i>subst2</i> when the macro substitution is performed. The <i>subst1</i> to be replaced shall be recognized when it is a suffix at 635 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 the beginning of 636 the value, a <blank>, or a <newline>). If <i>string1</i> in a macro expansion contains a macro expansion, that inner 637 macro expansion shall be performed as described above and the result substituted into <i>string1</i> to produce the macro name used 638 for the outer macro expansion.</p> 639 <p>Macro expansions using the forms 640 $(<i>string1</i><b>:[</b><i>op</i><b>]%[</b><i>os</i><b>]=[</b><i>np</i><b>][%][</b><i>ns</i><b>]</b>) or 641 ${<i>string1</i><b>:[</b><i>op</i><b>]%[</b><i>os</i><b>]=[</b><i>np</i><b>][%][</b><i>ns</i><b>]</b>} are called pattern macro 642 expansions, where <i>op</i> is the old prefix, <i>os</i> is the old suffix, <i>np</i> is the new prefix and <i>ns</i> is the new 643 suffix. Any item inside square brackets is optional. With this form, when the macro <i>string1</i> is expanded each 644 white-space-separated word that completely matches the <b>[</b><i>op</i><b>]%[</b><i>os</i><b>]</b> pattern on the left-hand side 645 of the <equals-sign> (<tt>'='</tt>), where the <percent> (<tt>'%'</tt>) character matches zero or more characters, 646 shall be replaced by the right-hand side of the <equals-sign> and shall then be further modified according to the use of 647 <percent> characters as described below. Any words that do not match shall be unmodified in the expansion.</p> 648 <p>If more than one <percent> character appears on the left-hand side of the <equals-sign> (<tt>'='</tt>), the second 649 and subsequent <percent> characters shall be treated as literal characters in <i>os</i>.</p> 650 <p>If no <percent> character appears on the right-hand side of the <equals-sign>, no further modification of the word 651 shall be performed. If a single <percent> character appears on the right-hand side, the <percent> character in the word 652 shall be replaced with the characters matched by the <percent> on the left-hand side. If more than one <percent> 653 character appears on the right-hand side, it is unspecified whether the first <percent> character in the word is replaced 654 with the characters matched by the <percent> on the left-hand side and all remaining <percent> characters are left 655 unchanged, or each <percent> character is replaced with the characters matched by the <percent> on the left-hand 656 side.</p> 657 <p>In both macro expansion forms, any macro expansions on the right-hand side of the <colon> shall be recursively expanded 658 before further examination. If this results in more than one <equals-sign> after the <colon>, the first one shall be 659 the separator.</p> 660 <p>In all forms of macro expansion, if the value of the macro named by <i>string1</i> is an empty string, or if the macro named by 661 <i>string1</i> does not exist, the final result shall be an empty string. <basefont size="2"></p> 662 <dl> 663 <dt><b>Note:</b></dt> 664 <dd>It is not safe to assume that a macro which has not intentionally been set to a specific value will not exist. See APPLICATION 665 USAGE for more information.</dd> 666 </dl> 667 <basefont size="3"> 668 <p>Macro definitions shall be taken from the following sources, in the following logical order, before the makefile(s) are 669 read.</p> 670 <ol> 671 <li> 672 <p>Macros specified on the <i>make</i> utility command line, in the order specified on the command line. It is unspecified whether 673 the internal macros defined in <a href="#tag_20_76_13_08">Internal Macros</a> are accepted from this source.</p> 674 </li> 675 <li> 676 <p>Macros defined by the <i>MAKEFLAGS</i> environment variable, in the order specified in the environment variable. It is 677 unspecified whether the internal macros defined in <a href="#tag_20_76_13_08">Internal Macros</a> are accepted from this 678 source.</p> 679 </li> 680 <li> 681 <p>The contents of the environment, excluding the <i>MAKEFLAGS</i> and <i>SHELL</i> variables and including the variables with null 682 values.</p> 683 </li> 684 <li> 685 <p>Macros defined in the inference rules built into <i>make</i>.</p> 686 </li> 687 </ol> 688 <p>Macro definitions from these sources shall not override macro definitions from a lower-numbered source. Macro definitions from a 689 single source (for example, the <i>make</i> utility command line, the <i>MAKEFLAGS</i> environment variable, or the other 690 environment variables) shall override previous macro definitions from the same source.</p> 691 <p>Macros defined in the makefile(s) shall override macro definitions that occur before them in the makefile(s) and macro 692 definitions from source 4. If the <b>-e</b> option is not specified, macros defined in the makefile(s) shall override macro 693 definitions from source 3. Macros defined in the makefile(s) shall not override macro definitions from source 1 or source 2.</p> 694 <p>Before the makefile(s) are read, all of the <i>make</i> utility command line options (except <b>-f</b> and <b>-p</b>) and 695 <i>make</i> utility command line macro definitions (except any for the <i>MAKEFLAGS</i> macro), not already included in the 696 <i>MAKEFLAGS</i> macro, shall be added to the <i>MAKEFLAGS</i> macro, quoted in an implementation-defined manner such that when 697 <i>MAKEFLAGS</i> is read by another instance of the <i>make</i> command, the original macro's value is recovered. Other 698 implementation-defined options and macros, with the exception of the <i>CURDIR</i> macro, may also be added to the <i>MAKEFLAGS</i> 699 macro. If this modifies the value of the <i>MAKEFLAGS</i> macro, or, if the <i>MAKEFLAGS</i> macro is modified at any subsequent 700 time, the <i>MAKEFLAGS</i> environment variable shall be modified to match the new value of the <i>MAKEFLAGS</i> macro. The result 701 of setting <i>MAKEFLAGS</i> in the Makefile is unspecified.</p> 702 <p>Before the makefile(s) are read, all of the <i>make</i> utility command line macro definitions (except the <i>MAKEFLAGS</i> 703 macro or the <i>SHELL</i> macro) shall be added to the environment of <i>make</i>. Other implementation-defined variables may also 704 be added to the environment of <i>make</i>. Macros defined by the <i>MAKEFLAGS</i> environment variable and macros defined in the 705 makefile(s) shall not be added to the environment of <i>make</i> if they are not already in its environment. With the exception of 706 <i>SHELL</i> (see below), it is unspecified whether macros defined in these ways update the value of an environment variable that 707 already exists in the environment of <i>make</i>.</p> 708 <p>The <i>MAKE</i> macro shall be treated specially. If <i>MAKE</i> is not defined in the environment, the <i>MAKE</i> macro shall 709 be provided by <i>make</i> and set to the value of <i>argv</i>[0] passed to <i>main</i>() (or equivalent, if <i>make</i> is not a C 710 program). If this value contains at least one <slash> and is a relative pathname, <i>make</i> shall convert it to an absolute 711 pathname. If <i>MAKE</i> is defined in the makefile or is specified on the command line, it shall replace the original value of the 712 <i>MAKE</i> macro.</p> 713 <p>The <i>SHELL</i> macro shall be treated specially. It shall be provided by <i>make</i> and set to the pathname of the shell 714 command language interpreter (see <a href="../utilities/sh.html#"><i>sh</i></a> ). The <i>SHELL</i> environment variable shall not 715 affect the value of the <i>SHELL</i> macro. If <i>SHELL</i> is defined in the makefile or is specified on the command line, it 716 shall replace the original value of the <i>SHELL</i> macro, but shall not affect the <i>SHELL</i> environment variable. Other 717 effects of defining <i>SHELL</i> in the makefile or on the command line are implementation-defined.</p> 718 <p>The <i>CURDIR</i> macro shall be treated specially. It shall be provided by <i>make</i> and set to an absolute pathname of the 719 current working directory when <i>make</i> is executed. The value shall be the same as the pathname that would be output by the 720 <a href="../utilities/pwd.html"><i>pwd</i></a> utility with either the <b>-L</b> or <b>-P</b> option; if they differ, it is 721 unspecified which value is used. The <i>CURDIR</i> environment variable shall not affect the value of the <i>CURDIR</i> macro 722 unless the <b>-e</b> option is specified. If the <b>-e</b> option is not specified, there is a <i>CURDIR</i> environment variable 723 set, and its value is different from the <i>CURDIR</i> macro value, the environment variable value shall be set to the macro value. 724 If <i>CURDIR</i> is defined in the makefile, present in the <i>MAKEFLAGS</i> environment variable, or specified on the command 725 line, it shall replace the original value of the <i>CURDIR</i> macro in accordance with the logical order described above, but 726 shall not cause <i>make</i> to change its current working directory.</p> 727 <h5><a name="tag_20_76_13_06" id="tag_20_76_13_06"></a>Inference Rules</h5> 728 <p>Inference rules are formatted as follows:</p> 729 <pre> 730 <i>target</i><tt>: 731 <tab></tt><i>command 732 </i><b>[</b><tt><tab></tt><i>command</i><b>]</b><tt> 733 ... 734 <br> 735 </tt><i>line that does not begin with </i><tt><tab></tt><i> or </i><tt># 736 </tt></pre> 737 <p>The application shall ensure that the <i>target</i> portion is a valid target name (see <a href="#tag_20_76_13_04">Target 738 Rules</a> ) of the form <b>.s2</b> or <b>.s1.s2</b> (where <b>.s1</b> and <b>.s2</b> are suffixes that have been given as 739 prerequisites of the <b>.SUFFIXES</b> special target and s1 and s2 do not contain any <slash> or <period> characters.) 740 If there is only one <period> in the target, it is a single-suffix inference rule. Targets with two periods are double-suffix 741 inference rules. Inference rules can have only one target before the <colon>.</p> 742 <p>The application shall ensure that the makefile does not specify prerequisites for inference rules; no characters other than 743 white space shall follow the <colon> in the first line, except when creating the <i>empty rule,</i> described below. 744 Prerequisites are inferred, as described below.</p> 745 <p>Inference rules can be redefined. A target that matches an existing inference rule shall overwrite the old inference rule. An 746 empty rule can be created with a command consisting of simply a <semicolon> (that is, the rule still exists and is found 747 during inference rule search, but since it is empty, execution has no effect). The empty rule can also be formatted as follows:</p> 748 <pre> 749 <i>rule</i><tt>: ; 750 </tt></pre> 751 <p>where zero or more <blank> characters separate the <colon> and <semicolon>.</p> 752 <p>The <i>make</i> utility uses the suffixes of targets and their prerequisites to infer how a target can be made up-to-date. A 753 list of inference rules defines the commands to be executed. By default, <i>make</i> contains a built-in set of inference rules. 754 Additional rules can be specified in the makefile.</p> 755 <p>The special target <b>.SUFFIXES</b> contains as its prerequisites a list of suffixes that shall be used by the inference rules. 756 The order in which the suffixes are specified defines the order in which the inference rules for the suffixes are used. New 757 suffixes shall be appended to the current list by specifying a <b>.SUFFIXES</b> special target in the makefile. A <b>.SUFFIXES</b> 758 target with no prerequisites shall clear the list of suffixes. An empty <b>.SUFFIXES</b> target followed by a new <b>.SUFFIXES</b> 759 list is required to change the order of the suffixes.</p> 760 <p>Normally, the user would provide an inference rule for each suffix. The inference rule to update a target with a suffix 761 <b>.s1</b> from a prerequisite with a suffix <b>.s2</b> is specified as a target <b>.s2.s1</b>. The internal macros provide the 762 means to specify general inference rules (see <a href="#tag_20_76_13_08">Internal Macros</a> ).</p> 763 <p>When no target rule with commands is found to update a target, the inference rules shall be checked. The suffix of the target 764 (<b>.s1</b>) to be built shall be compared to the list of suffixes specified by the <b>.SUFFIXES</b> special targets. If the 765 <b>.s1</b> suffix is found in <b>.SUFFIXES</b>, the inference rules shall be searched in the order defined for the first 766 <b>.s2.s1</b> rule whose prerequisite file (<b>$*.s2</b>) exists. If the target is out-of-date with respect to this prerequisite, 767 the commands for that inference rule shall be executed. Prerequisites added by target rules without commands shall not affect the 768 selection of the applicable inference rule.</p> 769 <p>If the target to be built does not contain a suffix and there is no rule for the target, the single-suffix inference rules shall 770 be checked. The single-suffix inference rules define how to build a target if a file is found with a name that matches the target 771 name with one of the single suffixes appended. A rule with one suffix <b>.s2</b> is the definition of how to build target from 772 <b>target.s2</b>. The other suffix (<b>.s1</b>) is treated as null.</p> 773 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> A 774 <tilde> (<tt>'~'</tt>) in the above rules refers to an SCCS file in the current directory. Thus, the rule <b>.c~.o</b> would 775 transform an SCCS C-language source file into an object file (<b>.o</b>). Because the <b>s.</b> of the SCCS files is a prefix, it 776 is incompatible with <i>make</i>'s suffix point of view. Hence, the <tt>'~'</tt> is a way of changing any file reference into an 777 SCCS file reference. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p> 778 <h5><a name="tag_20_76_13_07" id="tag_20_76_13_07"></a>Libraries</h5> 779 <p>If a target or prerequisite contains parentheses, it shall be treated as a member of an archive library. For the 780 <i>lib</i>(<i>member</i><b>.o</b>) expression <i>lib</i> refers to the name of the archive library and <i>member</i><b>.o</b> to 781 the member name. The application shall ensure that the member is an object file with the <b>.o</b> suffix. The modification time of 782 the expression is the modification time for the member as kept in the archive library; see <a href= 783 "../utilities/ar.html#"><i>ar</i></a> . The <b>.a</b> suffix shall refer to an archive library. The <b>.s2.a</b> rule shall be used 784 to update a member in the library from a file with a suffix <b>.s2</b>.</p> 785 <h5><a name="tag_20_76_13_08" id="tag_20_76_13_08"></a>Internal Macros</h5> 786 <p>The <i>make</i> utility shall maintain a set of internal macros that can be used in the commands of target and inference rules, 787 as described below. In order to clearly define the meaning of these macros, some clarification of the terms <i>target rule</i>, 788 <i>inference rule</i>, <i>target</i>, and <i>prerequisite</i> is necessary.</p> 789 <p>Target rules are specified by the user in a makefile for a particular target. Inference rules are user-specified or 790 <i>make</i>-specified rules for a particular class of target name. Explicit prerequisites are those prerequisites specified in a 791 makefile on target lines. Implicit prerequisites are those prerequisites that are generated when inference rules are used. 792 Inference rules are applied to implicit prerequisites or to explicit prerequisites that do not have target rules defined for them 793 in the makefile. Target rules are applied to targets specified in the makefile.</p> 794 <p>Before any target in the makefile is updated, each of its prerequisites (both explicit and implicit) shall be updated. This 795 shall be accomplished by recursively processing each prerequisite. Upon recursion, each prerequisite shall become a target itself. 796 Its prerequisites in turn shall be processed recursively until a target is found that has no prerequisites, or further recursion 797 would require applying two inference rules one immediately after the other, at which point the recursion shall stop. As an 798 extension, implementations may continue recursion when two or more successive inference rules need to be applied; however, if there 799 are multiple different chains of such rules that could be used to create the target, it is unspecified which chain is used. The 800 recursion shall then back up, updating each target as it goes.</p> 801 <p>In the definitions that follow, the word <i>target</i> refers to one of:</p> 802 <ul> 803 <li> 804 <p>A target specified in the makefile</p> 805 </li> 806 <li> 807 <p>An explicit prerequisite specified in the makefile that becomes the target when <i>make</i> processes it during recursion</p> 808 </li> 809 <li> 810 <p>An implicit prerequisite that becomes a target when <i>make</i> processes it during recursion</p> 811 </li> 812 </ul> 813 <p>In the definitions that follow, the word <i>prerequisite</i> refers to one of:</p> 814 <ul> 815 <li> 816 <p>An explicit prerequisite specified in the makefile for a particular target</p> 817 </li> 818 <li> 819 <p>An implicit prerequisite generated as a result of locating an appropriate inference rule and corresponding file that matches the 820 suffix of the target</p> 821 </li> 822 </ul> 823 <p>The internal macros are:</p> 824 <dl compact> 825 <dd></dd> 826 <dt>$@</dt> 827 <dd>The $@ macro shall evaluate to the full target name of the current target, or the archive filename part of a library archive 828 target. It shall be evaluated for both target and inference rules. 829 <p>For example, in the <b>.c.a</b> inference rule, $@ represents the out-of-date <b>.a</b> file to be built. Similarly, in a 830 makefile target rule to build <b>lib.a</b> from <b>file.c</b>, $@ represents the out-of-date <b>lib.a</b>.</p> 831 </dd> 832 <dt>$%</dt> 833 <dd>The $% macro shall be evaluated only when the current target is an archive library member of the form 834 <i>libname</i>(<i>member</i><b>.o</b>). In these cases, $@ shall evaluate to <i>libname</i> and $% shall evaluate to 835 <i>member</i><b>.o</b>. The $% macro shall be evaluated for both target and inference rules. 836 <p>For example, in a makefile target rule to build <b>lib.a</b>(<b>file.o</b>), $% represents <b>file.o</b>, as opposed to $@, 837 which represents <b>lib.a</b>.</p> 838 </dd> 839 <dt>$^</dt> 840 <dd>The $^ macro shall evaluate to the list of prerequisites for the current target, with any duplicates (except the first) 841 removed. It shall be evaluated for both target and inference rules. If the list of prerequisites of the target contains any 842 <b>.WAIT</b> special targets, the results of expanding $^ are unspecified. 843 <p>For example, in a makefile target rule to build <i>prog</i> from <b>file1.o</b>, <b>file2.o</b>, and <b>file3.o</b>, and 844 regardless of which prerequisites <i>prog</i> is out-of-date with respect to, $^ represents <b>file1.o</b>, <b>file2.o</b>, and 845 <b>file3.o</b>.</p> 846 </dd> 847 <dt>$+</dt> 848 <dd>The $+ macro shall be equivalent to $^, except that duplicates shall not be removed; all prerequisites shall appear in the 849 order they were listed in the makefile.</dd> 850 <dt>$?</dt> 851 <dd>The $? macro shall evaluate to the list of prerequisites that are newer than the current target. It shall be evaluated for both 852 target and inference rules. 853 <p>For example, in a makefile target rule to build <i>prog</i> from <b>file1.o</b>, <b>file2.o</b>, and <b>file3.o</b>, and where 854 <i>prog</i> is not out-of-date with respect to <b>file1.o</b>, but is out-of-date with respect to <b>file2.o</b> and 855 <b>file3.o</b>, $? represents <b>file2.o</b> and <b>file3.o</b>.</p> 856 </dd> 857 <dt>$<</dt> 858 <dd>In an inference rule, the $< macro shall evaluate to the filename whose existence allowed the inference rule to be chosen 859 for the target. In the <b>.DEFAULT</b> rule, the $< macro shall evaluate to the current target name. The meaning of the $< 860 macro is otherwise unspecified. 861 <p>For example, in the <b>.c.a</b> inference rule, $< represents the prerequisite <b>.c</b> file.</p> 862 </dd> 863 <dt>$*</dt> 864 <dd>The $* macro shall evaluate to the current target name with its suffix deleted. It shall be evaluated at least for inference 865 rules. 866 <p>For example, in the <b>.c.a</b> inference rule, $*.o represents the out-of-date <b>.o</b> file that corresponds to the 867 prerequisite <b>.c</b> file.</p> 868 </dd> 869 </dl> 870 <p>Each of the internal macros has an alternative form. When an uppercase <tt>'D'</tt> or <tt>'F'</tt> is appended to any of the 871 macros, the meaning shall be changed to the <i>directory part</i> for <tt>'D'</tt> and <i>filename part</i> for <tt>'F'</tt>. The 872 directory part is the path prefix of the file without a trailing <slash>; for the current directory, the directory part is 873 <tt>'.'</tt>. When the $? macro contains more than one prerequisite filename, the $(?D) and $(?F) (or ${?D} and ${?F}) macros 874 expand to a list of directory name parts and filename parts respectively.</p> 875 <p>For the target <i>lib</i>(<i>member</i><b>.o</b>) and the <b>.s2.a</b> rule, the internal macros shall be defined as:</p> 876 <dl compact> 877 <dd></dd> 878 <dt>$<</dt> 879 <dd><i>member</i><b>.s2</b></dd> 880 <dt>$*</dt> 881 <dd><i>member</i></dd> 882 <dt>$@</dt> 883 <dd><i>lib</i></dd> 884 <dt>$^</dt> 885 <dd><i>member</i><b>.s2</b></dd> 886 <dt>$?</dt> 887 <dd><i>member</i><b>.s2</b></dd> 888 <dt>$%</dt> 889 <dd><i>member</i><b>.o</b></dd> 890 </dl> 891 <h5><a name="tag_20_76_13_09" id="tag_20_76_13_09"></a>Default Rules</h5> 892 <p>The default rules and macro values for <i>make</i> shall achieve results that are the same as if the following were used, except 893 that where a result includes the literal value of a macro, this value may differ. Implementations that do not support the 894 C-Language Development Utilities option may omit <b>CC</b>, <b>CFLAGS</b>, <b>YACC</b>, <b>YFLAGS</b>, <b>LEX</b>, <b>LFLAGS</b>, 895 <b>LDFLAGS</b>, and the <b>.c</b>, <b>.y</b>, and <b>.l</b> inference rules. Implementations may provide additional macros and 896 rules.</p> 897 <pre> 898 <i>SPECIAL TARGETS</i><tt> 899 <br> 900 <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 901 .SCCS_GET: 902 sccs $(SCCSFLAGS) get $(SCCSGETFLAGS) $@ 903 <img src="../images/opt-end.gif" alt="[Option End]" border="0"> 904 <br> 905 <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> 906 .SUFFIXES: .o .c .y .l .a .sh <img src="../images/opt-start.gif" border="0">.c~ .y~ .l~ .sh~<img src="../images/opt-end.gif" 907 border="0"> 908 <br> 909 </tt><i>MACROS</i><tt> 910 <br> 911 AR=ar 912 ARFLAGS=-rv 913 YACC=yacc 914 YFLAGS= 915 LEX=lex 916 LFLAGS= 917 LDFLAGS= 918 CC=c17 919 CFLAGS=-O 1 920 <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 921 GET=get 922 GFLAGS= 923 SCCSFLAGS= 924 SCCSGETFLAGS=-s 925 <img src="../images/opt-end.gif" alt="[Option End]" border="0"> 926 <br> 927 </tt><i>SINGLE-SUFFIX RULES</i><tt> 928 <br> 929 .c: 930 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< 931 <br> 932 .sh: 933 cp $< $@ 934 chmod a+x $@ 935 <br> 936 <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 937 .c~: 938 $(GET) $(GFLAGS) -p $< > $*.c 939 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $*.c 940 <br> 941 .sh~: 942 $(GET) $(GFLAGS) -p $< > $*.sh 943 cp $*.sh $@ 944 chmod a+x $@ 945 <img src="../images/opt-end.gif" alt="[Option End]" border="0"> 946 <br> 947 </tt><i>DOUBLE-SUFFIX RULES</i><tt> 948 <br> 949 .c.o: 950 $(CC) $(CFLAGS) -c $< 951 <br> 952 .y.o: 953 $(YACC) $(YFLAGS) $< 954 $(CC) $(CFLAGS) -c y.tab.c 955 rm -f y.tab.c 956 mv y.tab.o $@ 957 <br> 958 .l.o: 959 $(LEX) $(LFLAGS) $< 960 $(CC) $(CFLAGS) -c lex.yy.c 961 rm -f lex.yy.c 962 mv lex.yy.o $@ 963 <br> 964 .y.c: 965 $(YACC) $(YFLAGS) $< 966 mv y.tab.c $@ 967 <br> 968 .l.c: 969 $(LEX) $(LFLAGS) $< 970 mv lex.yy.c $@ 971 <br> 972 <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 973 .c~.o: 974 $(GET) $(GFLAGS) -p $< > $*.c 975 $(CC) $(CFLAGS) -c $*.c 976 <br> 977 .y~.o: 978 $(GET) $(GFLAGS) -p $< > $*.y 979 $(YACC) $(YFLAGS) $*.y 980 $(CC) $(CFLAGS) -c y.tab.c 981 rm -f y.tab.c 982 mv y.tab.o $@ 983 <br> 984 .l~.o: 985 $(GET) $(GFLAGS) -p $< > $*.l 986 $(LEX) $(LFLAGS) $*.l 987 $(CC) $(CFLAGS) -c lex.yy.c 988 rm -f lex.yy.c 989 mv lex.yy.o $@ 990 <br> 991 .y~.c: 992 $(GET) $(GFLAGS) -p $< > $*.y 993 $(YACC) $(YFLAGS) $*.y 994 mv y.tab.c $@ 995 <br> 996 .l~.c: 997 $(GET) $(GFLAGS) -p $< > $*.l 998 $(LEX) $(LFLAGS) $*.l 999 mv lex.yy.c $@ 1000 <img src="../images/opt-end.gif" alt="[Option End]" border="0"> 1001 <br> 1002 .c.a: 1003 $(CC) -c $(CFLAGS) $< 1004 $(AR) $(ARFLAGS) $@ $*.o 1005 rm -f $*.o 1006 </tt></pre></blockquote> 1007 <h4 class="mansect"><a name="tag_20_76_14" id="tag_20_76_14"></a>EXIT STATUS</h4> 1008 <blockquote> 1009 <p>When the <b>-q</b> option is specified, the <i>make</i> utility shall exit with one of the following values:</p> 1010 <dl compact> 1011 <dd></dd> 1012 <dt> 0</dt> 1013 <dd>All specified targets were already up-to-date.</dd> 1014 <dt> 1</dt> 1015 <dd>One or more targets were not up-to-date.</dd> 1016 <dt>>1</dt> 1017 <dd>An error occurred.</dd> 1018 </dl> 1019 <p>When the <b>-q</b> option is not specified, the <i>make</i> utility shall exit with one of the following values:</p> 1020 <dl compact> 1021 <dd></dd> 1022 <dt> 0</dt> 1023 <dd>All specified targets were already up-to-date, or all commands executed to bring targets up-to-date either exited with status 0 1024 or had a non-zero exit status that was specified (via the <b>-i</b> option, the special target <b>.IGNORE</b>, or a <tt>'-'</tt> 1025 command prefix) to be ignored.</dd> 1026 <dt>>0</dt> 1027 <dd>An error occurred, or at least one command executed to bring a target up-to-date exited with a non-zero exit status that was 1028 not specified to be ignored.</dd> 1029 </dl> 1030 </blockquote> 1031 <h4 class="mansect"><a name="tag_20_76_15" id="tag_20_76_15"></a>CONSEQUENCES OF ERRORS</h4> 1032 <blockquote> 1033 <p>Default.</p> 1034 </blockquote> 1035 <hr> 1036 <div class="box"><em>The following sections are informative.</em></div> 1037 <h4 class="mansect"><a name="tag_20_76_16" id="tag_20_76_16"></a>APPLICATION USAGE</h4> 1038 <blockquote> 1039 <p>If there is a source file (such as <b>./source.c</b>) and there are two SCCS files corresponding to it (<b>./s.source.c</b> and 1040 <b>./SCCS/s.source.c</b>), on XSI-conformant systems <i>make</i> uses the SCCS file in the current directory. However, users are 1041 advised to use the underlying SCCS utilities (<a href="../utilities/admin.html"><i>admin</i></a>, <a href= 1042 "../utilities/delta.html"><i>delta</i></a>, <a href="../utilities/get.html"><i>get</i></a>, and so on) or the <a href= 1043 "../utilities/sccs.html"><i>sccs</i></a> utility for all source files in a given directory. If both forms are used for a given 1044 source file, future developers are very likely to be confused.</p> 1045 <p>It is incumbent upon portable makefiles to specify the <b>.POSIX</b> special target in order to guarantee that they are not 1046 affected by local extensions.</p> 1047 <p>The <b>-k</b> and <b>-S</b> options are both present so that the relationship between the command line, the <i>MAKEFLAGS</i> 1048 variable, and the makefile can be controlled precisely. If the <b>k</b> flag is passed in <i>MAKEFLAGS</i> and a command is of the 1049 form:</p> 1050 <pre> 1051 <tt>$(MAKE) -S foo 1052 </tt></pre> 1053 <p>then the default behavior is restored for the child <i>make</i>.</p> 1054 <p>When the <b>-n</b> option is specified, it is always added to <i>MAKEFLAGS .</i> This allows a recursive <i>make</i> <b>-n</b> 1055 <i>target</i> to be used to see all of the actions that would be taken to update <i>target</i>.</p> 1056 <p>Because of widespread historical practice, interpreting a <number-sign> (<tt>'#'</tt>) inside a variable as the start of a 1057 comment has the unfortunate side-effect of making it impossible to place a <number-sign> in a variable, thus forbidding 1058 something like:</p> 1059 <pre> 1060 <tt>CFLAGS = -D "COMMENT_CHAR='#'" 1061 </tt></pre> 1062 <p>Many historical <i>make</i> utilities stop chaining together inference rules when an intermediate target is nonexistent. For 1063 example, it might be possible for a <i>make</i> to determine that both <b>.y.c</b> and <b>.c.o</b> could be used to convert a 1064 <b>.y</b> to a <b>.o</b>. Instead, in this case, <i>make</i> requires the use of a <b>.y.o</b> rule.</p> 1065 <p>The standard set of default rules uses only features provided by other parts of this volume of POSIX.1-2024. They include rules 1066 for optional utilities in this volume of POSIX.1-2024, but only rules pertaining to utilities that are provided are needed in an 1067 implementation's default set.</p> 1068 <p>Although <i>make</i> expands macros that do not exist to an empty string, it is not safe to assume that a macro which has not 1069 intentionally been set to a specific value will expand to an empty string for everyone who uses the makefile. There are two reasons 1070 for this:</p> 1071 <ol> 1072 <li> 1073 <p>When another user executes <i>make</i>, they might happen to have an environment variable of the same name (which they have set 1074 for some unrelated purpose) with a non-empty value.</p> 1075 </li> 1076 <li> 1077 <p>A different implementation of <i>make</i> (or a later version of the same implementation) might have a non-empty value for the 1078 macro in its default set.</p> 1079 </li> 1080 </ol> 1081 <p>This is one aspect of a more general problem, which is that any macro that is not one for which this standard requires a default 1082 value, and is not explicitly set either in the makefile or on the <i>make</i> command line, can have an unexpected value (or 1083 unexpectedly not exist) when the makefile is used by a different user or with a different <i>make</i> implementation.</p> 1084 <p>For this reason, it is recommended that makefile authors do not design makefile schemes in which values for non-standard macros 1085 are obtained from the user's environment variables. Safer methods of allowing users to configure macro values include:</p> 1086 <ul> 1087 <li> 1088 <p>Setting the macros to default values in a <i>make</i> include file where the user can edit the values.</p> 1089 </li> 1090 <li> 1091 <p>Executing <i>make</i> from one or more wrapper scripts which set macro values on the command line (and which do not obtain those 1092 values from environment variables).</p> 1093 </li> 1094 </ul> 1095 <p>Makefile authors who follow this recommendation may wish to check for any macros they have overlooked by using a <i>make</i> 1096 implementation that provides, as an extension, a command-line option that causes <i>make</i> to report attempts to expand (or 1097 append to) macros that do not exist. Users of makefiles written by others can also benefit from the use of such an option to detect 1098 the opposite problem (where the author had a macro being set from an environment variable but the user does not have the variable 1099 set). This can avoid misbehaviors that would otherwise be hard to debug, such as a file-processing utility reading from standard 1100 input because it was not given any pathnames to process.</p> 1101 <p>Makefile authors who choose not to follow the recommendation can minimize the risk of misbehavior by ensuring all non-standard 1102 macros have names that begin with a suitable project-specific prefix.</p> 1103 <p>Use of the <b>-e</b> option is strongly discouraged, as it makes the problem discussed above even more likely by introducing the 1104 possibility of unexpected values occurring even for macros set in the makefile. If a specific macro needs a value from the 1105 environment to override a value set in the makefile, it is safer to set just that macro on the command line, using for example 1106 <tt>make MYPROJ_FOO="$MYPROJ_FOO"</tt>. Alternatively, the makefile can be modified to use the <tt>?=</tt> assignment operator 1107 for that macro.</p> 1108 <p>Delayed-expansion macros are evaluated when they are used rather than when they are defined. Therefore:</p> 1109 <pre> 1110 <tt>MACRO = </tt><i>value1</i><tt> 1111 Immed ::= $(MACRO) 1112 DELAY = $(MACRO) 1113 MACRO = </tt><i>value2</i><tt> 1114 <br> 1115 target: 1116 echo $(Immed) $(DELAY) 1117 </tt></pre> 1118 <p>would produce <tt>"value1 value2"</tt>, since <b>Immed</b> was expanded while <b>MACRO</b> was <i>value1</i>, but <b>DELAY</b> 1119 was not expanded until it was needed in the <a href="../utilities/echo.html"><i>echo</i></a> command line when <b>MACRO</b> was 1120 <i>value2</i>.</p> 1121 <p>Because the behavior of the <tt>+=</tt> assignment differs depending on whether the macro being appended to is a 1122 delayed-expansion macro or an immediate-expansion macro, it is recommended that when both macro types are used in a set of multiple 1123 makefiles and include files, a naming convention is adopted to distinguish the two macro types. This avoids any confusion about 1124 whether <tt>+=</tt> will append the expanded or unexpanded value. A suitable convention might be to name delayed-expansion macros 1125 using uppercase and underscore characters and immediate-expansion macros using a name that contains at least one lowercase 1126 character.</p> 1127 <p>Some historical applications have been known to intermix <i>target_name</i> and <i>macro=name</i> operands on the command line, 1128 expecting that all of the macros are processed before any of the targets are dealt with. Conforming applications do not do this, 1129 although some backwards-compatibility support may be included in some implementations.</p> 1130 <p>The following characters in filenames may give trouble: <tt>'='</tt>, <tt>':'</tt>, <tt>'`'</tt>, single-quote, and 1131 <tt>'@'</tt>. In include filenames, pattern matching characters and <tt>'"'</tt> should also be avoided, as they may be treated as 1132 special by some implementations.</p> 1133 <p>For inference rules, the descriptions of $< and $? seem similar. However, an example shows the minor difference. In a 1134 makefile containing:</p> 1135 <pre> 1136 <tt>foo.o: foo.h 1137 </tt></pre> 1138 <p>if <b>foo.h</b> is newer than <b>foo.o</b>, yet <b>foo.c</b> is older than <b>foo.o</b>, the built-in rule to make <b>foo.o</b> 1139 from <b>foo.c</b> is used, with $< equal to <b>foo.c</b> and $? equal to <b>foo.h</b>. If <b>foo.c</b> is also newer than 1140 <b>foo.o</b>, $< is equal to <b>foo.c</b> and $? is equal to <b>foo.h foo.c</b>.</p> 1141 <p>As a consequence of the general rules for target updating, a useful special case is that if a target has no prerequisites and no 1142 commands, and the target of the rule is a nonexistent file, then <i>make</i> acts as if this target has been updated whenever its 1143 rule is run. <basefont size="2"></p> 1144 <dl> 1145 <dt><b>Note:</b></dt> 1146 <dd>This implies that all targets depending on this one will always have their commands run.</dd> 1147 </dl> 1148 <basefont size="3"> 1149 <p>Shell command sequences like <tt>make; cp original copy; make</tt> may have problems on filesystems where 1150 the timestamp resolution is the minimum (1 second) required by the standard and where <i>make</i> considers identical timestamps to 1151 be up-to-date. Conversely, rules like <tt>copy: original; cp -p original copy</tt> will result in 1152 redundant work on <i>make</i> implementations that consider identical timestamps to be out-of-date.</p> 1153 <p>The requirements relating to dynamic include files (ones that have rules to create or update them) allow two different methods 1154 of implementing them, as explained in RATIONALE below. In order to write a set of makefiles and include files (both dynamic and 1155 static) that work with both methods, applications need to ensure the following:</p> 1156 <ul> 1157 <li> 1158 <p>Rules containing commands for creating dynamic include files (and any prerequisites) precede the include line that will cause 1159 the file to be read.</p> 1160 </li> 1161 <li> 1162 <p>Include lines and rules for creating dynamic include files do not depend on the contents of any earlier dynamic include file. 1163 For example, defining a macro in a dynamic include file and using that macro in a later include line should be avoided (unless the 1164 later include line is itself inside the dynamic include file).</p> 1165 </li> 1166 <li> 1167 <p>One of the rules used in creating a dynamic include file, or a dynamic prerequisite of an include file, contains commands to 1168 create its target and does not ignore creation failure.</p> 1169 </li> 1170 </ul> 1171 <p>Note that although the first point above appears at first sight to preclude a dynamic include file that defines its own 1172 prerequisites, this can be achieved by having two include lines that name the same file (provided the rules in the file do not 1173 contain command lines), as shown in EXAMPLES.</p> 1174 <p>This standard does not specify precedence between macro definition and include directives. Thus, the behavior of:</p> 1175 <pre> 1176 <tt>include =foo.mk 1177 </tt></pre> 1178 <p>is unspecified. To define a variable named include, either the white space before the <equal-sign> should be removed, or 1179 another macro should be used, as in:</p> 1180 <pre> 1181 <tt>INCLUDE_NAME = include 1182 $(INCLUDE_NAME) =foo.mk 1183 </tt></pre> 1184 <p>On the other hand, if the intent is to include a file which starts with an <equal-sign>, either the filename should be 1185 changed to <tt>./=foo.mk</tt>, or the makefile should be written as:</p> 1186 <pre> 1187 <tt>INCLUDE_FILE = =foo.mk 1188 include $(INCLUDE_FILE) 1189 </tt></pre> 1190 <p>It is important to be careful when using parallel execution (the <b>-j</b> option) and archives. If multiple <tt>$(AR)</tt> 1191 commands run at the same time on the same archive file, they will not know about each other and can corrupt the file. If the 1192 <b>-j</b> option is used, it is necessary to use <b>.WAIT</b> in between archive member prerequisites to prevent this (see 1193 EXAMPLES).</p> 1194 </blockquote> 1195 <h4 class="mansect"><a name="tag_20_76_17" id="tag_20_76_17"></a>EXAMPLES</h4> 1196 <blockquote> 1197 <ol> 1198 <li> 1199 <p>The following command:</p> 1200 <pre> 1201 <tt>make 1202 </tt></pre> 1203 <p>makes the first target found in the makefile.</p> 1204 </li> 1205 <li> 1206 <p>The following command:</p> 1207 <pre> 1208 <tt>make junk 1209 </tt></pre> 1210 <p>makes the target <b>junk</b>.</p> 1211 </li> 1212 <li> 1213 <p>The following makefile says that <b>pgm</b> depends on two files, <b>a.o</b> and <b>b.o</b>, and that they in turn depend on 1214 their corresponding source files (<b>a.c</b> and <b>b.c</b>), and a common file <b>incl.h</b>:</p> 1215 <pre> 1216 <tt>.POSIX: 1217 pgm: a.o b.o 1218 c17 a.o b.o -o pgm 1219 a.o: incl.h a.c 1220 c17 -c a.c 1221 b.o: incl.h b.c 1222 c17 -c b.c 1223 </tt></pre></li> 1224 <li> 1225 <p>The following is an extended version of the previous example that generates <i>make</i> include files containing the 1226 prerequisites for each object file. The include file also defines its own prerequisites, and the makefile arranges that these are 1227 used by including the file twice. With implementations of <i>make</i> that create include files during parsing, the first time 1228 <i>make</i> is run the file does not exist but the use of the <hyphen-minus> prefix on the first include line means it is 1229 ignored and is then generated by the rule preceding the second include line. On subsequent runs, if any of the source or header 1230 files previously identified has changed, the include file will be updated. There are other ways of updating the include file when 1231 headers change, but they involve recursive execution of <i>make</i>.</p> 1232 <pre> 1233 <tt>.POSIX: 1234 .SUFFIXES: .c .d 1235 1236 OFILES = a.o b.o 1237 1238 pgm: $(OFILES) 1239 c17 $(OFILES) -o pgm 1240 a.o: 1241 c17 -c a.c 1242 b.o: 1243 c17 -c b.c 1244 1245 -include $(OFILES:.o=.d) 1246 .c.d: 1247 +{ \ 1248 set -o pipefail; cfile=$<; ofile=$${cfile%.c}.o; \ 1249 printf '%s %s: %s ' "$$ofile" $@ $<; \ 1250 c17 -E $< | LC_ALL=C sed -n \ 1251 '/^#[[:blank:]]*[[:digit:]]/s/.*"\([^"]*\.h\)".*/\1/p' | \ 1252 LC_ALL=C sort -u | tr '\n' ' '; \ 1253 echo; \ 1254 } > $@ 1255 include $(OFILES:.o=.d) 1256 </tt></pre> 1257 <p>This example does not cope with a header file being removed (<a href="../utilities/make.html"><i>make</i></a> will complain that 1258 it does not know how to make it), necessitating that <b>*.d</b> be removed and the <i>make</i> run again. Alternatively, this can 1259 be handled by updating the commands which generate the <b>.d</b> file so that they add an empty target rule for each of its 1260 prerequisites.</p> 1261 </li> 1262 <li> 1263 <p>An example for making optimized <b>.o</b> files from <b>.c</b> files is:</p> 1264 <pre> 1265 <tt>.c.o: 1266 c17 -c -O 1 $*.c 1267 </tt></pre> 1268 <p>or:</p> 1269 <pre> 1270 <tt>.c.o: 1271 c17 -c -O 1 $< 1272 </tt></pre></li> 1273 <li> 1274 <p>The most common use of the archive interface follows. Here, it is assumed that the source files are all C-language source:</p> 1275 <pre> 1276 <tt>lib.a: lib.a(file1.o) .WAIT lib.a(file2.o) .WAIT lib.a(file3.o) 1277 @echo lib.a is now up-to-date 1278 </tt></pre> 1279 <p>The <b>.c.a</b> rule is used to make <b>file1.o</b>, <b>file2.o</b>, and <b>file3.o</b> and insert them into <b>lib.a</b>.</p> 1280 </li> 1281 <li> 1282 <p>The treatment of escaped <newline> characters throughout the makefile is historical practice. For example, the inference 1283 rule:</p> 1284 <pre> 1285 <tt>.c.o\ 1286 : 1287 </tt></pre> 1288 <p>works, and the macro:</p> 1289 <pre> 1290 <tt>f= bar baz\ 1291 biz 1292 a: 1293 echo ==$f== 1294 </tt></pre> 1295 <p>echoes <tt>"==bar baz biz=="</tt>.</p> 1296 <p>If $? were:</p> 1297 <pre> 1298 <tt>/usr/include/stdio.h /usr/include/unistd.h foo.h 1299 </tt></pre> 1300 <p>then $(?D) would be:</p> 1301 <pre> 1302 <tt>/usr/include /usr/include . 1303 </tt></pre> 1304 <p>and $(?F) would be:</p> 1305 <pre> 1306 <tt>stdio.h unistd.h foo.h 1307 </tt></pre></li> 1308 <li> 1309 <p>The contents of the built-in rules can be viewed by running:</p> 1310 <pre> 1311 <tt>make -p -f /dev/null 2>/dev/null 1312 </tt></pre></li> 1313 <li> 1314 <p>With the following makefile, <tt>make -j 10 all</tt> may bring <tt>one</tt> and <tt>two</tt> up-to-date in parallel despite the 1315 <b>.WAIT</b> in the prerequisite list for <tt>foo</tt>. This is because the <b>.WAIT</b> does not stop <i>make</i> from recursively 1316 processing <tt>bar</tt> and its prerequisites in parallel. However, if only <tt>foo</tt> is specified (<tt>make -j 10 foo</tt>), 1317 <i>make</i> will wait for <tt>one</tt> to be brought up-to-date before bringing <tt>two</tt> up-to-date. Note also that the 1318 <b>.WAIT</b> does not create a prerequisite relationship between <tt>one</tt> and <tt>two</tt>, so <tt>make -j 10 two</tt> will not 1319 build <tt>one</tt>.</p> 1320 <pre> 1321 <tt>all: foo bar 1322 foo: one .WAIT two 1323 bar: one two 1324 foo bar one two: ; @echo $@ 1325 </tt></pre></li> 1326 </ol> 1327 </blockquote> 1328 <h4 class="mansect"><a name="tag_20_76_18" id="tag_20_76_18"></a>RATIONALE</h4> 1329 <blockquote> 1330 <p>The <i>make</i> utility described in this volume of POSIX.1-2024 is intended to provide the means for changing portable source 1331 code into executables that can be run on a POSIX.1-2024-conforming system. It reflects the most common features present in System V 1332 and BSD <i>make</i>s.</p> 1333 <p>Historically, the <i>make</i> utility has been an especially fertile ground for vendor and research organization-specific syntax 1334 modifications and extensions. Examples include:</p> 1335 <ul> 1336 <li> 1337 <p>Syntax supporting parallel execution (such as from various multi-processor vendors, GNU, and others)</p> 1338 </li> 1339 <li> 1340 <p>Additional "operators" separating targets and their prerequisites (System V, BSD, and others)</p> 1341 </li> 1342 <li> 1343 <p>Modifications of the meaning of internal macros when referencing libraries (BSD and others)</p> 1344 </li> 1345 <li> 1346 <p>Using a single instance of the shell for all of the command lines of the target (BSD and others)</p> 1347 </li> 1348 <li> 1349 <p>Allowing <space> characters as well as <tab> characters to delimit command lines (BSD)</p> 1350 </li> 1351 <li> 1352 <p>Adding C preprocessor-style "include" and "ifdef" constructs (System V, GNU, BSD, and others)</p> 1353 </li> 1354 <li> 1355 <p>Remote execution of command lines (Sprite and others)</p> 1356 </li> 1357 <li> 1358 <p>Specifying additional special targets (BSD, System V, and most others)</p> 1359 </li> 1360 <li> 1361 <p>Specifying an alternate shell to use to process commands.</p> 1362 </li> 1363 </ul> 1364 <p>Additionally, many vendors and research organizations have rethought the basic concepts of <i>make</i>, creating vastly 1365 extended, as well as completely new, syntaxes. Each of these versions of <i>make</i> fulfills the needs of a different community of 1366 users; it is unreasonable for this volume of POSIX.1-2024 to require behavior that would be incompatible (and probably inferior) to 1367 historical practice for such a community.</p> 1368 <p>In similar circumstances, when the industry has enough sufficiently incompatible formats as to make them irreconcilable, this 1369 volume of POSIX.1-2024 has followed one or both of two courses of action. Commands have been renamed (<a href= 1370 "../utilities/cksum.html"><i>cksum</i></a>, <a href="../utilities/echo.html"><i>echo</i></a>, and <a href= 1371 "../utilities/pax.html"><i>pax</i></a>) and/or command line options have been provided to select the desired behavior (<a href= 1372 "../utilities/grep.html"><i>grep</i></a>, <a href="../utilities/od.html"><i>od</i></a>, and <a href= 1373 "../utilities/pax.html"><i>pax</i></a>).</p> 1374 <p>Because the syntax specified for the <i>make</i> utility was, by and large, a subset of the syntaxes accepted by almost all 1375 versions of <i>make</i> when the original IEEE Std 1003.2-1992 shell and utilities standard was being developed, it was 1376 decided that it would be counter-productive to change the name. And since the makefile itself is a basic unit of portability, it 1377 would not be completely effective to reserve a new option letter, such as <i>make</i> <b>-P</b>, to achieve the portable behavior. 1378 Therefore, the special target <b>.POSIX</b> was added to the makefile, allowing users to specify "standard" behavior. This 1379 special target does not preclude extensions in the <i>make</i> utility, nor does it preclude such extensions being used by the 1380 makefile specifying the target; it does, however, preclude any extensions from being applied that could alter the behavior of 1381 previously valid syntax; such extensions must be controlled via command line options or new special targets. It is incumbent upon 1382 portable makefiles to specify the <b>.POSIX</b> special target in order to guarantee that they are not affected by local 1383 extensions.</p> 1384 <p>The portable version of <i>make</i> described in this reference page is not intended to be the state-of-the-art software 1385 generation tool and, as such, some newer and more leading-edge features have not been included. An attempt has been made to 1386 describe the portable makefile in a manner that does not preclude such extensions as long as they do not disturb the portable 1387 behavior described here.</p> 1388 <p>When the <b>-n</b> option is specified, it is always added to <i>MAKEFLAGS .</i> This allows a recursive <i>make</i> <b>-n</b> 1389 <i>target</i> to be used to see all of the actions that would be taken to update <i>target</i>.</p> 1390 <p>The definition of <i>MAKEFLAGS</i> allows both the System V letter string and the BSD command line formats. The two formats are 1391 sufficiently different to allow implementations to support both without ambiguity.</p> 1392 <p>Early proposals stated that an "unquoted" <number-sign> was treated as the start of a comment. The <i>make</i> utility 1393 does not pay any attention to quotes. A <number-sign> starts a comment regardless of its surroundings.</p> 1394 <p>The text about "other implementation-defined pathnames may also be tried" in addition to <b>./makefile</b> and 1395 <b>./Makefile</b> is to allow such extensions as <b>SCCS/s.Makefile</b> and other variations. It was made an implementation-defined 1396 requirement (as opposed to unspecified behavior) to highlight surprising implementations that might select something unexpected 1397 like <b>/etc/Makefile</b>. XSI-conformant systems also try <b>./s.makefile</b>, <b>SCCS/s.makefile</b>, <b>./s.Makefile</b>, and 1398 <b>SCCS/s.Makefile</b>.</p> 1399 <p>The default rules are based on System V. The default <b>CC=</b> value is <a href="../utilities/c17.html"><i>c17</i></a> instead 1400 of <i>cc</i> because this volume of POSIX.1-2024 does not standardize the utility named <i>cc</i>. Thus, every conforming 1401 application would be required to define <b>CC=</b><a href="../utilities/c17.html"><i>c17</i></a> to expect to run. There is no 1402 advantage conferred by the hope that the makefile might hit the "preferred" compiler because this cannot be guaranteed to work. 1403 Also, since the portable makescript can only use the <a href="../utilities/c17.html"><i>c17</i></a> options, no advantage is 1404 conferred in terms of what the script can do. It is a quality-of-implementation issue as to whether <a href= 1405 "../utilities/c17.html"><i>c17</i></a> is as valuable as <i>cc</i>.</p> 1406 <p>Implementations are permitted to include any macro of their choosing in the default set. However, they are encouraged to keep 1407 such additions to a minimum in order to reduce the risk of name clashes with user macros.</p> 1408 <p>Implementations are encouraged to provide, as an extension, a command-line option that causes <i>make</i> to report attempts to 1409 expand (or append to) macros that do not exist. See APPLICATION USAGE for the intended use cases of such an option.</p> 1410 <p>The <b>-d</b> option to <i>make</i> is frequently used to produce debugging information, but is too implementation-defined to 1411 add to this volume of POSIX.1-2024.</p> 1412 <p>The <b>-p</b> option is not passed in <i>MAKEFLAGS</i> on most historical implementations and to change this would cause many 1413 implementations to break without sufficiently increased portability.</p> 1414 <p>Commands that begin with a <plus-sign> (<tt>'+'</tt>) are executed even if the <b>-n</b> option is present. Based on the 1415 GNU version of <i>make</i>, the behavior of <b>-n</b> when the <plus-sign> prefix is encountered has been extended to apply 1416 to <b>-q</b> and <b>-t</b> as well. The System V convention of forcing command execution with <b>-n</b> when the command line of a 1417 target expands the <i>MAKE</i> macro was not adopted in earlier versions of this standard, but it is now required because it has 1418 become widespread existing practice.</p> 1419 <p>The double <colon> in the target rule format is supported in BSD systems to allow more than one target line containing the 1420 same target name to have commands associated with it. Since this is not functionality described in the SVID or XPG3 it has been 1421 allowed as an extension, but not mandated.</p> 1422 <p>The default rules are provided with text specifying that the built-in rules shall be the same as if the listed set were used. 1423 The intent is that implementations should be able to use the rules without change, but will be allowed to alter them in ways that 1424 do not affect the primary behavior.</p> 1425 <p>One point of discussion was whether to drop the default rules list from this volume of POSIX.1-2024. They provide convenience, 1426 but do not enhance portability of applications. The prime benefit is in portability of users who wish to type <i>make</i> 1427 <i>command</i> and have the command build from a <b>command.c</b> file.</p> 1428 <p>The historical <i>MAKESHELL</i> feature, and related features provided by other <i>make</i> implementations, were omitted. In 1429 some implementations it is used to let a user override the shell to be used to run <i>make</i> commands. This was confusing; for a 1430 portable <i>make</i>, the shell should be chosen by the makefile writer. Further, a makefile writer cannot require an alternate 1431 shell to be used and still consider the makefile portable. While it would be possible to standardize a mechanism for specifying an 1432 alternate shell, existing implementations do not agree on such a mechanism, and makefile writers can already invoke an alternate 1433 shell by specifying the shell name in the rule for a target; for example:</p> 1434 <pre> 1435 <tt>python -c "foo" 1436 </tt></pre> 1437 <p>The <i>make</i> utilities in most historical implementations process the prerequisites of a target in left-to-right order, and 1438 the makefile format requires this. It supports the standard idiom used in many makefiles that produce <a href= 1439 "../utilities/yacc.html"><i>yacc</i></a> programs; for example:</p> 1440 <pre> 1441 <tt>foo: y.tab.o lex.o main.o 1442 $(CC) $(CFLAGS) -o $</tt>@<tt> y.tab.o lex.o main.o 1443 </tt></pre> 1444 <p>In this example, if <i>make</i> chose any arbitrary order, the <b>lex.o</b> might not be made with the correct <b>y.tab.h</b>. 1445 Although there may be better ways to express this relationship, it is widely used historically. Implementations that desire to 1446 update prerequisites in parallel should require an explicit extension to <i>make</i> or the makefile format to accomplish it, as 1447 described previously.</p> 1448 <p>The algorithm for determining a new entry for target rules is partially unspecified. Some historical <i>make</i>s allow comment 1449 lines (including blank and empty lines) within the collection of commands marked by leading <tab> characters. A conforming 1450 makefile must ensure that each command starts with a <tab>, but implementations are free to ignore comments without 1451 triggering the start of a new entry.</p> 1452 <p>The ASYNCHRONOUS EVENTS section includes having SIGTERM and SIGHUP, along with the more traditional SIGINT and SIGQUIT, remove 1453 the current target unless directed not to do so. SIGTERM and SIGHUP were added to parallel other utilities that have historically 1454 cleaned up their work as a result of these signals. When <i>make</i> receives any signal other than SIGQUIT, it is required to 1455 resend itself the signal it received so that it exits with a status that reflects the signal. The results from SIGQUIT are 1456 partially unspecified because, on systems that create a file named <b>core</b> upon receipt of SIGQUIT, the <b>core</b> file from 1457 <i>make</i> would conflict with a <b>core</b> file from the command that was running when the SIGQUIT arrived. The main concern was 1458 to prevent damaged files from appearing up-to-date when <i>make</i> is rerun.</p> 1459 <p>The <b>.PRECIOUS</b> special target was extended to affect all targets globally (by specifying no prerequisites). The 1460 <b>.IGNORE</b> and <b>.SILENT</b> special targets were extended to allow prerequisites; it was judged to be more useful in some 1461 cases to be able to turn off errors or echoing for a list of targets than for the entire makefile. These extensions to <i>make</i> 1462 in System V were made to match historical practice from the BSD <i>make</i>.</p> 1463 <p>Macros are not exported to the environment of commands to be run. This was never the case in any historical <i>make</i> and 1464 would have serious consequences. The environment is the same as the environment to <i>make</i> except that <i>MAKEFLAGS</i> and 1465 macros defined on the <i>make</i> command line are added, and except that macros defined by the <i>MAKEFLAGS</i> environment 1466 variable and macros defined in the makefile(s) may update the value of an existing environment variable (other than <i>SHELL 1467 ).</i></p> 1468 <p>Some implementations do not use <a href="../functions/system.html"><i>system</i>()</a> for all command lines, as required by the 1469 portable makefile format; as a performance enhancement, they select lines without shell metacharacters for direct execution by 1470 <a href="../functions/execve.html"><i>execve</i>()</a>. There is no requirement that <a href= 1471 "../functions/system.html"><i>system</i>()</a> be used specifically, but merely that the same results be achieved. The 1472 metacharacters typically used to bypass the direct <a href="../functions/execve.html"><i>execve</i>()</a> execution have been any 1473 of:</p> 1474 <pre> 1475 <tt>= | ^ ( ) ; & < > * ? [ ] : $ ` ' " \ \n 1476 </tt></pre> 1477 <p>The default in some advanced versions of <i>make</i> is to group all the command lines for a target and execute them using a 1478 single shell invocation; the System V method is to pass each line individually to a separate shell. The single-shell method has the 1479 advantages in performance and the lack of a requirement for many continued lines. However, converting to this newer method has 1480 caused portability problems with many historical makefiles, so the behavior with the POSIX makefile is specified to be the same as 1481 that of System V. It is suggested that the special target <b>.ONESHELL</b> be used as an implementation extension to achieve the 1482 single-shell grouping for a target or group of targets.</p> 1483 <p>Novice users of <i>make</i> have had difficulty with the historical need to start commands with a <tab>. Since it is often 1484 difficult to discern differences between <tab> and <space> characters on terminals or printed listings, confusing bugs 1485 can arise. In early proposals, an attempt was made to correct this problem by allowing leading <blank> characters instead of 1486 <tab> characters. However, implementors reported many makefiles that failed in subtle ways following this change, and it is 1487 difficult to implement a <i>make</i> that unambiguously can differentiate between macro and command lines. There is extensive 1488 historical practice of allowing leading <space> characters before macro definitions. Forcing macro lines into column 1 would 1489 be a significant backwards-compatibility problem for some makefiles. Therefore, historical practice was restored.</p> 1490 <p>There is substantial variation in the handling of include lines by different implementations. However, there is enough 1491 commonality for the standard to be able to specify a minimum set of requirements that allow the feature to be used portably. Known 1492 variations have been explicitly called out as unspecified behavior in the description.</p> 1493 <p>The System V dynamic dependency feature was not included. It would support:</p> 1494 <pre> 1495 <tt>cat: $$@.c 1496 </tt></pre> 1497 <p>that would expand to;</p> 1498 <pre> 1499 <tt>cat: cat.c 1500 </tt></pre> 1501 <p>This feature exists only in the new version of System V <i>make</i> and, while useful, is not in wide usage. This means that 1502 macros are expanded twice for prerequisites: once at makefile parse time and once at target update time.</p> 1503 <p>Consideration was given to adding metarules to the POSIX <i>make</i>. This would make <b>%.o: %.c</b> the same as 1504 <b>.c.o:</b>. This is quite useful and available from some vendors, but it would cause too many changes to this <i>make</i> to 1505 support. It would have introduced rule chaining and new substitution rules. However, the rules for target names have been set to 1506 reserve the <tt>'%'</tt> and <tt>'"'</tt> characters. These are traditionally used to implement metarules and quoting of target 1507 names, respectively. Implementors are strongly encouraged to use these characters only for these purposes.</p> 1508 <p>A request was made to extend the suffix delimiter character from a <period> to any character. The metarules feature in 1509 newer <i>make</i>s solves this problem in a more general way. This volume of POSIX.1-2024 is staying with the more conservative 1510 historical definition.</p> 1511 <p>The standard output format for the <b>-p</b> option is not described because it is primarily a debugging option and because the 1512 format is not generally useful to programs. In historical implementations the output is not suitable for use in generating 1513 makefiles. The <b>-p</b> format has been variable across historical implementations. Therefore, the definition of <b>-p</b> was 1514 only to provide a consistently named option for obtaining <i>make</i> script debugging information.</p> 1515 <p>Some historical implementations have not cleared the suffix list with <b>-r</b>.</p> 1516 <p>Implementations should be aware that some historical applications have intermixed <i>target_name</i> and 1517 <i>macro</i>=<i>value</i> operands on the command line, expecting that all of the macros are processed before any of the targets 1518 are dealt with. Conforming applications do not do this, but some backwards-compatibility support may be warranted.</p> 1519 <p>Empty inference rules are specified with a <semicolon> command rather than omitting all commands, as described in an early 1520 proposal. The latter case has no traditional meaning and is reserved for implementation extensions, such as in GNU <i>make</i>.</p> 1521 <p>Earlier versions of this standard defined comment lines only as lines with <tt>'#'</tt> as the first character. Many places then 1522 talked about comments, blank lines, and empty lines; but some places inadvertently only mentioned comments when blank lines and 1523 empty lines had also been accepted in all known implementations. The standard now defines comment lines to be blank lines, empty 1524 lines, and lines starting with a <tt>'#'</tt> character and explicitly lists cases where blank lines and empty lines are not 1525 acceptable.</p> 1526 <p>On most historic systems, the <i>make</i> utility considered a target with a prerequisite that had an identical timestamp as 1527 up-to-date. One implementation of <i>make</i> treated it as out-of-date. Note that up-to-date and out-of-date are antonyms. The 1528 standard now allows either behavior, but implementations are encouraged to treat such targets as out-of-date. This is especially 1529 important on file systems where the timestamp resolution is the minimum (1 second) required by the standard. All implementations of 1530 <i>make</i> should make full use of the finest timestamp resolution available on the file systems holding targets and prerequisites 1531 to ensure that targets are up-to-date even for prerequisite files with timestamps that were updated within the same second. 1532 However, if the timestamp resolutions of the file systems containing a target and a prerequisite are different, the timestamp with 1533 the more precise resolution should be rounded down to the resolution of the less precise timestamp for the comparison.</p> 1534 <p>The traditional semantics of delayed-expansion macros have often been the source of subtle bugs for makefile writers not aware 1535 of those semantics. Furthermore, in implementations that support an extension of assigning the output of an arbitrary command to a 1536 macro definition, the use of delayed-expansion macros could result in an undesirable growth in execution time, as each use of the 1537 macro would re-run the arbitrary command. Historically, several implementations independently developed a form of immediate 1538 expansion, usually via the operator <tt>":="</tt>, so that execution of an arbitrary command happens once at the definition of the 1539 macro rather than each use of the macro; however, there are subtle differences in the expansion rules of those various 1540 implementations when the expanded value of <i>string2</i> contained a <tt>'$'</tt>. Other implementations used the operator 1541 <tt>":="</tt> for conditional expansion, altogether unrelated to immediate-expansion macro definition.</p> 1542 <p>The standard developers felt that immediate-expansion semantics were useful enough to standardize, but requiring the semantics 1543 of any one implementation of <tt>":="</tt> would cause confusion in makefiles written for other implementation semantics, 1544 necessitating a reader to determine if <tt>.POSIX:</tt> had been specified at the beginning of the file (or worse, at the beginning 1545 of some other file that then includes the fragment in question) to know which semantics would be in use. Therefore, the standard 1546 developers opted to require two new operators, <tt>"::="</tt> and <tt>":::="</tt>, with specific semantics; the <tt>"::="</tt> 1547 operator has semantics closest to the GNU <i>make</i> implementation of <tt>":="</tt>, where <tt>'$'</tt> characters occurring in 1548 the immediate expansion of <i>string2</i> are not further expanded in subsequent use of the macro, and the <tt>":::="</tt> operator 1549 has semantics closest to the BSD <i>make</i> and <i>smake</i> implementations of <tt>":="</tt>, where immediate expansion is 1550 performed when assigning to a delayed-expansion macro and <tt>"$$"</tt> is preserved. It was felt that other implementations could 1551 easily support the required semantics.</p> 1552 <p>Implementations that previously provided <tt>":="</tt> as an extension are encouraged to leave this extension intact, with no 1553 change in the implementation's particular semantics, to avoid breaking non-portable makefiles that had been targeting that 1554 particular implementation. A portable makefile, with <tt>.POSIX:</tt> specified at the beginning, should not use the <tt>":="</tt> 1555 operator.</p> 1556 <p>Traditionally, constructs such as</p> 1557 <pre> 1558 <tt>DIR: FORCE 1559 (commands) 1560 FORCE: 1561 </tt></pre> 1562 <p>were used to allow <tt>make DIR</tt> to always run <tt>(commands)</tt>; however, this depended on the user never creating a file 1563 named <b>FORCE</b>. The addition of the .B~.PHONY special target provides a more efficient manner of providing a target whose 1564 commands are always run, and where the user cannot create a file that influences the behavior in an unexpected manner.</p> 1565 <p>This standard allows two different methods of creating include files or bringing them up-to-date, reflecting established 1566 practice in SunPro <i>make</i> and GNU <i>make</i>. The former performs this action during parsing, before the include file is 1567 opened. The latter delays performing the action until after all makefiles have been read. Implementors who opt for the "delayed 1568 remaking" method should be aware of the following potential issues:</p> 1569 <ul> 1570 <li> 1571 <p>Diagnostic messages about missing include files must be deferred until the final exit status is known. Note that this is a 1572 conformance issue, not just a quality of implementation issue.</p> 1573 </li> 1574 <li> 1575 <p>If the way <i>make</i> handles using updated include file contents is to start over after include files have been made 1576 up-to-date, it is possible for a poorly written makefile to cause <i>make</i> to enter a sequence of restarts where nothing changes 1577 each time, resulting in the sequence continuing indefinitely unless the situation is detected. Implementors are encouraged to 1578 include a mechanism for detecting and reporting this, rather than allowing <i>make</i> to consume an arbitrary amount of system 1579 resource until it is forcibly terminated.</p> 1580 </li> 1581 <li> 1582 <p>If <i>make</i> uses this start-over method, makefile contents read from a pipe on standard input or from a FIFO must be copied 1583 to a temporary file, and when <i>make</i> starts over it must use this file instead.</p> 1584 </li> 1585 <li> 1586 <p>If <i>make</i> starts over by executing itself using the <i>exec</i> family of functions, the need to replace <tt>'-'</tt> or 1587 the pathnames of FIFOs with the pathnames of temporary files can lead to the <i>exec</i> call failing with an [E2BIG] error if the 1588 original execution was close to the {ARG_MAX} limit. Although this is a quality of implementation issue, not a conformance issue 1589 (since the general rules for utility errors allow utilities to fail when they encounter a variety of internal errors - see <a href= 1590 "../utilities/V3_chap01.html#tag_18_04"><i>1.4 Utility Description Defaults</i></a> ), implementors are encouraged to explore ways 1591 to prevent it, such as passing information via a temporary file instead of on the command line when an [E2BIG] error has occurred. 1592 Another solution might be to jump (e.g. using <a href="../functions/siglongjmp.html"><i>siglongjmp</i>()</a>) back to the start of 1593 <i>main</i>() as the way to start over. Making a recursive call to <i>main</i>() is not recommended, as that would run into the 1594 stack limit if sufficiently many restarts are needed.</p> 1595 </li> 1596 </ul> 1597 <p>This standard specifies that a non-existent include file is first created if possible, and only if not possible can other 1598 directories be searched. Historical versions of GNU <i>make</i> first searched the include directories, then attempted to create 1599 the include file. This behavior was not considered suitable for standardization as it means writers of portable applications have 1600 to use absolute pathnames for all include files that need to be created via a rule (because they can never be sure what relative 1601 pathnames are safe to use, since a file with the same relative pathname might happen to exist in one of the searched directories 1602 when installing the application on a new system). Note, however, that this only applies to directories searched by default. If an 1603 application uses an extension to specify that one or more directories are searched, this standard does not place any constraints on 1604 when the specified directories are searched.</p> 1605 <p>This standard specifies a way for portable applications to request parallel updating of targets with commands by using the 1606 <b>-j</b> <i>maxjobs</i> option. This feature is described in terms of a token pool initially containing up to <i>maxjobs</i> - 1 1607 tokens. Note that this is not intended to prescribe a particular implementation design; the usual "as if" rule applies.</p> 1608 <p>Implementations are permitted to silently limit the pool size for a few reasons, including:</p> 1609 <ul> 1610 <li> 1611 <p>Implementations that do not support parallelism can support the <b>-j</b> option by simply ignoring the option (other than 1612 passing it to sub-<i>make</i> invocations via the <i>MAKEFLAGS</i> environment variable). In effect, such an implementation 1613 silently restricts the size of the token pool to zero (and therefore need not create a token pool).</p> 1614 </li> 1615 <li> 1616 <p>Some historical implementations dynamically limit the token pool size based on the current system load to avoid overloading the 1617 system.</p> 1618 </li> 1619 <li> 1620 <p>Implementations may want to limit the token pool size based on the number of processors available.</p> 1621 </li> 1622 <li> 1623 <p>Implementations may want to limit the token pool size based on resource limits.</p> 1624 </li> 1625 </ul> 1626 <p>Limiting the pool size does not change the value of <i>maxjobs</i> that is passed to sub-<i>make</i> invocations via the 1627 <i>MAKEFLAGS</i> environment variable.</p> 1628 <p>When a different <i>maxjobs</i> value is passed to a sub-<i>make</i>, some historical <i>make</i> implementations created a 1629 separate pool of tokens while other historical <i>make</i> implementations continued to obtain tokens from the invoking <i>make</i> 1630 but limited the number of tokens held at a time to the new value of <i>maxjobs</i> - 1. Both behaviors are believed to have merit 1631 in different situations: the former gives a sub-<i>make</i> complete control the amount of parallelism, while the latter allows the 1632 user to control the overall system load. This standard permits either behavior.</p> 1633 <p>This standard calls for a token pool of size <i>maxjobs</i> - 1, and for removal from that pool only for the second and 1634 subsequent tasks in a set of parallel tasks. This design was chosen because this is effectively what existing implementations do, 1635 and also because the token consumed by a parallel task that invokes a sub-<i>make</i> is effectively lent to the sub-<i>make</i>. 1636 Lending the token to the sub-<i>make</i> has the following advantages:</p> 1637 <ul> 1638 <li> 1639 <p>It prevents the sub-<i>make</i> from being completely idle due to token starvation, allowing it to always make some progress 1640 regardless of how many tokens other sub-<i>make</i> invocations have consumed.</p> 1641 </li> 1642 <li> 1643 <p>It prevents token pool exhaustion caused by a long chain of sub-<i>make</i> invocations. If the token consumed by the invoking 1644 rule was not effectively lent to the sub-<i>make</i>, then the pool would be exhausted by a chain of sub-<i>make</i> invocations 1645 that is <i>maxjobs</i> long. Such a chain would never accomplish any work, and would thus never complete.</p> 1646 </li> 1647 </ul> 1648 <p>When a rule invokes multiple sub-<i>make</i> processes asynchronously (for example by using an asynchronous list in the shell), 1649 some implementations allow each sub-<i>make</i> to execute at least one rule even though this would cause the total number of 1650 parallel rule executions across all <i>make</i> instances to exceed <i>maxjobs</i> (after discounting the rules that execute 1651 sub-<i>make</i> processes). This behavior may not be ideal, but it is easier to implement and is unlikely to cause problems in 1652 practice because applications typically do not have any rules that invoke multiple sub-<i>make</i> processes asynchronously. For 1653 this reason the behavior is unspecified if a rule executes multiple sub-<i>make</i> processes asynchronously.</p> 1654 <p>When multiple sub-<i>make</i> processes are running in parallel there is no requirement placed on the ordering of output from 1655 these processes. Some implementations of <i>make</i> attempt to serialize output from each sub-<i>make</i>; others make no such 1656 attempt. If diagnostic messages from failed commands are intermixed, the usual way to deal with this is to repeat the <i>make</i> 1657 without <b>-j</b> (or with <b>-j</b> 1) so that intermixing will not occur.</p> 1658 </blockquote> 1659 <h4 class="mansect"><a name="tag_20_76_19" id="tag_20_76_19"></a>FUTURE DIRECTIONS</h4> 1660 <blockquote> 1661 <p>If this utility is directed to create a new directory entry that contains any bytes that have the encoded value of a 1662 <newline> character, implementations are encouraged to treat this as an error. A future version of this standard may require 1663 implementations to treat this as an error.</p> 1664 <p>Some implementations of <i>make</i> include an <i>export</i> directive to add specified <i>make</i> variables to the 1665 environment. This may be considered for standardization in a future version.</p> 1666 <p>A future version of this standard may add a command-line option that causes <i>make</i> to report attempts to expand (or append 1667 to) macros that do not exist.</p> 1668 <p>A future version of this standard may require that a target with a prerequisite with an identical timestamp is considered 1669 out-of-date.</p> 1670 </blockquote> 1671 <h4 class="mansect"><a name="tag_20_76_20" id="tag_20_76_20"></a>SEE ALSO</h4> 1672 <blockquote> 1673 <p><a href="../utilities/V3_chap02.html#tag_19"><i>2. Shell Command Language</i></a> , <a href= 1674 "../utilities/ar.html#"><i>ar</i></a> , <a href="../utilities/c17.html#"><i>c17</i></a> , <a href= 1675 "../utilities/get.html#"><i>get</i></a> , <a href="../utilities/lex.html#"><i>lex</i></a> , <a href= 1676 "../utilities/sccs.html#"><i>sccs</i></a> , <a href="../utilities/sh.html#"><i>sh</i></a> , <a href= 1677 "../utilities/yacc.html#"><i>yacc</i></a></p> 1678 <p>XBD <a href="../basedefs/V1_chap06.html#tag_06_01"><i>6.1 Portable Character Set</i></a> , <a href= 1679 "../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 1680 Utility Syntax Guidelines</i></a></p> 1681 <p>XSH <a href="../functions/exec.html#tag_17_129"><i>exec</i></a> , <a href="../functions/system.html#"><i>system</i></a></p> 1682 </blockquote> 1683 <h4 class="mansect"><a name="tag_20_76_21" id="tag_20_76_21"></a>CHANGE HISTORY</h4> 1684 <blockquote> 1685 <p>First released in Issue 2.</p> 1686 </blockquote> 1687 <h4 class="mansect"><a name="tag_20_76_22" id="tag_20_76_22"></a>Issue 5</h4> 1688 <blockquote> 1689 <p>The FUTURE DIRECTIONS section is added.</p> 1690 </blockquote> 1691 <h4 class="mansect"><a name="tag_20_76_23" id="tag_20_76_23"></a>Issue 6</h4> 1692 <blockquote> 1693 <p>This utility is marked as part of the Software Development Utilities option.</p> 1694 <p>The Open Group Corrigendum U029/1 is applied, correcting a typographical error in the SPECIAL TARGETS section.</p> 1695 <p>In the ENVIRONMENT VARIABLES section, the <i>PROJECTDIR</i> description is updated from "otherwise, the home directory of a 1696 user of that name is examined" to "otherwise, the value of <i>PROJECTDIR</i> is treated as a user name and that user's initial 1697 working directory is examined".</p> 1698 <p>It is specified whether the command line is related to the makefile or to the <i>make</i> command, and the macro processing 1699 rules are updated to align with the IEEE P1003.2b draft standard.</p> 1700 <p>The normative text is reworded to avoid use of the term "must" for application requirements.</p> 1701 <p>PASC Interpretation 1003.2 #193 is applied.</p> 1702 </blockquote> 1703 <h4 class="mansect"><a name="tag_20_76_24" id="tag_20_76_24"></a>Issue 7</h4> 1704 <blockquote> 1705 <p>SD5-XCU-ERN-6 is applied, clarifying that Guideline 9 of the Utility Syntax Guidelines does not apply.</p> 1706 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p> 1707 <p>Include lines in makefiles are introduced.</p> 1708 <p>Austin Group Interpretation 1003.1-2001 #131 is applied, changing the <b>Makefile Execution</b> section.</p> 1709 <p>POSIX.1-2008, Technical Corrigendum 1, XCU/TC1-2008/0121 [257] is applied.</p> 1710 <p>POSIX.1-2008, Technical Corrigendum 2, XCU/TC2-2008/0122 [509], XCU/TC2-2008/0123 [584], XCU/TC2-2008/0124 [857], 1711 XCU/TC2-2008/0125 [505], XCU/TC2-2008/0126 [584], XCU/TC2-2008/0127 [505], XCU/TC2-2008/0128 [865], XCU/TC2-2008/0129 [693], 1712 XCU/TC2-2008/0130 [602], XCU/TC2-2008/0131 [848], XCU/TC2-2008/0132 [763], XCU/TC2-2008/0133 [857], XCU/TC2-2008/0134 [866], 1713 XCU/TC2-2008/0135 [525], XCU/TC2-2008/0136 [848], XCU/TC2-2008/0137 [769], XCU/TC2-2008/0138 [525], XCU/TC2-2008/0139 [769], 1714 XCU/TC2-2008/0140 [505], XCU/TC2-2008/0141 [693], XCU/TC2-2008/0142 [505], XCU/TC2-2008/0143 [857], and XCU/TC2-2008/0144 [693,865] 1715 are applied.</p> 1716 </blockquote> 1717 <h4 class="mansect"><a name="tag_20_76_25" id="tag_20_76_25"></a>Issue 8</h4> 1718 <blockquote> 1719 <p>Austin Group Defect 251 is applied, encouraging implementations to disallow the creation of filenames containing any bytes that 1720 have the encoded value of a <newline> character.</p> 1721 <p>Austin Group Defects 330, 1417, 1422, 1709, and 1710 are applied, adding new forms of macro assignment using the <tt>"::="</tt>, 1722 <tt>"?="</tt>, and <tt>"+="</tt> operators.</p> 1723 <p>Austin Group Defect 333 is applied, adding support for "silent includes" using <b>-include</b>.</p> 1724 <p>Austin Group Defects 336 and 1711 are applied, specifying the behavior when <i>string1</i> in a macro expansion contains a macro 1725 expansion.</p> 1726 <p>Austin Group Defect 337 is applied, adding a new form of macro assignment using the <tt>"!="</tt> operator.</p> 1727 <p>Austin Group Defects 373 and 1417 are applied, changing the set of characters that portable applications can use in macro names 1728 to the entire portable filename character set (thus adding <hyphen-minus> to the set that could previously be used).</p> 1729 <p>Austin Group Defects 514 and 1520 are applied, adding the $+ and $^ internal macros.</p> 1730 <p>Austin Group Defect 518 is applied, allowing multiple files to be specified on an <b>include</b> line.</p> 1731 <p>Austin Group Defects 519, 1712, and 1715 are applied, adding support for pattern macro expansions.</p> 1732 <p>Austin Group Defects 523, 1708, and 1749 are applied, adding the .B~.PHONY special target.</p> 1733 <p>Austin Group Defect 875 is applied, clarifying the requirements for inference rules.</p> 1734 <p>Austin Group Defect 1104 is applied, changing "<b>s2.a</b>" to "<b>.s2.a</b>".</p> 1735 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p> 1736 <p>Austin Group Defect 1141 is applied, changing "core files" to "a file named core".</p> 1737 <p>Austin Group Defect 1155 is applied, clarifying the handling of the <i>MAKE</i> macro.</p> 1738 <p>Austin Group Defect 1325 is applied, adding requirements relating to the creation of include files.</p> 1739 <p>Austin Group Defect 1330 is applied, removing obsolescent interfaces.</p> 1740 <p>Austin Group Defect 1419 is applied, updating the <b>.SCCS_GET</b> default rule.</p> 1741 <p>Austin Group Defect 1420 is applied, clarifying where internal macros can be used.</p> 1742 <p>Austin Group Defect 1421 is applied, changing the APPLICATION USAGE section.</p> 1743 <p>Austin Group Defects 1424, 1658, 1690, 1701, 1702, 1703, 1704, 1707, 1719, 1720, 1721, 1722, and 1750 are applied, making 1744 various minor editorial wording changes.</p> 1745 <p>Austin Group Defects 1436, 1437, 1652, 1660, 1661, and 1733 are applied, adding the <b>-j</b> <i>maxjobs</i> option and the 1746 <b>.NOTPARALLEL</b> and <b>.WAIT</b> special targets, and changing the <b>-n</b> option.</p> 1747 <p>Austin Group Defects 1471 and 1513 are applied, adding a new form of macro assignment using the <tt>":::="</tt> operator.</p> 1748 <p>Austin Group Defect 1479 is applied, clarifying the requirements for default rules and macro values.</p> 1749 <p>Austin Group Defect 1492 is applied, changing the EXIT STATUS section.</p> 1750 <p>Austin Group Defect 1505 is applied, clarifying the requirements for expansion of macros that do not exist.</p> 1751 <p>Austin Group Defect 1510 is applied, correcting a typographic error in the RATIONALE section.</p> 1752 <p>Austin Group Defect 1549 is applied, clarifying the requirements for an escaped <newline> in a command line.</p> 1753 <p>Austin Group Defect 1615 is applied, allowing target names to contain slashes and hyphens.</p> 1754 <p>Austin Group Defect 1626 is applied, adding the <i>CURDIR</i> macro.</p> 1755 <p>Austin Group Defect 1631 is applied, adding information about use of the <b>-j</b> option with the <b>.c.a</b> default rule to 1756 the APPLICATION USAGE and EXAMPLES sections.</p> 1757 <p>Austin Group Defect 1650 is applied, changing the few occurrences of "dependencies" to use the more common 1758 "prerequisites".</p> 1759 <p>Austin Group Defect 1653 is applied, clarifying the difference between how <i>MAKEFLAGS</i> is parsed compared to shell commands 1760 that use the <i>make</i> utility.</p> 1761 <p>Austin Group Defects 1654 and 1655 are applied, changing the APPLICATION USAGE section.</p> 1762 <p>Austin Group Defect 1656 is applied, changing the NAME section.</p> 1763 <p>Austin Group Defect 1657 is applied, moving some requirements unrelated to makefile syntax from the Makefile Syntax subsection 1764 to the beginning of the EXTENDED DESCRIPTION section.</p> 1765 <p>Austin Group Defect 1689 is applied, removing some redundant wording from the DESCRIPTION section.</p> 1766 <p>Austin Group Defect 1692 is applied, allowing <i>make</i>, when invoked with the <b>-q</b> or <b>-t</b> option, to execute 1767 command lines (without a <plus-sign> prefix) that expand the <i>MAKE</i> macro.</p> 1768 <p>Austin Group Defect 1693 is applied, changing "command lines" to "execution lines" in the description of the <b>-s</b> 1769 option.</p> 1770 <p>Austin Group Defect 1694 is applied, changing "in the order they appear" to "in the order specified" in the OPERANDS 1771 section.</p> 1772 <p>Austin Group Defect 1696 is applied, changing the STDOUT section.</p> 1773 <p>Austin Group Defect 1697 is applied, changing the RATIONALE and FUTURE DIRECTIONS sections.</p> 1774 <p>Austin Group Defect 1698 is applied, changing "of a target" to "of the target" in the EXTENDED DESCRIPTION section.</p> 1775 <p>Austin Group Defect 1699 is applied, addressing some inconsistencies in the use of the term "rules".</p> 1776 <p>Austin Group Defect 1706 is applied, removing a line from the format specified for target rules.</p> 1777 <p>Austin Group Defect 1714 is applied, changing "beginning of the line" to "beginning of the value".</p> 1778 <p>Austin Group Defect 1716 is applied, changing the typographic convention used for variable elements within target names, in 1779 particular the inference rule suffixes s1 and s2.</p> 1780 <p>Austin Group Defect 1723 is applied, adding historical context to a paragraph in the RATIONALE section.</p> 1781 <p>Austin Group Defect 1772 is applied, clarifying the ASYNCHRONOUS EVENTS section.</p> 1782 </blockquote> 1783 <div class="box"><em>End of informative text.</em></div> 1784 <hr> 1785 <p> </p> 1786 <a href="#top"><span class="topOfPage">return to top of page</span></a><br> 1787 <hr size="2" noshade> 1788 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br> 1789 POSIX™ is a Trademark of The IEEE.<br> 1790 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br> 1791 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href= 1792 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a> 1793 ]</font></center> 1794 <hr size="2" noshade> 1795 <div class="NAVHEADER"> 1796 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 1797 <tr class="nav"> 1798 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/mailx.html" accesskey="P"><<< 1799 Previous</a></td> 1800 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 1801 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/man.html" accesskey="N">Next >>></a></td> 1802 </tr> 1803 </table> 1804 <hr align="left" width="100%"></div> 1805 </body> 1806 </html>