1BMAKE(1) FreeBSD General Commands Manual BMAKE(1) 2 3NNAAMMEE 4 bbmmaakkee - maintain program dependencies 5 6SSYYNNOOPPSSIISS 7 bbmmaakkee [--BBeeiikkNNnnqqrrSSssttWWwwXX] [--CC _d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd _f_l_a_g_s] 8 [--ff _m_a_k_e_f_i_l_e] [--II _d_i_r_e_c_t_o_r_y] [--JJ _p_r_i_v_a_t_e] [--jj _m_a_x___j_o_b_s] 9 [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [--vv _v_a_r_i_a_b_l_e] 10 [_v_a_r_i_a_b_l_e==_v_a_l_u_e] [_t_a_r_g_e_t ...] 11 12DDEESSCCRRIIPPTTIIOONN 13 bbmmaakkee is a program designed to simplify the maintenance of other 14 programs. Its input is a list of specifications as to the files upon 15 which programs and other files depend. If no --ff _m_a_k_e_f_i_l_e option is 16 given, bbmmaakkee looks for the makefiles listed in _._M_A_K_E_._M_A_K_E_F_I_L_E___P_R_E_F_E_R_E_N_C_E 17 (default `_m_a_k_e_f_i_l_e', `_M_a_k_e_f_i_l_e') in order to find the specifications. If 18 the file `_._d_e_p_e_n_d' exists, it is read, see mkdep(1). 19 20 This manual page is intended as a reference document only. For a more 21 thorough description of bbmmaakkee and makefiles, please refer to _P_M_a_k_e _- _A 22 _T_u_t_o_r_i_a_l (from 1993). 23 24 bbmmaakkee prepends the contents of the MAKEFLAGS environment variable to the 25 command line arguments before parsing them. 26 27 The options are as follows: 28 29 --BB Try to be backwards compatible by executing a single shell per 30 command and by making the sources of a dependency line in 31 sequence. 32 33 --CC _d_i_r_e_c_t_o_r_y 34 Change to _d_i_r_e_c_t_o_r_y before reading the makefiles or doing 35 anything else. If multiple --CC options are specified, each is 36 interpreted relative to the previous one: --CC _/ --CC _e_t_c is 37 equivalent to --CC _/_e_t_c. 38 39 --DD _v_a_r_i_a_b_l_e 40 Define _v_a_r_i_a_b_l_e to be 1, in the global scope. 41 42 --dd [--]_f_l_a_g_s 43 Turn on debugging, and specify which portions of bbmmaakkee are to 44 print debugging information. Unless the flags are preceded by 45 `-', they are added to the MAKEFLAGS environment variable and are 46 passed on to any child make processes. By default, debugging 47 information is printed to standard error, but this can be changed 48 using the FF debugging flag. The debugging output is always 49 unbuffered; in addition, if debugging is enabled but debugging 50 output is not directed to standard output, the standard output is 51 line buffered. The available _f_l_a_g_s are: 52 53 AA Print all possible debugging information; equivalent to 54 specifying all of the debugging flags. 55 56 aa Print debugging information about archive searching and 57 caching. 58 59 CC Print debugging information about the current working 60 directory. 61 62 cc Print debugging information about conditional evaluation. 63 64 dd Print debugging information about directory searching and 65 caching. 66 67 ee Print debugging information about failed commands and 68 targets. 69 70 FF[++]_f_i_l_e_n_a_m_e 71 Specify where debugging output is written. This must be 72 the last flag, because it consumes the remainder of the 73 argument. If the character immediately after the FF flag 74 is `+', the file is opened in append mode; otherwise the 75 file is overwritten. If the file name is `stdout' or 76 `stderr', debugging output is written to the standard 77 output or standard error output respectively (and the `+' 78 option has no effect). Otherwise, the output is written 79 to the named file. If the file name ends with `.%d', the 80 `%d' is replaced by the pid. 81 82 ff Print debugging information about loop evaluation. 83 84 gg11 Print the input graph before making anything. 85 86 gg22 Print the input graph after making everything, or before 87 exiting on error. 88 89 gg33 Print the input graph before exiting on error. 90 91 hh Print debugging information about hash table operations. 92 93 jj Print debugging information about running multiple 94 shells. 95 96 LL Turn on lint checks. This throws errors for variable 97 assignments that do not parse correctly, at the time of 98 assignment, so the file and line number are available. 99 100 ll Print commands in Makefiles regardless of whether or not 101 they are prefixed by `@' or other "quiet" flags. Also 102 known as "loud" behavior. 103 104 MM Print debugging information about "meta" mode decisions 105 about targets. 106 107 mm Print debugging information about making targets, 108 including modification dates. 109 110 nn Don't delete the temporary command scripts created when 111 running commands. These temporary scripts are created in 112 the directory referred to by the TMPDIR environment 113 variable, or in _/_t_m_p if TMPDIR is unset or set to the 114 empty string. The temporary scripts are created by 115 mkstemp(3), and have names of the form _m_a_k_e_X_X_X_X_X_X. _N_O_T_E: 116 This can create many files in TMPDIR or _/_t_m_p, so use with 117 care. 118 119 pp Print debugging information about makefile parsing. 120 121 ss Print debugging information about suffix-transformation 122 rules. 123 124 tt Print debugging information about target list 125 maintenance. 126 127 VV Force the --VV option to print raw values of variables, 128 overriding the default behavior set via 129 _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S. 130 131 vv Print debugging information about variable assignment and 132 expansion. 133 134 xx Run shell commands with --xx so the actual commands are 135 printed as they are executed. 136 137 --ee Let environment variables override global variables within 138 makefiles. 139 140 --ff _m_a_k_e_f_i_l_e 141 Specify a makefile to read instead of one of the defaults listed 142 in _._M_A_K_E_._M_A_K_E_F_I_L_E___P_R_E_F_E_R_E_N_C_E. If _m_a_k_e_f_i_l_e is `-', standard input 143 is read. If _m_a_k_e_f_i_l_e starts with the string `.../', bbmmaakkee 144 searches for the specified path in the rest of the argument in 145 the current directory and its parents. Multiple makefiles may be 146 specified, and are read in the order specified. 147 148 --II _d_i_r_e_c_t_o_r_y 149 Specify a directory in which to search for makefiles and included 150 makefiles. The system makefile directory (or directories, see 151 the --mm option) is automatically included as part of this list. 152 153 --ii Ignore non-zero exit of shell commands in the makefile. 154 Equivalent to specifying `-' before each command line in the 155 makefile. 156 157 --JJ _p_r_i_v_a_t_e 158 This option should _n_o_t be specified by the user. 159 160 When the --jj option is in use in a recursive build, this option is 161 passed by a make to child makes to allow all the make processes 162 in the build to cooperate to avoid overloading the system. 163 164 --jj _m_a_x___j_o_b_s 165 Specify the maximum number of jobs that bbmmaakkee may have running at 166 any one time. If _m_a_x___j_o_b_s is a floating point number, or ends 167 with `C', then the value is multiplied by the number of CPUs 168 reported online by sysconf(3). The value of _m_a_x___j_o_b_s is saved in 169 _._M_A_K_E_._J_O_B_S. Turns compatibility mode off, unless the --BB option 170 is also specified. When compatibility mode is off, all commands 171 associated with a target are executed in a single shell 172 invocation as opposed to the traditional one shell invocation per 173 line. This can break traditional scripts which change 174 directories on each command invocation and then expect to start 175 with a fresh environment on the next line. It is more efficient 176 to correct the scripts rather than turn backwards compatibility 177 on. 178 179 A job token pool with _m_a_x___j_o_b_s tokens is used to control the 180 total number of jobs running. Each instance of bbmmaakkee will wait 181 for a token from the pool before running a new job. 182 183 --kk Continue processing after errors are encountered, but only on 184 those targets that do not depend on the target whose creation 185 caused the error. 186 187 --mm _d_i_r_e_c_t_o_r_y 188 Specify a directory in which to search for _s_y_s_._m_k and makefiles 189 included via the <_f_i_l_e>-style include statement. The --mm option 190 can be used multiple times to form a search path. This path 191 overrides the default system include path _/_u_s_r_/_s_h_a_r_e_/_m_k. 192 Furthermore, the system include path is appended to the search 193 path used for "_f_i_l_e"-style include statements (see the --II 194 option). The system include path can be referenced via the read- 195 only variable _._S_Y_S_P_A_T_H. 196 197 If a directory name in the --mm argument (or the MAKESYSPATH 198 environment variable) starts with the string `.../', bbmmaakkee 199 searches for the specified file or directory named in the 200 remaining part of the argument string. The search starts with 201 the current directory and then works upward towards the root of 202 the file system. If the search is successful, the resulting 203 directory replaces the `.../' specification in the --mm argument. 204 This feature allows bbmmaakkee to easily search in the current source 205 tree for customized _s_y_s_._m_k files (e.g., by using `.../mk/sys.mk' 206 as an argument). 207 208 --nn Display the commands that would have been executed, but do not 209 actually execute them unless the target depends on the _._M_A_K_E 210 special source (see below) or the command is prefixed with `++'. 211 212 --NN Display the commands that would have been executed, but do not 213 actually execute any of them; useful for debugging top-level 214 makefiles without descending into subdirectories. 215 216 --qq Do not execute any commands, instead exit 0 if the specified 217 targets are up to date, and 1 otherwise. 218 219 --rr Do not use the built-in rules specified in the system makefile. 220 221 --SS Stop processing if an error is encountered. This is the default 222 behavior and the opposite of --kk. 223 224 --ss Do not echo any commands as they are executed. Equivalent to 225 specifying `@@' before each command line in the makefile. 226 227 --TT _t_r_a_c_e_f_i_l_e 228 When used with the --jj flag, append a trace record to _t_r_a_c_e_f_i_l_e 229 for each job started and completed. 230 231 --tt Rather than re-building a target as specified in the makefile, 232 create it or update its modification time to make it appear up- 233 to-date. 234 235 --VV _v_a_r_i_a_b_l_e 236 Print the value of _v_a_r_i_a_b_l_e. Do not build any targets. Multiple 237 instances of this option may be specified; the variables are 238 printed one per line, with a blank line for each null or 239 undefined variable. The value printed is extracted from the 240 global scope after all makefiles have been read. 241 242 By default, the raw variable contents (which may include 243 additional unexpanded variable references) are shown. If 244 _v_a_r_i_a_b_l_e contains a `$', it is not interpreted as a variable name 245 but rather as an expression. Its value is expanded before 246 printing. The value is also expanded before printing if 247 _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S is set to true and the --ddVV option has not 248 been used to override it. 249 250 Note that loop-local and target-local variables, as well as 251 values taken temporarily by global variables during makefile 252 processing, are not accessible via this option. The --ddvv debug 253 mode can be used to see these at the cost of generating 254 substantial extraneous output. 255 256 --vv _v_a_r_i_a_b_l_e 257 Like --VV, but all printed variables are always expanded to their 258 complete value. The last occurrence of --VV or --vv decides whether 259 all variables are expanded or not. 260 261 --WW Treat any warnings during makefile parsing as errors. 262 263 --ww Print entering and leaving directory messages, pre and post 264 processing. 265 266 --XX Don't export variables passed on the command line to the 267 environment individually. Variables passed on the command line 268 are still exported via the MAKEFLAGS environment variable. This 269 option may be useful on systems which have a small limit on the 270 size of command arguments. 271 272 _v_a_r_i_a_b_l_e==_v_a_l_u_e 273 Set the value of the variable _v_a_r_i_a_b_l_e to _v_a_l_u_e. Normally, all 274 values passed on the command line are also exported to sub-makes 275 in the environment. The --XX flag disables this behavior. 276 Variable assignments should follow options for POSIX 277 compatibility but no ordering is enforced. 278 279 There are several different types of lines in a makefile: dependency 280 specifications, shell commands, variable assignments, include statements, 281 conditional directives, for loops, other directives, and comments. 282 283 Lines may be continued from one line to the next by ending them with a 284 backslash (`\'). The trailing newline character and initial whitespace 285 on the following line are compressed into a single space. 286 287FFIILLEE DDEEPPEENNDDEENNCCYY SSPPEECCIIFFIICCAATTIIOONNSS 288 Dependency lines consist of one or more targets, an operator, and zero or 289 more sources. This creates a relationship where the targets "depend" on 290 the sources and are customarily created from them. A target is 291 considered out of date if it does not exist, or if its modification time 292 is less than that of any of its sources. An out-of-date target is re- 293 created, but not until all sources have been examined and themselves re- 294 created as needed. Three operators may be used: 295 296 :: Many dependency lines may name this target but only one may have 297 attached shell commands. All sources named in all dependency lines 298 are considered together, and if needed the attached shell commands 299 are run to create or re-create the target. If bbmmaakkee is 300 interrupted, the target is removed. 301 302 !! The same, but the target is always re-created whether or not it is 303 out of date. 304 305 :::: Any dependency line may have attached shell commands, but each one 306 is handled independently: its sources are considered and the 307 attached shell commands are run if the target is out of date with 308 respect to (only) those sources. Thus, different groups of the 309 attached shell commands may be run depending on the circumstances. 310 Furthermore, unlike ::, for dependency lines with no sources, the 311 attached shell commands are always run. Also unlike ::, the target 312 is not removed if bbmmaakkee is interrupted. 313 314 All dependency lines mentioning a particular target must use the same 315 operator. 316 317 Targets and sources may contain the shell wildcard values `?', `*', `[]', 318 and `{}'. The values `?', `*', and `[]' may only be used as part of the 319 final component of the target or source, and only match existing files. 320 The value `{}' need not necessarily be used to describe existing files. 321 Expansion is in directory order, not alphabetically as done in the shell. 322 323SSHHEELLLL CCOOMMMMAANNDDSS 324 Each target may have associated with it one or more lines of shell 325 commands, normally used to create the target. Each of the lines in this 326 script _m_u_s_t be preceded by a tab. (For historical reasons, spaces are 327 not accepted.) While targets can occur in many dependency lines if 328 desired, by default only one of these rules may be followed by a creation 329 script. If the `::::' operator is used, however, all rules may include 330 scripts, and the respective scripts are executed in the order found. 331 332 Each line is treated as a separate shell command, unless the end of line 333 is escaped with a backslash `\', in which case that line and the next are 334 combined. If the first characters of the command are any combination of 335 `@@', `++', or `--', the command is treated specially. 336 337 @@ causes the command not to be echoed before it is executed. 338 339 ++ causes the command to be executed even when --nn is given. 340 This is similar to the effect of the _._M_A_K_E special source, 341 except that the effect can be limited to a single line of a 342 script. 343 344 -- in compatibility mode causes any non-zero exit status of 345 the command line to be ignored. 346 347 When bbmmaakkee is run in jobs mode with --jj _m_a_x___j_o_b_s, the entire script for 348 the target is fed to a single instance of the shell. In compatibility 349 (non-jobs) mode, each command is run in a separate process. If the 350 command contains any shell meta characters (`#=|^(){};&<>*?[]:$`\\n'), it 351 is passed to the shell; otherwise bbmmaakkee attempts direct execution. If a 352 line starts with `--' and the shell has ErrCtl enabled, failure of the 353 command line is ignored as in compatibility mode. Otherwise `--' affects 354 the entire job; the script stops at the first command line that fails, 355 but the target is not deemed to have failed. 356 357 Makefiles should be written so that the mode of bbmmaakkee operation does not 358 change their behavior. For example, any command which uses "cd" or 359 "chdir" without the intention of changing the directory for subsequent 360 commands should be put in parentheses so it executes in a subshell. To 361 force the use of a single shell, escape the line breaks so as to make the 362 whole script one command. For example: 363 364 avoid-chdir-side-effects: 365 @echo "Building $@ in $$(pwd)" 366 @(cd ${.CURDIR} && ${MAKE} $@) 367 @echo "Back in $$(pwd)" 368 369 ensure-one-shell-regardless-of-mode: 370 @echo "Building $@ in $$(pwd)"; \ 371 (cd ${.CURDIR} && ${MAKE} $@); \ 372 echo "Back in $$(pwd)" 373 374 Since bbmmaakkee changes the current working directory to `_._O_B_J_D_I_R' before 375 executing any targets, each child process starts with that as its current 376 working directory. 377 378VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS 379 Variables in make behave much like macros in the C preprocessor. 380 381 Variable assignments have the form `_N_A_M_E _o_p _v_a_l_u_e', where: 382 383 _N_A_M_E is a single-word variable name, consisting, by tradition, 384 of all upper-case letters, 385 386 _o_p is one of the variable assignment operators described 387 below, and 388 389 _v_a_l_u_e is interpreted according to the variable assignment 390 operator. 391 392 Whitespace around _N_A_M_E, _o_p and _v_a_l_u_e is discarded. 393 394 VVaarriiaabbllee aassssiiggnnmmeenntt ooppeerraattoorrss 395 The five operators that assign values to variables are: 396 397 == Assign the value to the variable. Any previous value is 398 overwritten. 399 400 ++== Append the value to the current value of the variable, separating 401 them by a single space. 402 403 ??== Assign the value to the variable if it is not already defined. 404 405 ::== Expand the value, then assign it to the variable. 406 407 _N_O_T_E: References to undefined variables are _n_o_t expanded. This 408 can cause problems when variable modifiers are used. 409 410 !!== Expand the value and pass it to the shell for execution, then 411 assign the output from the child's standard output to the 412 variable. Any newlines in the result are replaced with spaces. 413 414 EExxppaannssiioonn ooff vvaarriiaabblleess 415 In most contexts where variables are expanded, `$$' expands to a single 416 dollar sign. In other contexts (most variable modifiers, string literals 417 in conditions), `\$' expands to a single dollar sign. 418 419 References to variables have the form $${{_n_a_m_e[::_m_o_d_i_f_i_e_r_s]}} or 420 $$((_n_a_m_e[::_m_o_d_i_f_i_e_r_s])). If the variable name consists of only a single 421 character and the expression contains no modifiers, the surrounding curly 422 braces or parentheses are not required. This shorter form is not 423 recommended. 424 425 If the variable name contains a dollar, the name itself is expanded 426 first. This allows almost arbitrary variable names, however names 427 containing dollar, braces, parentheses or whitespace are really best 428 avoided. 429 430 If the result of expanding a nested variable expression contains a dollar 431 sign (`$'), the result is subject to further expansion. 432 433 Variable substitution occurs at four distinct times, depending on where 434 the variable is being used. 435 436 1. Variables in dependency lines are expanded as the line is read. 437 438 2. Variables in conditionals are expanded individually, but only as far 439 as necessary to determine the result of the conditional. 440 441 3. Variables in shell commands are expanded when the shell command is 442 executed. 443 444 4. ..ffoorr loop index variables are expanded on each loop iteration. Note 445 that other variables are not expanded when composing the body of a 446 loop, so the following example code: 447 448 .for i in 1 2 3 449 a+= ${i} 450 j= ${i} 451 b+= ${j} 452 .endfor 453 454 all: 455 @echo ${a} 456 @echo ${b} 457 458 prints: 459 460 1 2 3 461 3 3 3 462 463 After the loop is executed: 464 465 _a contains `${:U1} ${:U2} ${:U3}', which expands to `1 2 466 3'. 467 468 _j contains `${:U3}', which expands to `3'. 469 470 _b contains `${j} ${j} ${j}', which expands to `${:U3} 471 ${:U3} ${:U3}' and further to `3 3 3'. 472 473 VVaarriiaabbllee ccllaasssseess 474 The four different classes of variables (in order of increasing 475 precedence) are: 476 477 Environment variables 478 Variables defined as part of bbmmaakkee's environment. 479 480 Global variables 481 Variables defined in the makefile or in included makefiles. 482 483 Command line variables 484 Variables defined as part of the command line. 485 486 Local variables 487 Variables that are defined specific to a certain target. 488 489 Local variables can be set on a dependency line, unless 490 _._M_A_K_E_._T_A_R_G_E_T___L_O_C_A_L___V_A_R_I_A_B_L_E_S is set to `false'. The rest of the line 491 (which already has had global variables expanded) is the variable value. 492 For example: 493 494 COMPILER_WRAPPERS= ccache distcc icecc 495 496 ${OBJS}: .MAKE.META.CMP_FILTER=${COMPILER_WRAPPERS:S,^,N,} 497 498 Only the targets `${OBJS}' are impacted by that filter (in "meta" mode) 499 and simply enabling/disabling any of the compiler wrappers does not 500 render all of those targets out-of-date. 501 502 _N_O_T_E: target-local variable assignments behave differently in that; 503 504 ++== Only appends to a previous local assignment for the same 505 target and variable. 506 507 ::== Is redundant with respect to global variables, which have 508 already been expanded. 509 510 The seven built-in local variables are: 511 512 _._A_L_L_S_R_C The list of all sources for this target; also known as 513 `_>'. 514 515 _._A_R_C_H_I_V_E The name of the archive file; also known as `_!'. 516 517 _._I_M_P_S_R_C In suffix-transformation rules, the name/path of the 518 source from which the target is to be transformed (the 519 "implied" source); also known as `_<'. It is not defined 520 in explicit rules. 521 522 _._M_E_M_B_E_R The name of the archive member; also known as `_%'. 523 524 _._O_O_D_A_T_E The list of sources for this target that were deemed out- 525 of-date; also known as `_?'. 526 527 _._P_R_E_F_I_X The name of the target with suffix (if declared in 528 ..SSUUFFFFIIXXEESS) removed; also known as `_*'. 529 530 _._T_A_R_G_E_T The name of the target; also known as `_@'. For 531 compatibility with other makes this is an alias for 532 _._A_R_C_H_I_V_E in archive member rules. 533 534 The shorter forms (`_>', `_!', `_<', `_%', `_?', `_*', and `_@') are permitted 535 for backward compatibility with historical makefiles and legacy POSIX 536 make and are not recommended. 537 538 Variants of these variables with the punctuation followed immediately by 539 `D' or `F', e.g. `$(@D)', are legacy forms equivalent to using the `:H' 540 and `:T' modifiers. These forms are accepted for compatibility with AT&T 541 System V UNIX makefiles and POSIX but are not recommended. 542 543 Four of the local variables may be used in sources on dependency lines 544 because they expand to the proper value for each target on the line. 545 These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E', and `_._M_E_M_B_E_R'. 546 547 AAddddiittiioonnaall bbuuiilltt--iinn vvaarriiaabblleess 548 In addition, bbmmaakkee sets or knows about the following variables: 549 550 _._A_L_L_T_A_R_G_E_T_S 551 The list of all targets encountered in the makefiles. If 552 evaluated during makefile parsing, lists only those targets 553 encountered thus far. 554 555 _._C_U_R_D_I_R 556 A path to the directory where bbmmaakkee was executed. Refer to the 557 description of `_P_W_D' for more details. 558 559 _._E_R_R_O_R___C_M_D 560 Is used in error handling, see _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R. 561 562 _._E_R_R_O_R___C_W_D 563 Is used in error handling, see _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R. 564 565 _._E_R_R_O_R___E_X_I_T 566 Is used in error handling, see _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R. 567 568 _._E_R_R_O_R___M_E_T_A___F_I_L_E 569 Is used in error handling in "meta" mode, see 570 _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R. 571 572 _._E_R_R_O_R___T_A_R_G_E_T 573 Is used in error handling, see _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R. 574 575 _._I_N_C_L_U_D_E_D_F_R_O_M_D_I_R 576 The directory of the file this makefile was included from. 577 578 _._I_N_C_L_U_D_E_D_F_R_O_M_F_I_L_E 579 The filename of the file this makefile was included from. 580 581 _M_A_C_H_I_N_E 582 The machine hardware name, see uname(1). 583 584 _M_A_C_H_I_N_E___A_R_C_H 585 The machine processor architecture name, see uname(1). 586 587 _M_A_K_E The name that bbmmaakkee was executed with (_a_r_g_v_[_0_]). 588 589 _._M_A_K_E The same as _M_A_K_E, for compatibility. The preferred variable to 590 use is the environment variable MAKE because it is more 591 compatible with other make variants and cannot be confused with 592 the special target with the same name. 593 594 _._M_A_K_E_._D_E_P_E_N_D_F_I_L_E 595 Names the makefile (default `_._d_e_p_e_n_d') from which generated 596 dependencies are read. 597 598 _._M_A_K_E_._D_I_E___Q_U_I_E_T_L_Y 599 If set to `true', do not print error information at the end. 600 601 _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S 602 A boolean that controls the default behavior of the --VV option. 603 If true, variable values printed with --VV are fully expanded; if 604 false, the raw variable contents (which may include additional 605 unexpanded variable references) are shown. 606 607 _._M_A_K_E_._E_X_P_O_R_T_E_D 608 The list of variables exported by bbmmaakkee. 609 610 _M_A_K_E_F_I_L_E 611 The top-level makefile that is currently read, as given in the 612 command line. 613 614 _._M_A_K_E_F_L_A_G_S 615 The environment variable `MAKEFLAGS' may contain anything that 616 may be specified on bbmmaakkee's command line. Anything specified on 617 bbmmaakkee's command line is appended to the _._M_A_K_E_F_L_A_G_S variable, 618 which is then added to the environment for all programs that 619 bbmmaakkee executes. 620 621 _._M_A_K_E_._G_I_D 622 The numeric group ID of the user running bbmmaakkee. It is read-only. 623 624 _._M_A_K_E_._J_O_B_._P_R_E_F_I_X 625 If bbmmaakkee is run with --jj, the output for each target is prefixed 626 with a token 627 --- _t_a_r_g_e_t --- 628 the first part of which can be controlled via _._M_A_K_E_._J_O_B_._P_R_E_F_I_X. 629 If _._M_A_K_E_._J_O_B_._P_R_E_F_I_X is empty, no token is printed. For example, 630 setting _._M_A_K_E_._J_O_B_._P_R_E_F_I_X to 631 `${.newline}---${.MAKE:T}[${.MAKE.PID}]' would produce tokens 632 like 633 ---make[1234] _t_a_r_g_e_t --- 634 making it easier to track the degree of parallelism being 635 achieved. 636 637 _._M_A_K_E_._J_O_B_S 638 The argument to the --jj option. 639 640 _._M_A_K_E_._J_O_B_S_._C 641 A read-only boolean that indicates whether the --jj option supports 642 use of `C'. 643 644 _._M_A_K_E_._L_E_V_E_L 645 The recursion depth of bbmmaakkee. The top-level instance of bbmmaakkee 646 has level 0, and each child make has its parent level plus 1. 647 This allows tests like: .if ${.MAKE.LEVEL} == 0 to protect things 648 which should only be evaluated in the top-level instance of 649 bbmmaakkee. 650 651 _._M_A_K_E_._L_E_V_E_L_._E_N_V 652 The name of the environment variable that stores the level of 653 nested calls to bbmmaakkee. 654 655 _._M_A_K_E_._M_A_K_E_F_I_L_E___P_R_E_F_E_R_E_N_C_E 656 The ordered list of makefile names (default `_m_a_k_e_f_i_l_e', 657 `_M_a_k_e_f_i_l_e') that bbmmaakkee looks for. 658 659 _._M_A_K_E_._M_A_K_E_F_I_L_E_S 660 The list of makefiles read by bbmmaakkee, which is useful for tracking 661 dependencies. Each makefile is recorded only once, regardless of 662 the number of times read. 663 664 _._M_A_K_E_._M_E_T_A_._B_A_I_L_I_W_I_C_K 665 In "meta" mode, provides a list of prefixes which match the 666 directories controlled by bbmmaakkee. If a file that was generated 667 outside of _._O_B_J_D_I_R but within said bailiwick is missing, the 668 current target is considered out-of-date. 669 670 _._M_A_K_E_._M_E_T_A_._C_M_P___F_I_L_T_E_R 671 In "meta" mode, it can (very rarely!) be useful to filter command 672 lines before comparison. This variable can be set to a set of 673 modifiers that are applied to each line of the old and new 674 command that differ, if the filtered commands still differ, the 675 target is considered out-of-date. 676 677 _._M_A_K_E_._M_E_T_A_._C_R_E_A_T_E_D 678 In "meta" mode, this variable contains a list of all the meta 679 files updated. If not empty, it can be used to trigger 680 processing of _._M_A_K_E_._M_E_T_A_._F_I_L_E_S. 681 682 _._M_A_K_E_._M_E_T_A_._F_I_L_E_S 683 In "meta" mode, this variable contains a list of all the meta 684 files used (updated or not). This list can be used to process 685 the meta files to extract dependency information. 686 687 _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___F_I_L_T_E_R 688 Provides a list of variable modifiers to apply to each pathname. 689 Ignore if the expansion is an empty string. 690 691 _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_H_S 692 Provides a list of path prefixes that should be ignored; because 693 the contents are expected to change over time. The default list 694 includes: `_/_d_e_v _/_e_t_c _/_p_r_o_c _/_t_m_p _/_v_a_r_/_r_u_n _/_v_a_r_/_t_m_p' 695 696 _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_T_E_R_N_S 697 Provides a list of patterns to match against pathnames. Ignore 698 any that match. 699 700 _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X 701 Defines the message printed for each meta file updated in "meta 702 verbose" mode. The default value is: 703 Building ${.TARGET:H:tA}/${.TARGET:T} 704 705 _._M_A_K_E_._M_O_D_E 706 Processed after reading all makefiles. Affects the mode that 707 bbmmaakkee runs in. It can contain these keywords: 708 709 ccoommppaatt Like --BB, puts bbmmaakkee into "compat" mode. 710 711 mmeettaa Puts bbmmaakkee into "meta" mode, where meta files are created 712 for each target to capture the commands run, the output 713 generated, and if filemon(4) is available, the system 714 calls which are of interest to bbmmaakkee. The captured 715 output can be useful when diagnosing errors. 716 717 bbmmaakkee will use the information in the meta file to help 718 determine if a target is out-of-date when the normal 719 dependency rules indicate it is not. 720 721 First, the commands to be executed, will be compared to 722 those captured previously, if any differ, the target is 723 out-of-date. 724 725 This allows for a huge improvement in the reliability and 726 efficiency of update builds. It is no longer necessary 727 for targets to depend on makefiles just in-case they set 728 a variable that might be relevant. Mechanisms such as 729 _._M_A_K_E_._M_E_T_A_._C_M_P___F_I_L_T_E_R and ..NNOOMMEETTAA__CCMMPP, allow limiting or 730 disabling that comparison on a per target basis. A 731 reference to the variable _._O_O_D_A_T_E can be leveraged to 732 block comparison of certain commands. For example: 733 `${.OODATE:M}' will expand to nothing and have no impact 734 on the target, its side-effect though, will be to prevent 735 comparison of any command line it appears on. For 736 documentation purposes `${.OODATE:MNOMETA_CMP}' is 737 useful. 738 739 If necessary, bbmmaakkee will then use the information 740 captured by filemon(4), to check the modification time of 741 any file used in generating the target, if any is newer, 742 the target is out-of-date. 743 744 Such deep inspection can easily lead to cases where a 745 target is _a_l_w_a_y_s considered out-of-date, which is why 746 _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___F_I_L_T_E_R, _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_H_S and 747 _._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_T_E_R_N_S, are provided to limit that 748 inspection when necessary. 749 750 ccuurrddiirrOOkk==_b_f 751 By default, bbmmaakkee does not create _._m_e_t_a files in 752 `_._C_U_R_D_I_R'. This can be overridden by setting _b_f to a 753 value which represents true. 754 755 mmiissssiinngg--mmeettaa==_b_f 756 If _b_f is true, a missing _._m_e_t_a file makes the target out- 757 of-date. 758 759 mmiissssiinngg--ffiilleemmoonn==_b_f 760 If _b_f is true, missing filemon data makes the target out- 761 of-date. 762 763 nnooffiilleemmoonn 764 Do not use filemon(4). 765 766 eennvv For debugging, it can be useful to include the 767 environment in the _._m_e_t_a file. 768 769 vveerrbboossee 770 If in "meta" mode, print a clue about the target being 771 built. This is useful if the build is otherwise running 772 silently. The message printed is the expanded value of 773 _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X. 774 775 iiggnnoorree--ccmmdd 776 Some makefiles have commands which are simply not stable. 777 This keyword causes them to be ignored for determining 778 whether a target is out of date in "meta" mode. See also 779 ..NNOOMMEETTAA__CCMMPP. 780 781 ssiilleenntt==_b_f 782 If _b_f is true, when a .meta file is created, mark the 783 target ..SSIILLEENNTT. 784 785 rraannddoommiizzee--ttaarrggeettss 786 In both compat and parallel mode, do not make the targets 787 in the usual order, but instead randomize their order. 788 This mode can be used to detect undeclared dependencies 789 between files. 790 791 _M_A_K_E_O_B_J_D_I_R 792 Used to create files in a separate directory, see _._O_B_J_D_I_R. 793 794 _M_A_K_E___O_B_J_D_I_R___C_H_E_C_K___W_R_I_T_A_B_L_E 795 When true, bbmmaakkee will check that _._O_B_J_D_I_R is writable, and issue a 796 warning if not. 797 798 _M_A_K_E___D_E_B_U_G___O_B_J_D_I_R___C_H_E_C_K___W_R_I_T_A_B_L_E 799 When true and bbmmaakkee is warning about an unwritable _._O_B_J_D_I_R, 800 report the variables listed in _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R to help 801 debug. 802 803 _M_A_K_E_O_B_J_D_I_R_P_R_E_F_I_X 804 Used to create files in a separate directory, see _._O_B_J_D_I_R. It 805 should be an absolute path. 806 807 _._M_A_K_E_._O_S 808 The name of the operating system, see uname(1). It is read-only. 809 810 _._M_A_K_E_O_V_E_R_R_I_D_E_S 811 This variable is used to record the names of variables assigned 812 to on the command line, so that they may be exported as part of 813 `MAKEFLAGS'. This behavior can be disabled by assigning an empty 814 value to `_._M_A_K_E_O_V_E_R_R_I_D_E_S' within a makefile. Extra variables can 815 be exported from a makefile by appending their names to 816 `_._M_A_K_E_O_V_E_R_R_I_D_E_S'. `MAKEFLAGS' is re-exported whenever 817 `_._M_A_K_E_O_V_E_R_R_I_D_E_S' is modified. 818 819 _._M_A_K_E_._P_A_T_H___F_I_L_E_M_O_N 820 If bbmmaakkee was built with filemon(4) support, this is set to the 821 path of the device node. This allows makefiles to test for this 822 support. 823 824 _._M_A_K_E_._P_I_D 825 The process ID of bbmmaakkee. It is read-only. 826 827 _._M_A_K_E_._P_P_I_D 828 The parent process ID of bbmmaakkee. It is read-only. 829 830 _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R 831 When bbmmaakkee stops due to an error, it sets `_._E_R_R_O_R___T_A_R_G_E_T' to the 832 name of the target that failed, `_._E_R_R_O_R___E_X_I_T' to the exit status 833 of the failed target, `_._E_R_R_O_R___C_M_D' to the commands of the failed 834 target, and in "meta" mode, it also sets `_._E_R_R_O_R___C_W_D' to the 835 getcwd(3), and `_._E_R_R_O_R___M_E_T_A___F_I_L_E' to the path of the meta file 836 (if any) describing the failed target. It then prints its name 837 and the value of `_._C_U_R_D_I_R' as well as the value of any variables 838 named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. 839 840 _._M_A_K_E_._S_A_V_E___D_O_L_L_A_R_S 841 If true, `$$' are preserved when doing `:=' assignments. The 842 default is false, for backwards compatibility. Set to true for 843 compatability with other makes. If set to false, `$$' becomes 844 `$' per normal evaluation rules. 845 846 _._M_A_K_E_._T_A_R_G_E_T___L_O_C_A_L___V_A_R_I_A_B_L_E_S 847 If set to `false', apparent variable assignments in dependency 848 lines are treated as normal sources. 849 850 _._M_A_K_E_._U_I_D 851 The numeric ID of the user running bbmmaakkee. It is read-only. 852 853 _._n_e_w_l_i_n_e 854 This variable is simply assigned a newline character as its 855 value. It is read-only. This allows expansions using the ::@@ 856 modifier to put a newline between iterations of the loop rather 857 than a space. For example, in case of an error, bbmmaakkee prints the 858 variable names and their values using: 859 ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} 860 861 _._O_B_J_D_I_R 862 A path to the directory where the targets are built. Its value 863 is determined by trying to chdir(2) to the following directories 864 in order and using the first match: 865 866 1. $${{MMAAKKEEOOBBJJDDIIRRPPRREEFFIIXX}}$${{..CCUURRDDIIRR}} 867 868 (Only if `MAKEOBJDIRPREFIX' is set in the environment or on 869 the command line.) 870 871 2. $${{MMAAKKEEOOBBJJDDIIRR}} 872 873 (Only if `MAKEOBJDIR' is set in the environment or on the 874 command line.) 875 876 3. $${{..CCUURRDDIIRR}}_/_o_b_j_.$${{MMAACCHHIINNEE}} 877 878 4. $${{..CCUURRDDIIRR}}_/_o_b_j 879 880 5. _/_u_s_r_/_o_b_j_/$${{..CCUURRDDIIRR}} 881 882 6. $${{..CCUURRDDIIRR}} 883 884 Variable expansion is performed on the value before it is used, 885 so expressions such as $${{..CCUURRDDIIRR::SS,,^^//uussrr//ssrrcc,,//vvaarr//oobbjj,,}} may be 886 used. This is especially useful with `MAKEOBJDIR'. 887 888 `_._O_B_J_D_I_R' may be modified in the makefile via the special target 889 `..OOBBJJDDIIRR'. In all cases, bbmmaakkee changes to the specified 890 directory if it exists, and sets `_._O_B_J_D_I_R' and `_P_W_D' to that 891 directory before executing any targets. 892 893 Except in the case of an explicit `..OOBBJJDDIIRR' target, bbmmaakkee checks 894 that the specified directory is writable and ignores it if not. 895 This check can be skipped by setting the environment variable 896 `MAKE_OBJDIR_CHECK_WRITABLE' to "no". 897 898 _._P_A_R_S_E_D_I_R 899 The directory name of the current makefile being parsed. 900 901 _._P_A_R_S_E_F_I_L_E 902 The basename of the current makefile being parsed. This variable 903 and `_._P_A_R_S_E_D_I_R' are both set only while the makefiles are being 904 parsed. To retain their current values, assign them to a 905 variable using assignment with expansion `::=='. 906 907 _._P_A_T_H The space-separated list of directories that bbmmaakkee searches for 908 files. To update this search list, use the special target 909 `..PPAATTHH' rather than modifying the variable directly. 910 911 _%_P_O_S_I_X Is set in POSIX mode, see the special `_._P_O_S_I_X' target. 912 913 _P_W_D Alternate path to the current directory. bbmmaakkee normally sets 914 `_._C_U_R_D_I_R' to the canonical path given by getcwd(3). However, if 915 the environment variable `PWD' is set and gives a path to the 916 current directory, bbmmaakkee sets `_._C_U_R_D_I_R' to the value of `PWD' 917 instead. This behavior is disabled if `MAKEOBJDIRPREFIX' is set 918 or `MAKEOBJDIR' contains a variable transform. `_P_W_D' is set to 919 the value of `_._O_B_J_D_I_R' for all programs which bbmmaakkee executes. 920 921 _._S_H_E_L_L The pathname of the shell used to run target scripts. It is 922 read-only. 923 924 _._S_U_F_F_I_X_E_S 925 The list of known suffixes. It is read-only. 926 927 _._S_Y_S_P_A_T_H 928 The space-separated list of directories that bbmmaakkee searches for 929 makefiles, referred to as the system include path. To update 930 this search list, use the special target `..SSYYSSPPAATTHH' rather than 931 modifying the variable which is read-only. 932 933 _._T_A_R_G_E_T_S 934 The list of targets explicitly specified on the command line, if 935 any. 936 937 _V_P_A_T_H The colon-separated (":") list of directories that bbmmaakkee searches 938 for files. This variable is supported for compatibility with old 939 make programs only, use `_._P_A_T_H' instead. 940 941 VVaarriiaabbllee mmooddiiffiieerrss 942 The general format of a variable expansion is: 943 944 $${{_v_a_r_i_a_b_l_e[::_m_o_d_i_f_i_e_r[::...]]}} 945 946 Each modifier begins with a colon. To escape a colon, precede it with a 947 backslash `\'. 948 949 A list of indirect modifiers can be specified via a variable, as follows: 950 951 _m_o_d_i_f_i_e_r___v_a_r_i_a_b_l_e = _m_o_d_i_f_i_e_r[::...] 952 953 $${{_v_a_r_i_a_b_l_e::$${{_m_o_d_i_f_i_e_r___v_a_r_i_a_b_l_e}}[::...]}} 954 955 In this case, the first modifier in the _m_o_d_i_f_i_e_r___v_a_r_i_a_b_l_e does not start 956 with a colon, since that colon already occurs in the referencing 957 variable. If any of the modifiers in the _m_o_d_i_f_i_e_r___v_a_r_i_a_b_l_e contains a 958 dollar sign (`$'), these must be doubled to avoid early expansion. 959 960 Some modifiers interpret the expression value as a single string, others 961 treat the expression value as a whitespace-separated list of words. When 962 splitting a string into words, whitespace can be escaped using double 963 quotes, single quotes and backslashes, like in the shell. The quotes and 964 backslashes are retained in the words. 965 966 The supported modifiers are: 967 968 ::EE Replaces each word with its suffix. 969 970 ::HH Replaces each word with its dirname. 971 972 ::MM_p_a_t_t_e_r_n 973 Selects only those words that match _p_a_t_t_e_r_n. The standard shell 974 wildcard characters (`*', `?', and `[]') may be used. The wildcard 975 characters may be escaped with a backslash (`\'). As a consequence 976 of the way values are split into words, matched, and then joined, 977 the construct `${VAR:M*}' removes all leading and trailing 978 whitespace and normalizes the inter-word spacing to a single space. 979 980 ::NN_p_a_t_t_e_r_n 981 This is the opposite of `::MM', selecting all words which do _n_o_t match 982 _p_a_t_t_e_r_n. 983 984 ::OO Orders the words lexicographically. 985 986 ::OOnn Orders the words numerically. A number followed by one of `k', `M' 987 or `G' is multiplied by the appropriate factor, which is 1024 for 988 `k', 1048576 for `M', or 1073741824 for `G'. Both upper- and lower- 989 case letters are accepted. 990 991 ::OOrr Orders the words in reverse lexicographical order. 992 993 ::OOrrnn 994 Orders the words in reverse numerical order. 995 996 ::OOxx Shuffles the words. The results are different each time you are 997 referring to the modified variable; use the assignment with 998 expansion `::==' to prevent such behavior. For example, 999 1000 LIST= uno due tre quattro 1001 RANDOM_LIST= ${LIST:Ox} 1002 STATIC_RANDOM_LIST:= ${LIST:Ox} 1003 1004 all: 1005 @echo "${RANDOM_LIST}" 1006 @echo "${RANDOM_LIST}" 1007 @echo "${STATIC_RANDOM_LIST}" 1008 @echo "${STATIC_RANDOM_LIST}" 1009 may produce output similar to: 1010 1011 quattro due tre uno 1012 tre due quattro uno 1013 due uno quattro tre 1014 due uno quattro tre 1015 1016 ::QQ Quotes every shell meta-character in the value, so that it can be 1017 passed safely to the shell. 1018 1019 ::qq Quotes every shell meta-character in the value, and also doubles `$' 1020 characters so that it can be passed safely through recursive 1021 invocations of bbmmaakkee. This is equivalent to `::SS//\\$$//&&&&//gg::QQ'. 1022 1023 ::RR Replaces each word with everything but its suffix. 1024 1025 ::rraannggee[==_c_o_u_n_t] 1026 The value is an integer sequence representing the words of the 1027 original value, or the supplied _c_o_u_n_t. 1028 1029 ::ggmmttiimmee[==_t_i_m_e_s_t_a_m_p] 1030 The value is interpreted as a format string for strftime(3), using 1031 gmtime(3), producing the formatted timestamp. Note: the `%s' format 1032 should only be used with `::llooccaallttiimmee'. If a _t_i_m_e_s_t_a_m_p value is not 1033 provided or is 0, the current time is used. 1034 1035 ::hhaasshh 1036 Computes a 32-bit hash of the value and encodes it as 8 hex digits. 1037 1038 ::llooccaallttiimmee[==_t_i_m_e_s_t_a_m_p] 1039 The value is interpreted as a format string for strftime(3), using 1040 localtime(3), producing the formatted timestamp. If a _t_i_m_e_s_t_a_m_p 1041 value is not provided or is 0, the current time is used. 1042 1043 ::mmttiimmee[==_t_i_m_e_s_t_a_m_p] 1044 Call stat(2) with each word as pathname; use `st_mtime' as the new 1045 value. If stat(2) fails; use _t_i_m_e_s_t_a_m_p or current time. If 1046 _t_i_m_e_s_t_a_m_p is set to `error', then stat(2) failure will cause an 1047 error. 1048 1049 ::ttAA Attempts to convert the value to an absolute path using realpath(3). 1050 If that fails, the value is unchanged. 1051 1052 ::ttll Converts the value to lower-case letters. 1053 1054 ::ttss_c 1055 When joining the words after a modifier that treats the value as 1056 words, the words are normally separated by a space. This modifier 1057 changes the separator to the character _c. If _c is omitted, no 1058 separator is used. The common escapes (including octal numeric 1059 codes) work as expected. 1060 1061 ::tttt Converts the first character of each word to upper-case, and the 1062 rest to lower-case letters. 1063 1064 ::ttuu Converts the value to upper-case letters. 1065 1066 ::ttWW Causes subsequent modifiers to treat the value as a single word 1067 (possibly containing embedded whitespace). See also `::[[**]]'. 1068 1069 ::ttww Causes the value to be treated as a list of words. See also `::[[@@]]'. 1070 1071 ::SS/_o_l_d___s_t_r_i_n_g/_n_e_w___s_t_r_i_n_g/[11ggWW] 1072 Modifies the first occurrence of _o_l_d___s_t_r_i_n_g in each word of the 1073 value, replacing it with _n_e_w___s_t_r_i_n_g. If a `g' is appended to the 1074 last delimiter of the pattern, all occurrences in each word are 1075 replaced. If a `1' is appended to the last delimiter of the 1076 pattern, only the first occurrence is affected. If a `W' is 1077 appended to the last delimiter of the pattern, the value is treated 1078 as a single word. If _o_l_d___s_t_r_i_n_g begins with a caret (`^'), 1079 _o_l_d___s_t_r_i_n_g is anchored at the beginning of each word. If _o_l_d___s_t_r_i_n_g 1080 ends with a dollar sign (`$'), it is anchored at the end of each 1081 word. Inside _n_e_w___s_t_r_i_n_g, an ampersand (`&') is replaced by 1082 _o_l_d___s_t_r_i_n_g (without the anchoring `^' or `$'). Any character may be 1083 used as the delimiter for the parts of the modifier string. The 1084 anchoring, ampersand and delimiter characters can be escaped with a 1085 backslash (`\'). 1086 1087 Both _o_l_d___s_t_r_i_n_g and _n_e_w___s_t_r_i_n_g may contain nested expressions. To 1088 prevent a dollar sign from starting a nested expression, escape it 1089 with a backslash. 1090 1091 ::CC/_p_a_t_t_e_r_n/_r_e_p_l_a_c_e_m_e_n_t/[11ggWW] 1092 The ::CC modifier works like the ::SS modifier except that the old and 1093 new strings, instead of being simple strings, are an extended 1094 regular expression _p_a_t_t_e_r_n (see regex(3)) and an ed(1)-style 1095 _r_e_p_l_a_c_e_m_e_n_t. Normally, the first occurrence of the pattern _p_a_t_t_e_r_n 1096 in each word of the value is substituted with _r_e_p_l_a_c_e_m_e_n_t. The `1' 1097 modifier causes the substitution to apply to at most one word; the 1098 `g' modifier causes the substitution to apply to as many instances 1099 of the search pattern _p_a_t_t_e_r_n as occur in the word or words it is 1100 found in; the `W' modifier causes the value to be treated as a 1101 single word (possibly containing embedded whitespace). 1102 1103 As for the ::SS modifier, the _p_a_t_t_e_r_n and _r_e_p_l_a_c_e_m_e_n_t are subjected to 1104 variable expansion before being parsed as regular expressions. 1105 1106 ::TT Replaces each word with its last path component (basename). 1107 1108 ::uu Removes adjacent duplicate words (like uniq(1)). 1109 1110 ::??_t_r_u_e___s_t_r_i_n_g::_f_a_l_s_e___s_t_r_i_n_g 1111 If the variable name (not its value), when parsed as a ..iiff 1112 conditional expression, evaluates to true, return as its value the 1113 _t_r_u_e___s_t_r_i_n_g, otherwise return the _f_a_l_s_e___s_t_r_i_n_g. Since the variable 1114 name is used as the expression, :? must be the first modifier after 1115 the variable name itself--which, of course, usually contains 1116 variable expansions. A common error is trying to use expressions 1117 like 1118 ${NUMBERS:M42:?match:no} 1119 which actually tests defined(NUMBERS). To determine if any words 1120 match "42", you need to use something like: 1121 ${"${NUMBERS:M42}" != "":?match:no}. 1122 1123 ::_o_l_d___s_t_r_i_n_g==_n_e_w___s_t_r_i_n_g 1124 This is the AT&T System V UNIX style substitution. It can only be 1125 the last modifier specified, as a `:' in either _o_l_d___s_t_r_i_n_g or 1126 _n_e_w___s_t_r_i_n_g is treated as a regular character, not as the end of the 1127 modifier. 1128 1129 If _o_l_d___s_t_r_i_n_g does not contain the pattern matching character `%', 1130 and the word ends with _o_l_d___s_t_r_i_n_g or equals it, that suffix is 1131 replaced with _n_e_w___s_t_r_i_n_g. 1132 1133 Otherwise, the first `%' in _o_l_d___s_t_r_i_n_g matches a possibly empty 1134 substring of arbitrary characters, and if the whole pattern is found 1135 in the word, the matching part is replaced with _n_e_w___s_t_r_i_n_g, and the 1136 first occurrence of `%' in _n_e_w___s_t_r_i_n_g (if any) is replaced with the 1137 substring matched by the `%'. 1138 1139 Both _o_l_d___s_t_r_i_n_g and _n_e_w___s_t_r_i_n_g may contain nested expressions. To 1140 prevent a dollar sign from starting a nested expression, escape it 1141 with a backslash. 1142 1143 ::@@_v_a_r_n_a_m_e@@_s_t_r_i_n_g@@ 1144 This is the loop expansion mechanism from the OSF Development 1145 Environment (ODE) make. Unlike ..ffoorr loops, expansion occurs at the 1146 time of reference. For each word in the value, assign the word to 1147 the variable named _v_a_r_n_a_m_e and evaluate _s_t_r_i_n_g. The ODE convention 1148 is that _v_a_r_n_a_m_e should start and end with a period, for example: 1149 ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} 1150 1151 However, a single-letter variable is often more readable: 1152 ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} 1153 1154 ::__[==_v_a_r] 1155 Saves the current variable value in `$_' or the named _v_a_r for later 1156 reference. Example usage: 1157 1158 M_cmpv.units = 1 1000 1000000 1159 M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \ 1160 \* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh 1161 1162 .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} 1163 1164 Here `$_' is used to save the result of the `:S' modifier which is 1165 later referenced using the index values from `:range'. 1166 1167 ::UU_n_e_w_v_a_l 1168 If the variable is undefined, the optional _n_e_w_v_a_l (which may be 1169 empty) is the value. If the variable is defined, the existing value 1170 is returned. This is another ODE make feature. It is handy for 1171 setting per-target CFLAGS for instance: 1172 ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}} 1173 If a value is only required if the variable is undefined, use: 1174 ${VAR:D:Unewval} 1175 1176 ::DD_n_e_w_v_a_l 1177 If the variable is defined, _n_e_w_v_a_l (which may be empty) is the 1178 value. 1179 1180 ::LL The name of the variable is the value. 1181 1182 ::PP The path of the node which has the same name as the variable is the 1183 value. If no such node exists or its path is null, the name of the 1184 variable is used. In order for this modifier to work, the name 1185 (node) must at least have appeared on the right-hand side of a 1186 dependency. 1187 1188 ::!!_c_m_d!! 1189 The output of running _c_m_d is the value. 1190 1191 ::sshh The value is run as a command, and the output becomes the new value. 1192 1193 ::::==_s_t_r 1194 The variable is assigned the value _s_t_r after substitution. This 1195 modifier and its variations are useful in obscure situations such as 1196 wanting to set a variable at a point where a target's shell commands 1197 are being parsed. These assignment modifiers always expand to 1198 nothing. 1199 1200 The `::::' helps avoid false matches with the AT&T System V UNIX style 1201 `:=' modifier and since substitution always occurs, the `::=' form 1202 is vaguely appropriate. 1203 1204 ::::??==_s_t_r 1205 As for ::::== but only if the variable does not already have a value. 1206 1207 ::::++==_s_t_r 1208 Append _s_t_r to the variable. 1209 1210 ::::!!==_c_m_d 1211 Assign the output of _c_m_d to the variable. 1212 1213 ::[[_r_a_n_g_e]] 1214 Selects one or more words from the value, or performs other 1215 operations related to the way in which the value is split into 1216 words. 1217 1218 An empty value, or a value that consists entirely of white-space, is 1219 treated as a single word. For the purposes of the `::[[]]' modifier, 1220 the words are indexed both forwards using positive integers (where 1221 index 1 represents the first word), and backwards using negative 1222 integers (where index -1 represents the last word). 1223 1224 The _r_a_n_g_e is subjected to variable expansion, and the expanded 1225 result is then interpreted as follows: 1226 1227 _i_n_d_e_x Selects a single word from the value. 1228 1229 _s_t_a_r_t...._e_n_d 1230 Selects all words from _s_t_a_r_t to _e_n_d, inclusive. For example, 1231 `::[[22....--11]]' selects all words from the second word to the last 1232 word. If _s_t_a_r_t is greater than _e_n_d, the words are output in 1233 reverse order. For example, `::[[--11....11]]' selects all the words 1234 from last to first. If the list is already ordered, this 1235 effectively reverses the list, but it is more efficient to 1236 use `::OOrr' instead of `::OO::[[--11....11]]'. 1237 1238 ** Causes subsequent modifiers to treat the value as a single 1239 word (possibly containing embedded whitespace). Analogous to 1240 the effect of $* in Bourne shell. 1241 1242 0 Means the same as `::[[**]]'. 1243 1244 @@ Causes subsequent modifiers to treat the value as a sequence 1245 of words delimited by whitespace. Analogous to the effect of 1246 $@ in Bourne shell. 1247 1248 ## Returns the number of words in the value. 1249 1250DDIIRREECCTTIIVVEESS 1251 bbmmaakkee offers directives for including makefiles, conditionals and for 1252 loops. All these directives are identified by a line beginning with a 1253 single dot (`.') character, followed by the keyword of the directive, 1254 such as iinncclluuddee or iiff. 1255 1256 FFiillee iinncclluussiioonn 1257 Files are included with either ..iinncclluuddee <<_f_i_l_e>> or ..iinncclluuddee ""_f_i_l_e"". 1258 Variables between the angle brackets or double quotes are expanded to 1259 form the file name. If angle brackets are used, the included makefile is 1260 expected to be in the system makefile directory. If double quotes are 1261 used, the including makefile's directory and any directories specified 1262 using the --II option are searched before the system makefile directory. 1263 1264 For compatibility with other make variants, `iinncclluuddee _f_i_l_e ...' (without 1265 leading dot) is also accepted. 1266 1267 If the include statement is written as ..--iinncclluuddee or as ..ssiinncclluuddee, errors 1268 locating and/or opening include files are ignored. 1269 1270 If the include statement is written as ..ddiinncclluuddee, not only are errors 1271 locating and/or opening include files ignored, but stale dependencies 1272 within the included file are ignored just like in _._M_A_K_E_._D_E_P_E_N_D_F_I_L_E. 1273 1274 EExxppoorrttiinngg vvaarriiaabblleess 1275 The directives for exporting and unexporting variables are: 1276 1277 ..eexxppoorrtt _v_a_r_i_a_b_l_e ... 1278 Export the specified global variable. 1279 1280 For compatibility with other make programs, eexxppoorrtt _v_a_r_i_a_b_l_e==_v_a_l_u_e 1281 (without leading dot) is also accepted. 1282 1283 Appending a variable name to _._M_A_K_E_._E_X_P_O_R_T_E_D is equivalent to 1284 exporting a variable. 1285 1286 ..eexxppoorrtt--aallll 1287 Export all globals except for internal variables (those that 1288 start with `.'). This is not affected by the --XX flag, so should 1289 be used with caution. 1290 1291 ..eexxppoorrtt--eennvv _v_a_r_i_a_b_l_e ... 1292 The same as `.export', except that the variable is not appended 1293 to _._M_A_K_E_._E_X_P_O_R_T_E_D. This allows exporting a value to the 1294 environment which is different from that used by bbmmaakkee 1295 internally. 1296 1297 ..eexxppoorrtt--lliitteerraall _v_a_r_i_a_b_l_e ... 1298 The same as `.export-env', except that variables in the value are 1299 not expanded. 1300 1301 ..uunneexxppoorrtt _v_a_r_i_a_b_l_e ... 1302 The opposite of `.export'. The specified global _v_a_r_i_a_b_l_e is 1303 removed from _._M_A_K_E_._E_X_P_O_R_T_E_D. If no variable list is provided, 1304 all globals are unexported, and _._M_A_K_E_._E_X_P_O_R_T_E_D deleted. 1305 1306 ..uunneexxppoorrtt--eennvv 1307 Unexport all globals previously exported and clear the 1308 environment inherited from the parent. This operation causes a 1309 memory leak of the original environment, so should be used 1310 sparingly. Testing for _._M_A_K_E_._L_E_V_E_L being 0 would make sense. 1311 Also note that any variables which originated in the parent 1312 environment should be explicitly preserved if desired. For 1313 example: 1314 1315 .if ${.MAKE.LEVEL} == 0 1316 PATH := ${PATH} 1317 .unexport-env 1318 .export PATH 1319 .endif 1320 1321 Would result in an environment containing only `PATH', which is 1322 the minimal useful environment. Actually `_._M_A_K_E_._L_E_V_E_L' is also 1323 pushed into the new environment. 1324 1325 MMeessssaaggeess 1326 The directives for printing messages to the output are: 1327 1328 ..iinnffoo _m_e_s_s_a_g_e 1329 The message is printed along with the name of the makefile and 1330 line number. 1331 1332 ..wwaarrnniinngg _m_e_s_s_a_g_e 1333 The message prefixed by `warning:' is printed along with the name 1334 of the makefile and line number. 1335 1336 ..eerrrroorr _m_e_s_s_a_g_e 1337 The message is printed along with the name of the makefile and 1338 line number, bbmmaakkee exits immediately. 1339 1340 CCoonnddiittiioonnaallss 1341 The directives for conditionals are: 1342 1343 ..iiff [!!]_e_x_p_r_e_s_s_i_o_n [_o_p_e_r_a_t_o_r _e_x_p_r_e_s_s_i_o_n ...] 1344 Test the value of an expression. 1345 1346 ..iiffddeeff [!!]_v_a_r_i_a_b_l_e [_o_p_e_r_a_t_o_r _v_a_r_i_a_b_l_e ...] 1347 Test whether a variable is defined. 1348 1349 ..iiffnnddeeff [!!]_v_a_r_i_a_b_l_e [_o_p_e_r_a_t_o_r _v_a_r_i_a_b_l_e ...] 1350 Test whether a variable is not defined. 1351 1352 ..iiffmmaakkee [!!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t ...] 1353 Test the target being requested. 1354 1355 ..iiffnnmmaakkee [!!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t ...] 1356 Test the target being requested. 1357 1358 ..eellssee Reverse the sense of the last conditional. 1359 1360 ..eelliiff [!!]_e_x_p_r_e_s_s_i_o_n [_o_p_e_r_a_t_o_r _e_x_p_r_e_s_s_i_o_n ...] 1361 A combination of `..eellssee' followed by `..iiff'. 1362 1363 ..eelliiffddeeff [!!]_v_a_r_i_a_b_l_e [_o_p_e_r_a_t_o_r _v_a_r_i_a_b_l_e ...] 1364 A combination of `..eellssee' followed by `..iiffddeeff'. 1365 1366 ..eelliiffnnddeeff [!!]_v_a_r_i_a_b_l_e [_o_p_e_r_a_t_o_r _v_a_r_i_a_b_l_e ...] 1367 A combination of `..eellssee' followed by `..iiffnnddeeff'. 1368 1369 ..eelliiffmmaakkee [!!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t ...] 1370 A combination of `..eellssee' followed by `..iiffmmaakkee'. 1371 1372 ..eelliiffnnmmaakkee [!!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t ...] 1373 A combination of `..eellssee' followed by `..iiffnnmmaakkee'. 1374 1375 ..eennddiiff End the body of the conditional. 1376 1377 The _o_p_e_r_a_t_o_r may be any one of the following: 1378 1379 |||| Logical OR. 1380 1381 &&&& Logical AND; of higher precedence than `||||'. 1382 1383 bbmmaakkee only evaluates a conditional as far as is necessary to determine 1384 its value. Parentheses can be used to override the operator precedence. 1385 The boolean operator `!!' may be used to logically negate an expression, 1386 typically a function call. It is of higher precedence than `&&&&'. 1387 1388 The value of _e_x_p_r_e_s_s_i_o_n may be any of the following function call 1389 expressions: 1390 1391 ddeeffiinneedd(_v_a_r_n_a_m_e) 1392 Evaluates to true if the variable _v_a_r_n_a_m_e has been defined. 1393 1394 mmaakkee(_t_a_r_g_e_t) 1395 Evaluates to true if the target was specified as part of bbmmaakkee's 1396 command line or was declared the default target (either 1397 implicitly or explicitly, see _._M_A_I_N) before the line containing 1398 the conditional. 1399 1400 eemmppttyy(_v_a_r_n_a_m_e[:_m_o_d_i_f_i_e_r_s]) 1401 Evaluates to true if the expansion of the variable, after 1402 applying the modifiers, results in an empty string. 1403 1404 eexxiissttss(_p_a_t_h_n_a_m_e) 1405 Evaluates to true if the given pathname exists. If relative, the 1406 pathname is searched for on the system search path (see _._P_A_T_H). 1407 1408 ttaarrggeett(_t_a_r_g_e_t) 1409 Evaluates to true if the target has been defined. 1410 1411 ccoommmmaannddss(_t_a_r_g_e_t) 1412 Evaluates to true if the target has been defined and has commands 1413 associated with it. 1414 1415 _E_x_p_r_e_s_s_i_o_n may also be an arithmetic or string comparison. Variable 1416 expansion is performed on both sides of the comparison. If both sides 1417 are numeric and neither is enclosed in quotes, the comparison is done 1418 numerically, otherwise lexicographically. A string is interpreted as a 1419 hexadecimal integer if it is preceded by 0x, otherwise it is interpreted 1420 as a decimal floating-point number; octal numbers are not supported. 1421 1422 All comparisons may use the operators `====' and `!!=='. Numeric comparisons 1423 may also use the operators `<<', `<<==', `>>' and `>>=='. 1424 1425 If the comparison has neither a comparison operator nor a right side, the 1426 expression evaluates to true if it is nonempty and its numeric value (if 1427 any) is not zero. 1428 1429 When bbmmaakkee is evaluating one of these conditional expressions, and it 1430 encounters a (whitespace-separated) word it doesn't recognize, either the 1431 "make" or "defined" function is applied to it, depending on the form of 1432 the conditional. If the form is `..iiffddeeff', `..iiffnnddeeff' or `..iiff', the 1433 "defined" function is applied. Similarly, if the form is `..iiffmmaakkee' or 1434 `..iiffnnmmaakkee', the "make" function is applied. 1435 1436 If the conditional evaluates to true, parsing of the makefile continues 1437 as before. If it evaluates to false, the following lines until the 1438 corresponding `..eelliiff' variant, `..eellssee' or `..eennddiiff' are skipped. 1439 1440 FFoorr llooooppss 1441 For loops are typically used to apply a set of rules to a list of files. 1442 The syntax of a for loop is: 1443 1444 ..ffoorr _v_a_r_i_a_b_l_e [_v_a_r_i_a_b_l_e ...] iinn _e_x_p_r_e_s_s_i_o_n 1445 <_m_a_k_e_-_l_i_n_e_s> 1446 ..eennddffoorr 1447 1448 The _e_x_p_r_e_s_s_i_o_n is expanded and then split into words. On each iteration 1449 of the loop, one word is taken and assigned to each _v_a_r_i_a_b_l_e, in order, 1450 and these _v_a_r_i_a_b_l_e_s are substituted into the _m_a_k_e_-_l_i_n_e_s inside the body 1451 of the for loop. The number of words must come out even; that is, if 1452 there are three iteration variables, the number of words provided must be 1453 a multiple of three. 1454 1455 If `..bbrreeaakk' is encountered within a ..ffoorr loop, it causes early 1456 termination of the loop, otherwise a parse error. 1457 1458 OOtthheerr ddiirreeccttiivveess 1459 ..uunnddeeff _v_a_r_i_a_b_l_e ... 1460 Un-define the specified global variables. Only global variables 1461 can be un-defined. 1462 1463CCOOMMMMEENNTTSS 1464 Comments begin with a hash (`#') character, anywhere but in a shell 1465 command line, and continue to the end of an unescaped new line. 1466 1467SSPPEECCIIAALL SSOOUURRCCEESS ((AATTTTRRIIBBUUTTEESS)) 1468 ..EEXXEECC Target is never out of date, but always execute commands 1469 anyway. 1470 1471 ..IIGGNNOORREE Ignore any errors from the commands associated with this 1472 target, exactly as if they all were preceded by a dash (`-'). 1473 1474 ..MMAADDEE Mark all sources of this target as being up to date. 1475 1476 ..MMAAKKEE Execute the commands associated with this target even if the --nn 1477 or --tt options were specified. Normally used to mark recursive 1478 bbmmaakkees. 1479 1480 ..MMEETTAA Create a meta file for the target, even if it is flagged as 1481 ..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL. Usage in conjunction with ..MMAAKKEE is 1482 the most likely case. In "meta" mode, the target is out-of- 1483 date if the meta file is missing. 1484 1485 ..NNOOMMEETTAA Do not create a meta file for the target. Meta files are also 1486 not created for ..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL targets. 1487 1488 ..NNOOMMEETTAA__CCMMPP 1489 Ignore differences in commands when deciding if target is out 1490 of date. This is useful if the command contains a value which 1491 always changes. If the number of commands change, though, the 1492 target is still considered out of date. The same effect 1493 applies to any command line that uses the variable _._O_O_D_A_T_E, 1494 which can be used for that purpose even when not otherwise 1495 needed or desired: 1496 1497 1498 skip-compare-for-some: 1499 @echo this is compared 1500 @echo this is not ${.OODATE:M.NOMETA_CMP} 1501 @echo this is also compared 1502 1503 The ::MM pattern suppresses any expansion of the unwanted 1504 variable. 1505 1506 ..NNOOPPAATTHH Do not search for the target in the directories specified by 1507 _._P_A_T_H. 1508 1509 ..NNOOTTMMAAIINN Normally bbmmaakkee selects the first target it encounters as the 1510 default target to be built if no target was specified. This 1511 source prevents this target from being selected. 1512 1513 ..OOPPTTIIOONNAALL 1514 If a target is marked with this attribute and bbmmaakkee can't 1515 figure out how to create it, it ignores this fact and assumes 1516 the file isn't needed or already exists. 1517 1518 ..PPHHOONNYY The target does not correspond to an actual file; it is always 1519 considered to be out of date, and is not created with the --tt 1520 option. Suffix-transformation rules are not applied to ..PPHHOONNYY 1521 targets. 1522 1523 ..PPRREECCIIOOUUSS 1524 When bbmmaakkee is interrupted, it normally removes any partially 1525 made targets. This source prevents the target from being 1526 removed. 1527 1528 ..RREECCUURRSSIIVVEE 1529 Synonym for ..MMAAKKEE. 1530 1531 ..SSIILLEENNTT Do not echo any of the commands associated with this target, 1532 exactly as if they all were preceded by an at sign (`@'). 1533 1534 ..UUSSEE Turn the target into bbmmaakkee's version of a macro. When the 1535 target is used as a source for another target, the other target 1536 acquires the commands, sources, and attributes (except for 1537 ..UUSSEE) of the source. If the target already has commands, the 1538 ..UUSSEE target's commands are appended to them. 1539 1540 ..UUSSEEBBEEFFOORREE 1541 Like ..UUSSEE, but instead of appending, prepend the ..UUSSEEBBEEFFOORREE 1542 target commands to the target. 1543 1544 ..WWAAIITT If ..WWAAIITT appears in a dependency line, the sources that precede 1545 it are made before the sources that succeed it in the line. 1546 Since the dependents of files are not made until the file 1547 itself could be made, this also stops the dependents being 1548 built unless they are needed for another branch of the 1549 dependency tree. So given: 1550 1551 x: a .WAIT b 1552 echo x 1553 a: 1554 echo a 1555 b: b1 1556 echo b 1557 b1: 1558 echo b1 1559 1560 the output is always `a', `b1', `b', `x'. 1561 1562 The ordering imposed by ..WWAAIITT is only relevant for parallel 1563 makes. 1564 1565SSPPEECCIIAALL TTAARRGGEETTSS 1566 Special targets may not be included with other targets, i.e. they must be 1567 the only target specified. 1568 1569 ..BBEEGGIINN Any command lines attached to this target are executed before 1570 anything else is done. 1571 1572 ..DDEEFFAAUULLTT 1573 This is sort of a ..UUSSEE rule for any target (that was used only 1574 as a source) that bbmmaakkee can't figure out any other way to 1575 create. Only the shell script is used. The _._I_M_P_S_R_C variable of 1576 a target that inherits ..DDEEFFAAUULLTT's commands is set to the 1577 target's own name. 1578 1579 ..DDEELLEETTEE__OONN__EERRRROORR 1580 If this target is present in the makefile, it globally causes 1581 make to delete targets whose commands fail. (By default, only 1582 targets whose commands are interrupted during execution are 1583 deleted. This is the historical behavior.) This setting can be 1584 used to help prevent half-finished or malformed targets from 1585 being left around and corrupting future rebuilds. 1586 1587 ..EENNDD Any command lines attached to this target are executed after 1588 everything else is done successfully. 1589 1590 ..EERRRROORR Any command lines attached to this target are executed when 1591 another target fails. See _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R for the 1592 variables that will be set. 1593 1594 ..IIGGNNOORREE Mark each of the sources with the ..IIGGNNOORREE attribute. If no 1595 sources are specified, this is the equivalent of specifying the 1596 --ii option. 1597 1598 ..IINNTTEERRRRUUPPTT 1599 If bbmmaakkee is interrupted, the commands for this target are 1600 executed. 1601 1602 ..MMAAIINN If no target is specified when bbmmaakkee is invoked, this target is 1603 built. 1604 1605 ..MMAAKKEEFFLLAAGGSS 1606 This target provides a way to specify flags for bbmmaakkee at the 1607 time when the makefiles are read. The flags are as if typed to 1608 the shell, though the --ff option has no effect. 1609 1610 ..NNOOPPAATTHH Apply the ..NNOOPPAATTHH attribute to any specified sources. 1611 1612 ..NNOOTTPPAARRAALLLLEELL 1613 Disable parallel mode. 1614 1615 ..NNOO__PPAARRAALLLLEELL 1616 Synonym for ..NNOOTTPPAARRAALLLLEELL, for compatibility with other pmake 1617 variants. 1618 1619 ..NNOORREEAADDOONNLLYY 1620 clear the read-only attribute from the global variables 1621 specified as sources. 1622 1623 ..OOBBJJDDIIRR The source is a new value for `_._O_B_J_D_I_R'. If it exists, bbmmaakkee 1624 changes the current working directory to it and updates the 1625 value of `_._O_B_J_D_I_R'. 1626 1627 ..OORRDDEERR In parallel mode, the named targets are made in sequence. This 1628 ordering does not add targets to the list of targets to be made. 1629 1630 Since the dependents of a target do not get built until the 1631 target itself could be built, unless `a' is built by another 1632 part of the dependency graph, the following is a dependency 1633 loop: 1634 1635 .ORDER: b a 1636 b: a 1637 1638 ..PPAATTHH The sources are directories which are to be searched for files 1639 not found in the current directory. If no sources are 1640 specified, any previously specified directories are removed from 1641 the search path. If the source is the special ..DDOOTTLLAASSTT target, 1642 the current working directory is searched last. 1643 1644 ..PPAATTHH.._s_u_f_f_i_x 1645 Like ..PPAATTHH but applies only to files with a particular suffix. 1646 The suffix must have been previously declared with ..SSUUFFFFIIXXEESS. 1647 1648 ..PPHHOONNYY Apply the ..PPHHOONNYY attribute to any specified sources. 1649 1650 ..PPOOSSIIXX If this is the first non-comment line in the main makefile, the 1651 variable _%_P_O_S_I_X is set to the value `1003.2' and the makefile 1652 `<posix.mk>' is included if it exists, to provide POSIX- 1653 compatible default rules. If bbmmaakkee is run with the --rr flag, 1654 only `posix.mk' contributes to the default rules. In POSIX- 1655 compatible mode, the AT&T System V UNIX style substitution 1656 modifier is checked first rather than as a fallback. 1657 1658 ..PPRREECCIIOOUUSS 1659 Apply the ..PPRREECCIIOOUUSS attribute to any specified sources. If no 1660 sources are specified, the ..PPRREECCIIOOUUSS attribute is applied to 1661 every target in the file. 1662 1663 ..RREEAADDOONNLLYY 1664 set the read-only attribute on the global variables specified as 1665 sources. 1666 1667 ..SSHHEELLLL Sets the shell that bbmmaakkee uses to execute commands. The sources 1668 are a set of _f_i_e_l_d==_v_a_l_u_e pairs. 1669 1670 name This is the minimal specification, used to select 1671 one of the built-in shell specs; sh, ksh, and csh. 1672 1673 path Specifies the absolute path to the shell. 1674 1675 hasErrCtl Indicates whether the shell supports exit on error. 1676 1677 check The command to turn on error checking. 1678 1679 ignore The command to disable error checking. 1680 1681 echo The command to turn on echoing of commands executed. 1682 1683 quiet The command to turn off echoing of commands 1684 executed. 1685 1686 filter The output to filter after issuing the quiet 1687 command. It is typically identical to quiet. 1688 1689 errFlag The flag to pass the shell to enable error checking. 1690 1691 echoFlag The flag to pass the shell to enable command 1692 echoing. 1693 1694 newline The string literal to pass the shell that results in 1695 a single newline character when used outside of any 1696 quoting characters. 1697 Example: 1698 1699 .SHELL: name=ksh path=/bin/ksh hasErrCtl=true \ 1700 check="set -e" ignore="set +e" \ 1701 echo="set -v" quiet="set +v" filter="set +v" \ 1702 echoFlag=v errFlag=e newline="'\n'" 1703 1704 ..SSIILLEENNTT Apply the ..SSIILLEENNTT attribute to any specified sources. If no 1705 sources are specified, the ..SSIILLEENNTT attribute is applied to every 1706 command in the file. 1707 1708 ..SSTTAALLEE This target gets run when a dependency file contains stale 1709 entries, having _._A_L_L_S_R_C set to the name of that dependency file. 1710 1711 ..SSUUFFFFIIXXEESS 1712 Each source specifies a suffix to bbmmaakkee. If no sources are 1713 specified, any previously specified suffixes are deleted. It 1714 allows the creation of suffix-transformation rules. 1715 1716 Example: 1717 1718 .SUFFIXES: .c .o 1719 .c.o: 1720 cc -o ${.TARGET} -c ${.IMPSRC} 1721 1722 ..SSYYSSPPAATTHH 1723 The sources are directories which are to be added to the system 1724 include path which bbmmaakkee searches for makefiles. If no sources 1725 are specified, any previously specified directories are removed 1726 from the system include path. 1727 1728EENNVVIIRROONNMMEENNTT 1729 bbmmaakkee uses the following environment variables, if they exist: MACHINE, 1730 MACHINE_ARCH, MAKE, MAKEFLAGS, MAKEOBJDIR, MAKEOBJDIRPREFIX, MAKESYSPATH, 1731 MAKE_STACK_TRACE, PWD, and TMPDIR. 1732 1733 MAKEOBJDIRPREFIX and MAKEOBJDIR should be set in the environment or on 1734 the command line to bbmmaakkee and not as makefile variables; see the 1735 description of `_._O_B_J_D_I_R' for more details. It is possible to set these 1736 via makefile variables but unless done very early and the `..OOBBJJDDIIRR' 1737 target is used to reset `_._O_B_J_D_I_R', there may be unexpected side effects. 1738 1739 If the MAKE_STACK_TRACE environment variable is set to "yes", any stack 1740 traces include the call chain of the parent processes. 1741 1742FFIILLEESS 1743 .depend list of dependencies 1744 makefile first default makefile if no makefile is specified on the 1745 command line 1746 Makefile second default makefile if no makefile is specified on the 1747 command line 1748 sys.mk system makefile 1749 /usr/share/mk system makefile directory 1750 1751CCOOMMPPAATTIIBBIILLIITTYY 1752 The basic make syntax is compatible between different make variants; 1753 however the special variables, variable modifiers and conditionals are 1754 not. 1755 1756 OOllddeerr vveerrssiioonnss 1757 An incomplete list of changes in older versions of bbmmaakkee: 1758 1759 The way that .for loop variables are substituted changed after NetBSD 5.0 1760 so that they still appear to be variable expansions. In particular this 1761 stops them being treated as syntax, and removes some obscure problems 1762 using them in .if statements. 1763 1764 The way that parallel makes are scheduled changed in NetBSD 4.0 so that 1765 .ORDER and .WAIT apply recursively to the dependent nodes. The 1766 algorithms used may change again in the future. 1767 1768 OOtthheerr mmaakkee ddiiaalleeccttss 1769 Other make dialects (GNU make, SVR4 make, POSIX make, etc.) do not 1770 support most of the features of bbmmaakkee as described in this manual. Most 1771 notably: 1772 1773 ++oo The ..WWAAIITT and ..OORRDDEERR declarations and most functionality 1774 pertaining to parallelization. (GNU make supports 1775 parallelization but lacks the features needed to control it 1776 effectively.) 1777 1778 ++oo Directives, including for loops and conditionals and most of 1779 the forms of include files. (GNU make has its own incompatible 1780 and less powerful syntax for conditionals.) 1781 1782 ++oo All built-in variables that begin with a dot. 1783 1784 ++oo Most of the special sources and targets that begin with a dot, 1785 with the notable exception of ..PPHHOONNYY, ..PPRREECCIIOOUUSS, and ..SSUUFFFFIIXXEESS. 1786 1787 ++oo Variable modifiers, except for the `:old=new' string 1788 substitution, which does not portably support globbing with `%' 1789 and historically only works on declared suffixes. 1790 1791 ++oo The $$>> variable even in its short form; most makes support this 1792 functionality but its name varies. 1793 1794 Some features are somewhat more portable, such as assignment with ++==, ??==, 1795 and !!==. The _._P_A_T_H functionality is based on an older feature VVPPAATTHH found 1796 in GNU make and many versions of SVR4 make; however, historically its 1797 behavior is too ill-defined (and too buggy) to rely upon. 1798 1799 The $$@@ and $$<< variables are more or less universally portable, as is the 1800 $$((MMAAKKEE)) variable. Basic use of suffix rules (for files only in the 1801 current directory, not trying to chain transformations together, etc.) is 1802 also reasonably portable. 1803 1804SSEEEE AALLSSOO 1805 mkdep(1) 1806 1807HHIISSTTOORRYY 1808 bbmmaakkee is derived from NetBSD make(1). It uses autoconf to facilitate 1809 portability to other platforms. 1810 1811 A make command appeared in Version 7 AT&T UNIX. This make implementation 1812 is based on Adam de Boor's pmake program, which was written for Sprite at 1813 Berkeley. It was designed to be a parallel distributed make running jobs 1814 on different machines using a daemon called "customs". 1815 1816 Historically the target/dependency FFRRCC has been used to FoRCe rebuilding 1817 (since the target/dependency does not exist ... unless someone creates an 1818 _F_R_C file). 1819 1820BBUUGGSS 1821 The bbmmaakkee syntax is difficult to parse. For instance, finding the end of 1822 a variable's use should involve scanning each of the modifiers, using the 1823 correct terminator for each field. In many places bbmmaakkee just counts {} 1824 and () in order to find the end of a variable expansion. 1825 1826 There is no way of escaping a space character in a filename. 1827 1828 In jobs mode, when a target fails; bbmmaakkee will put an error token into the 1829 job token pool. This will cause all other instances of bbmmaakkee using that 1830 token pool to abort the build and exit with error code 6. Sometimes the 1831 attempt to suppress a cascade of unnecessary errors, can result in a 1832 seemingly unexplained `*** Error code 6' 1833 1834FreeBSD 14.2-RELEASE-p1 June 12, 2025 FreeBSD 14.2-RELEASE-p1 1835