bmake.cat1 revision 236769
1MAKE(1) NetBSD General Commands Manual MAKE(1) 2 3NNAAMMEE 4 bbmmaakkee -- maintain program dependencies 5 6SSYYNNOOPPSSIISS 7 bbmmaakkee [--BBeeiikkNNnnqqrrssttWWXX] [--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] [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] 10 [_t_a_r_g_e_t _._._.] 11 12DDEESSCCRRIIPPTTIIOONN 13 bbmmaakkee is a program designed to simplify the maintenance of other pro- 14 grams. Its input is a list of specifications as to the files upon which 15 programs and other files depend. If no --ff _m_a_k_e_f_i_l_e makefile option is 16 given, bbmmaakkee will try to open `_m_a_k_e_f_i_l_e' then `_M_a_k_e_f_i_l_e' in order to find 17 the specifications. If the file `_._d_e_p_e_n_d' exists, it is read (see 18 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. 23 24 bbmmaakkee will prepend the contents of the _M_A_K_E_F_L_A_G_S environment variable to 25 the 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 executing the commands to make the sources of a 31 dependency line in 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 any- 35 thing else. If multiple --CC options are specified, each is inter- 36 preted relative to the previous one: --CC _/ --CC _e_t_c is equivalent to 37 --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 context. 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 _M_A_K_E_F_L_A_G_S environment variable and will 46 be processed by any child make processes. By default, debugging 47 information is printed to standard error, but this can be changed 48 using the _F 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, then the standard out- 51 put is line buffered. _F_l_a_g_s is one or more of the following: 52 53 _A Print all possible debugging information; equivalent to 54 specifying all of the debugging flags. 55 56 _a Print debugging information about archive searching and 57 caching. 58 59 _C Print debugging information about current working direc- 60 tory. 61 62 _c Print debugging information about conditional evaluation. 63 64 _d Print debugging information about directory searching and 65 caching. 66 67 _e Print debugging information about failed commands and 68 targets. 69 70 _F[++]_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 `F' 74 flag is `+', then the file will be opened in append mode; 75 otherwise the file will be overwritten. If the file name 76 is `stdout' or `stderr' then debugging output will be 77 written to the standard output or standard error output 78 file descriptors respectively (and the `+' option has no 79 effect). Otherwise, the output will be written to the 80 named file. If the file name ends `.%d' then the `%d' is 81 replaced by the pid. 82 83 _f Print debugging information about loop evaluation. 84 85 _g_1 Print the input graph before making anything. 86 87 _g_2 Print the input graph after making everything, or before 88 exiting on error. 89 90 _g_3 Print the input graph before exiting on error. 91 92 _j Print debugging information about running multiple 93 shells. 94 95 _l Print commands in Makefiles regardless of whether or not 96 they are prefixed by `@' or other "quiet" flags. Also 97 known as "loud" behavior. 98 99 _M Print debugging information about "meta" mode decisions 100 about targets. 101 102 _m Print debugging information about making targets, includ- 103 ing modification dates. 104 105 _n Don't delete the temporary command scripts created when 106 running commands. These temporary scripts are created in 107 the directory referred to by the TMPDIR environment vari- 108 able, or in _/_t_m_p if TMPDIR is unset or set to the empty 109 string. The temporary scripts are created by mkstemp(3), 110 and have names of the form _m_a_k_e_X_X_X_X_X_X. _N_O_T_E: This can 111 create many files in TMPDIR or _/_t_m_p, so use with care. 112 113 _p Print debugging information about makefile parsing. 114 115 _s Print debugging information about suffix-transformation 116 rules. 117 118 _t Print debugging information about target list mainte- 119 nance. 120 121 _v Print debugging information about variable assignment. 122 123 _x Run shell commands with --xx so the actual commands are 124 printed as they are executed. 125 126 --ee Specify that environment variables override macro assignments 127 within makefiles. 128 129 --ff _m_a_k_e_f_i_l_e 130 Specify a makefile to read instead of the default `_m_a_k_e_f_i_l_e'. If 131 _m_a_k_e_f_i_l_e is `--', standard input is read. Multiple makefiles may 132 be specified, and are read in the order specified. 133 134 --II _d_i_r_e_c_t_o_r_y 135 Specify a directory in which to search for makefiles and included 136 makefiles. The system makefile directory (or directories, see 137 the --mm option) is automatically included as part of this list. 138 139 --ii Ignore non-zero exit of shell commands in the makefile. Equiva- 140 lent to specifying `--' before each command line in the makefile. 141 142 --JJ _p_r_i_v_a_t_e 143 This option should _n_o_t be specified by the user. 144 145 When the _j option is in use in a recursive build, this option is 146 passed by a make to child makes to allow all the make processes 147 in the build to cooperate to avoid overloading the system. 148 149 --jj _m_a_x___j_o_b_s 150 Specify the maximum number of jobs that bbmmaakkee may have running at 151 any one time. The value is saved in _._M_A_K_E_._J_O_B_S. Turns compati- 152 bility mode off, unless the _B flag is also specified. When com- 153 patibility mode is off, all commands associated with a target are 154 executed in a single shell invocation as opposed to the tradi- 155 tional one shell invocation per line. This can break traditional 156 scripts which change directories on each command invocation and 157 then expect to start with a fresh environment on the next line. 158 It is more efficient to correct the scripts rather than turn 159 backwards compatibility on. 160 161 --kk Continue processing after errors are encountered, but only on 162 those targets that do not depend on the target whose creation 163 caused the error. 164 165 --mm _d_i_r_e_c_t_o_r_y 166 Specify a directory in which to search for sys.mk and makefiles 167 included via the <_f_i_l_e>-style include statement. The --mm option 168 can be used multiple times to form a search path. This path will 169 override the default system include path: /usr/share/mk. Fur- 170 thermore the system include path will be appended to the search 171 path used for "_f_i_l_e"-style include statements (see the --II 172 option). 173 174 If a file or directory name in the --mm argument (or the 175 MAKESYSPATH environment variable) starts with the string ".../" 176 then bbmmaakkee will search for the specified file or directory named 177 in the remaining part of the argument string. The search starts 178 with the current directory of the Makefile and then works upward 179 towards the root of the filesystem. If the search is successful, 180 then the resulting directory replaces the ".../" specification in 181 the --mm argument. If used, this feature allows bbmmaakkee to easily 182 search in the current source tree for customized sys.mk files 183 (e.g., by using ".../mk/sys.mk" as an argument). 184 185 --nn Display the commands that would have been executed, but do not 186 actually execute them unless the target depends on the .MAKE spe- 187 cial source (see below). 188 189 --NN Display the commands which would have been executed, but do not 190 actually execute any of them; useful for debugging top-level 191 makefiles without descending into subdirectories. 192 193 --qq Do not execute any commands, but exit 0 if the specified targets 194 are up-to-date and 1, otherwise. 195 196 --rr Do not use the built-in rules specified in the system makefile. 197 198 --ss Do not echo any commands as they are executed. Equivalent to 199 specifying `@@' before each command line in the makefile. 200 201 --TT _t_r_a_c_e_f_i_l_e 202 When used with the --jj flag, append a trace record to _t_r_a_c_e_f_i_l_e 203 for each job started and completed. 204 205 --tt Rather than re-building a target as specified in the makefile, 206 create it or update its modification time to make it appear up- 207 to-date. 208 209 --VV _v_a_r_i_a_b_l_e 210 Print bbmmaakkee's idea of the value of _v_a_r_i_a_b_l_e, in the global con- 211 text. Do not build any targets. Multiple instances of this 212 option may be specified; the variables will be printed one per 213 line, with a blank line for each null or undefined variable. If 214 _v_a_r_i_a_b_l_e contains a `$' then the value will be expanded before 215 printing. 216 217 --WW Treat any warnings during makefile parsing as errors. 218 219 --XX Don't export variables passed on the command line to the environ- 220 ment individually. Variables passed on the command line are 221 still exported via the _M_A_K_E_F_L_A_G_S environment variable. This 222 option may be useful on systems which have a small limit on the 223 size of command arguments. 224 225 _v_a_r_i_a_b_l_e_=_v_a_l_u_e 226 Set the value of the variable _v_a_r_i_a_b_l_e to _v_a_l_u_e. Normally, all 227 values passed on the command line are also exported to sub-makes 228 in the environment. The --XX flag disables this behavior. Vari- 229 able assignments should follow options for POSIX compatibility 230 but no ordering is enforced. 231 232 There are seven different types of lines in a makefile: file dependency 233 specifications, shell commands, variable assignments, include statements, 234 conditional directives, for loops, and comments. 235 236 In general, lines may be continued from one line to the next by ending 237 them with a backslash (`\'). The trailing newline character and initial 238 whitespace on the following line are compressed into a single space. 239 240FFIILLEE DDEEPPEENNDDEENNCCYY SSPPEECCIIFFIICCAATTIIOONNSS 241 Dependency lines consist of one or more targets, an operator, and zero or 242 more sources. This creates a relationship where the targets ``depend'' 243 on the sources and are usually created from them. The exact relationship 244 between the target and the source is determined by the operator that sep- 245 arates them. The three operators are as follows: 246 247 :: A target is considered out-of-date if its modification time is less 248 than those of any of its sources. Sources for a target accumulate 249 over dependency lines when this operator is used. The target is 250 removed if bbmmaakkee is interrupted. 251 252 !! Targets are always re-created, but not until all sources have been 253 examined and re-created as necessary. Sources for a target accumu- 254 late over dependency lines when this operator is used. The target 255 is removed if bbmmaakkee is interrupted. 256 257 :::: If no sources are specified, the target is always re-created. Oth- 258 erwise, a target is considered out-of-date if any of its sources 259 has been modified more recently than the target. Sources for a 260 target do not accumulate over dependency lines when this operator 261 is used. The target will not be removed if bbmmaakkee is interrupted. 262 263 Targets and sources may contain the shell wildcard values `?', `*', `[]', 264 and `{}'. The values `?', `*', and `[]' may only be used as part of the 265 final component of the target or source, and must be used to describe 266 existing files. The value `{}' need not necessarily be used to describe 267 existing files. Expansion is in directory order, not alphabetically as 268 done in the shell. 269 270SSHHEELLLL CCOOMMMMAANNDDSS 271 Each target may have associated with it a series of shell commands, nor- 272 mally used to create the target. Each of the commands in this script 273 _m_u_s_t be preceded by a tab. While any target may appear on a dependency 274 line, only one of these dependencies may be followed by a creation 275 script, unless the `::::' operator is used. 276 277 If the first characters of the command line are any combination of `@@', 278 `++', or `--', the command is treated specially. A `@@' causes the command 279 not to be echoed before it is executed. A `++' causes the command to be 280 executed even when --nn is given. This is similar to the effect of the 281 .MAKE special source, except that the effect can be limited to a single 282 line of a script. A `--' causes any non-zero exit status of the command 283 line to be ignored. 284 285VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS 286 Variables in make are much like variables in the shell, and, by tradi- 287 tion, consist of all upper-case letters. 288 289 VVaarriiaabbllee aassssiiggnnmmeenntt mmooddiiffiieerrss 290 The five operators that can be used to assign values to variables are as 291 follows: 292 293 == Assign the value to the variable. Any previous value is overrid- 294 den. 295 296 ++== Append the value to the current value of the variable. 297 298 ??== Assign the value to the variable if it is not already defined. 299 300 ::== Assign with expansion, i.e. expand the value before assigning it 301 to the variable. Normally, expansion is not done until the vari- 302 able is referenced. _N_O_T_E: References to undefined variables are 303 _n_o_t expanded. This can cause problems when variable modifiers 304 are used. 305 306 !!== Expand the value and pass it to the shell for execution and 307 assign the result to the variable. Any newlines in the result 308 are replaced with spaces. 309 310 Any white-space before the assigned _v_a_l_u_e is removed; if the value is 311 being appended, a single space is inserted between the previous contents 312 of the variable and the appended value. 313 314 Variables are expanded by surrounding the variable name with either curly 315 braces (`{}') or parentheses (`()') and preceding it with a dollar sign 316 (`$'). If the variable name contains only a single letter, the surround- 317 ing braces or parentheses are not required. This shorter form is not 318 recommended. 319 320 If the variable name contains a dollar, then the name itself is expanded 321 first. This allows almost arbitrary variable names, however names con- 322 taining dollar, braces, parenthesis, or whitespace are really best 323 avoided! 324 325 If the result of expanding a variable contains a dollar sign (`$') the 326 string is expanded again. 327 328 Variable substitution occurs at three distinct times, depending on where 329 the variable is being used. 330 331 1. Variables in dependency lines are expanded as the line is read. 332 333 2. Variables in shell commands are expanded when the shell command is 334 executed. 335 336 3. ``.for'' loop index variables are expanded on each loop iteration. 337 Note that other variables are not expanded inside loops so the fol- 338 lowing example code: 339 340 341 .for i in 1 2 3 342 a+= ${i} 343 j= ${i} 344 b+= ${j} 345 .endfor 346 347 all: 348 @echo ${a} 349 @echo ${b} 350 351 will print: 352 353 1 2 3 354 3 3 3 355 356 Because while ${a} contains ``1 2 3'' after the loop is executed, 357 ${b} contains ``${j} ${j} ${j}'' which expands to ``3 3 3'' since 358 after the loop completes ${j} contains ``3''. 359 360 VVaarriiaabbllee ccllaasssseess 361 The four different classes of variables (in order of increasing prece- 362 dence) are: 363 364 Environment variables 365 Variables defined as part of bbmmaakkee's environment. 366 367 Global variables 368 Variables defined in the makefile or in included makefiles. 369 370 Command line variables 371 Variables defined as part of the command line. 372 373 Local variables 374 Variables that are defined specific to a certain target. The 375 seven local variables are as follows: 376 377 _._A_L_L_S_R_C The list of all sources for this target; also known as 378 `_>'. 379 380 _._A_R_C_H_I_V_E The name of the archive file. 381 382 _._I_M_P_S_R_C In suffix-transformation rules, the name/path of the 383 source from which the target is to be transformed (the 384 ``implied'' source); also known as `_<'. It is not 385 defined in explicit rules. 386 387 _._M_E_M_B_E_R The name of the archive member. 388 389 _._O_O_D_A_T_E The list of sources for this target that were deemed 390 out-of-date; also known as `_?'. 391 392 _._P_R_E_F_I_X The file prefix of the target, containing only the file 393 portion, no suffix or preceding directory components; 394 also known as `_*'. 395 396 _._T_A_R_G_E_T The name of the target; also known as `_@'. 397 398 The shorter forms `_@', `_?', `_<', `_>', and `_*' are permitted for 399 backward compatibility with historical makefiles and are not rec- 400 ommended. The six variables `_@_F', `_@_D', `_<_F', `_<_D', `_*_F', and 401 `_*_D' are permitted for compatibility with AT&T System V UNIX 402 makefiles and are not recommended. 403 404 Four of the local variables may be used in sources on dependency 405 lines because they expand to the proper value for each target on 406 the line. These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E', 407 and `_._M_E_M_B_E_R'. 408 409 AAddddiittiioonnaall bbuuiilltt--iinn vvaarriiaabblleess 410 In addition, bbmmaakkee sets or knows about the following variables: 411 412 _$ A single dollar sign `$', i.e. `$$' expands to a single 413 dollar sign. 414 415 _._A_L_L_T_A_R_G_E_T_S The list of all targets encountered in the Makefile. If 416 evaluated during Makefile parsing, lists only those tar- 417 gets encountered thus far. 418 419 _._C_U_R_D_I_R A path to the directory where bbmmaakkee was executed. Refer 420 to the description of `PWD' for more details. 421 422 MAKE The name that bbmmaakkee was executed with (_a_r_g_v_[_0_]). For 423 compatibility bbmmaakkee also sets _._M_A_K_E with the same value. 424 The preferred variable to use is the environment variable 425 MAKE because it is more compatible with other versions of 426 bbmmaakkee and cannot be confused with the special target with 427 the same name. 428 429 _._M_A_K_E_._D_E_P_E_N_D_F_I_L_E 430 Names the makefile (default `_._d_e_p_e_n_d') from which gener- 431 ated dependencies are read. 432 433 _._M_A_K_E_._E_X_P_O_R_T_E_D The list of variables exported by bbmmaakkee. 434 435 _._M_A_K_E_._J_O_B_S The argument to the --jj option. 436 437 _._M_A_K_E_._J_O_B_._P_R_E_F_I_X 438 If bbmmaakkee is run with _j then output for each target is 439 prefixed with a token `--- target ---' the first part of 440 which can be controlled via _._M_A_K_E_._J_O_B_._P_R_E_F_I_X. 441 For example: 442 .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] 443 would produce tokens like `---make[1234] target ---' mak- 444 ing it easier to track the degree of parallelism being 445 achieved. 446 447 MAKEFLAGS The environment variable `MAKEFLAGS' may contain anything 448 that may be specified on bbmmaakkee's command line. Anything 449 specified on bbmmaakkee's command line is appended to the 450 `MAKEFLAGS' variable which is then entered into the envi- 451 ronment for all programs which bbmmaakkee executes. 452 453 _._M_A_K_E_._L_E_V_E_L The recursion depth of bbmmaakkee. The initial instance of 454 bbmmaakkee will be 0, and an incremented value is put into the 455 environment to be seen by the next generation. This 456 allows tests like: .if ${.MAKE.LEVEL} == 0 to protect 457 things which should only be evaluated in the initial 458 instance of bbmmaakkee. 459 460 _._M_A_K_E_._M_A_K_E_F_I_L_E___P_R_E_F_E_R_E_N_C_E 461 The ordered list of makefile names (default `_m_a_k_e_f_i_l_e', 462 `_M_a_k_e_f_i_l_e') that bbmmaakkee will look for. 463 464 _._M_A_K_E_._M_A_K_E_F_I_L_E_S 465 The list of makefiles read by bbmmaakkee, which is useful for 466 tracking dependencies. Each makefile is recorded only 467 once, regardless of the number of times read. 468 469 _._M_A_K_E_._M_O_D_E Processed after reading all makefiles. Can affect the 470 mode that bbmmaakkee runs in. It can contain a number of key- 471 words: 472 473 _c_o_m_p_a_t Like --BB, puts bbmmaakkee into "compat" mode. 474 475 _m_e_t_a Puts bbmmaakkee into "meta" mode, where meta files 476 are created for each target to capture the 477 command run, the output generated and if 478 filemon(4) is available, the system calls 479 which are of interest to bbmmaakkee. The captured 480 output can be very useful when diagnosing 481 errors. 482 483 _c_u_r_d_i_r_O_k_= _b_f Normally bbmmaakkee will not create .meta files 484 in `_._C_U_R_D_I_R'. This can be overridden by set- 485 ting _b_f to a value which represents True. 486 487 _e_n_v For debugging, it can be useful to inlcude 488 the environment in the .meta file. 489 490 _v_e_r_b_o_s_e If in "meta" mode, print a clue about the 491 target being built. This is useful if the 492 build is otherwise running silently. The 493 message printed the value of: 494 _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X. 495 496 _i_g_n_o_r_e_-_c_m_d Some makefiles have commands which are simply 497 not stable. This keyword causes them to be 498 ignored for determining whether a target is 499 out of date in "meta" mode. See also 500 ..NNOOMMEETTAA__CCMMPP. 501 502 _s_i_l_e_n_t_= _b_f If _b_f is True, when a .meta file is created, 503 mark the target ..SSIILLEENNTT. 504 505 _._M_A_K_E_._M_E_T_A_._B_A_I_L_I_W_I_C_K 506 In "meta" mode, provides a list of prefixes which match 507 the directories controlled by bbmmaakkee. If a file that was 508 generated outside of _._O_B_J_D_I_R but within said bailiwick is 509 missing, the current target is considered out-of-date. 510 511 _._M_A_K_E_._M_E_T_A_._C_R_E_A_T_E_D 512 In "meta" mode, this variable contains a list of all the 513 meta files updated. If not empty, it can be used to 514 trigger processing of _._M_A_K_E_._M_E_T_A_._F_I_L_E_S. 515 516 _._M_A_K_E_._M_E_T_A_._F_I_L_E_S 517 In "meta" mode, this variable contains a list of all the 518 meta files used (updated or not). This list can be used 519 to process the meta files to extract dependency informa- 520 tion. 521 522 _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X 523 Defines the message printed for each meta file updated in 524 "meta verbose" mode. The default value is: 525 Building ${.TARGET:H:tA}/${.TARGET:T} 526 527 _._M_A_K_E_O_V_E_R_R_I_D_E_S This variable is used to record the names of variables 528 assigned to on the command line, so that they may be 529 exported as part of `MAKEFLAGS'. This behaviour can be 530 disabled by assigning an empty value to `_._M_A_K_E_O_V_E_R_R_I_D_E_S' 531 within a makefile. Extra variables can be exported from 532 a makefile by appending their names to `_._M_A_K_E_O_V_E_R_R_I_D_E_S'. 533 `MAKEFLAGS' is re-exported whenever `_._M_A_K_E_O_V_E_R_R_I_D_E_S' is 534 modified. 535 536 _._M_A_K_E_._P_I_D The process-id of bbmmaakkee. 537 538 _._M_A_K_E_._P_P_I_D The parent process-id of bbmmaakkee. 539 540 _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R 541 When bbmmaakkee stops due to an error, it prints its name and 542 the value of `_._C_U_R_D_I_R' as well as the value of any vari- 543 ables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. 544 545 _._n_e_w_l_i_n_e This variable is simply assigned a newline character as 546 its value. This allows expansions using the ::@@ modifier 547 to put a newline between iterations of the loop rather 548 than a space. For example, the printing of 549 `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R' could be done as 550 ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}. 551 552 _._O_B_J_D_I_R A path to the directory where the targets are built. Its 553 value is determined by trying to chdir(2) to the follow- 554 ing directories in order and using the first match: 555 556 1. ${MAKEOBJDIRPREFIX}${.CURDIR} 557 558 (Only if `MAKEOBJDIRPREFIX' is set in the environ- 559 ment or on the command line.) 560 561 2. ${MAKEOBJDIR} 562 563 (Only if `MAKEOBJDIR' is set in the environment or 564 on the command line.) 565 566 3. ${.CURDIR}_/_o_b_j_.${MACHINE} 567 568 4. ${.CURDIR}_/_o_b_j 569 570 5. _/_u_s_r_/_o_b_j_/${.CURDIR} 571 572 6. ${.CURDIR} 573 574 Variable expansion is performed on the value before it's 575 used, so expressions such as 576 ${.CURDIR:S,^/usr/src,/var/obj,} 577 may be used. This is especially useful with 578 `MAKEOBJDIR'. 579 580 `_._O_B_J_D_I_R' may be modified in the makefile as a global 581 variable. In all cases, bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' 582 and set `PWD' to that directory before executing any tar- 583 gets. 584 585 _._P_A_R_S_E_D_I_R A path to the directory of the current `_M_a_k_e_f_i_l_e' being 586 parsed. 587 588 _._P_A_R_S_E_F_I_L_E The basename of the current `_M_a_k_e_f_i_l_e' being parsed. 589 This variable and `_._P_A_R_S_E_D_I_R' are both set only while the 590 `_M_a_k_e_f_i_l_e_s' are being parsed. If you want to retain 591 their current values, assign them to a variable using 592 assignment with expansion: (`::=='). 593 594 _._P_A_T_H A variable that represents the list of directories that 595 bbmmaakkee will search for files. The search list should be 596 updated using the target `_._P_A_T_H' rather than the vari- 597 able. 598 599 PWD Alternate path to the current directory. bbmmaakkee normally 600 sets `_._C_U_R_D_I_R' to the canonical path given by getcwd(3). 601 However, if the environment variable `PWD' is set and 602 gives a path to the current directory, then bbmmaakkee sets 603 `_._C_U_R_D_I_R' to the value of `PWD' instead. This behaviour 604 is disabled if `MAKEOBJDIRPREFIX' is set or `MAKEOBJDIR' 605 contains a variable transform. `PWD' is set to the value 606 of `_._O_B_J_D_I_R' for all programs which bbmmaakkee executes. 607 608 .TARGETS The list of targets explicitly specified on the command 609 line, if any. 610 611 VPATH Colon-separated (``:'') lists of directories that bbmmaakkee 612 will search for files. The variable is supported for 613 compatibility with old make programs only, use `_._P_A_T_H' 614 instead. 615 616 VVaarriiaabbllee mmooddiiffiieerrss 617 Variable expansion may be modified to select or modify each word of the 618 variable (where a ``word'' is white-space delimited sequence of charac- 619 ters). The general format of a variable expansion is as follows: 620 621 ${variable[:modifier[:...]]} 622 623 Each modifier begins with a colon, which may be escaped with a backslash 624 (`\'). 625 626 A set of modifiers can be specified via a variable, as follows: 627 628 modifier_variable=modifier[:...] 629 ${variable:${modifier_variable}[:...]} 630 631 In this case the first modifier in the modifier_variable does not start 632 with a colon, since that must appear in the referencing variable. If any 633 of the modifiers in the modifier_variable contain a dollar sign (`$'), 634 these must be doubled to avoid early expansion. 635 636 The supported modifiers are: 637 638 ::EE Replaces each word in the variable with its suffix. 639 640 ::HH Replaces each word in the variable with everything but the last com- 641 ponent. 642 643 ::MM_p_a_t_t_e_r_n 644 Select only those words that match _p_a_t_t_e_r_n. The standard shell 645 wildcard characters (`*', `?', and `[]') may be used. The wildcard 646 characters may be escaped with a backslash (`\'). 647 648 ::NN_p_a_t_t_e_r_n 649 This is identical to `::MM', but selects all words which do not match 650 _p_a_t_t_e_r_n. 651 652 ::OO Order every word in variable alphabetically. To sort words in 653 reverse order use the `::OO::[[--11....11]]' combination of modifiers. 654 655 ::OOxx Randomize words in variable. The results will be different each 656 time you are referring to the modified variable; use the assignment 657 with expansion (`::==') to prevent such behaviour. For example, 658 659 LIST= uno due tre quattro 660 RANDOM_LIST= ${LIST:Ox} 661 STATIC_RANDOM_LIST:= ${LIST:Ox} 662 663 all: 664 @echo "${RANDOM_LIST}" 665 @echo "${RANDOM_LIST}" 666 @echo "${STATIC_RANDOM_LIST}" 667 @echo "${STATIC_RANDOM_LIST}" 668 may produce output similar to: 669 670 quattro due tre uno 671 tre due quattro uno 672 due uno quattro tre 673 due uno quattro tre 674 675 ::QQ Quotes every shell meta-character in the variable, so that it can be 676 passed safely through recursive invocations of bbmmaakkee. 677 678 ::RR Replaces each word in the variable with everything but its suffix. 679 680 ::ggmmttiimmee 681 The value is a format string for strftime(3), using the current 682 gmtime(3). 683 684 ::hhaasshh 685 Compute a 32bit hash of the value and encode it as hex digits. 686 687 ::llooccaallttiimmee 688 The value is a format string for strftime(3), using the current 689 localtime(3). 690 691 ::ttAA Attempt to convert variable to an absolute path using realpath(3), 692 if that fails, the value is unchanged. 693 694 ::ttll Converts variable to lower-case letters. 695 696 ::ttss_c 697 Words in the variable are normally separated by a space on expan- 698 sion. This modifier sets the separator to the character _c. If _c is 699 omitted, then no separator is used. The common escapes (including 700 octal numeric codes), work as expected. 701 702 ::ttuu Converts variable to upper-case letters. 703 704 ::ttWW Causes the value to be treated as a single word (possibly containing 705 embedded white space). See also `::[[**]]'. 706 707 ::ttww Causes the value to be treated as a sequence of words delimited by 708 white space. See also `::[[@@]]'. 709 710 ::SS/_o_l_d___s_t_r_i_n_g/_n_e_w___s_t_r_i_n_g/[11ggWW] 711 Modify the first occurrence of _o_l_d___s_t_r_i_n_g in the variable's value, 712 replacing it with _n_e_w___s_t_r_i_n_g. If a `g' is appended to the last 713 slash of the pattern, all occurrences in each word are replaced. If 714 a `1' is appended to the last slash of the pattern, only the first 715 word is affected. If a `W' is appended to the last slash of the 716 pattern, then the value is treated as a single word (possibly con- 717 taining embedded white space). If _o_l_d___s_t_r_i_n_g begins with a caret 718 (`^'), _o_l_d___s_t_r_i_n_g is anchored at the beginning of each word. If 719 _o_l_d___s_t_r_i_n_g ends with a dollar sign (`$'), it is anchored at the end 720 of each word. Inside _n_e_w___s_t_r_i_n_g, an ampersand (`&') is replaced by 721 _o_l_d___s_t_r_i_n_g (without any `^' or `$'). Any character may be used as a 722 delimiter for the parts of the modifier string. The anchoring, 723 ampersand and delimiter characters may be escaped with a backslash 724 (`\'). 725 726 Variable expansion occurs in the normal fashion inside both 727 _o_l_d___s_t_r_i_n_g and _n_e_w___s_t_r_i_n_g with the single exception that a backslash 728 is used to prevent the expansion of a dollar sign (`$'), not a pre- 729 ceding dollar sign as is usual. 730 731 ::CC/_p_a_t_t_e_r_n/_r_e_p_l_a_c_e_m_e_n_t/[11ggWW] 732 The ::CC modifier is just like the ::SS modifier except that the old and 733 new strings, instead of being simple strings, are a regular expres- 734 sion (see regex(3)) string _p_a_t_t_e_r_n and an ed(1)-style string 735 _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 736 in each word of the value is substituted with _r_e_p_l_a_c_e_m_e_n_t. The `1' 737 modifier causes the substitution to apply to at most one word; the 738 `g' modifier causes the substitution to apply to as many instances 739 of the search pattern _p_a_t_t_e_r_n as occur in the word or words it is 740 found in; the `W' modifier causes the value to be treated as a sin- 741 gle word (possibly containing embedded white space). Note that `1' 742 and `g' are orthogonal; the former specifies whether multiple words 743 are potentially affected, the latter whether multiple substitutions 744 can potentially occur within each affected word. 745 746 ::TT Replaces each word in the variable with its last component. 747 748 ::uu Remove adjacent duplicate words (like uniq(1)). 749 750 ::??_t_r_u_e___s_t_r_i_n_g::_f_a_l_s_e___s_t_r_i_n_g 751 If the variable name (not its value), when parsed as a .if condi- 752 tional expression, evaluates to true, return as its value the 753 _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 754 name is used as the expression, :? must be the first modifier after 755 the variable name itself - which will, of course, usually contain 756 variable expansions. A common error is trying to use expressions 757 like 758 ${NUMBERS:M42:?match:no} 759 which actually tests defined(NUMBERS), to determine is any words 760 match "42" you need to use something like: 761 ${"${NUMBERS:M42}" != "":?match:no}. 762 763 _:_o_l_d___s_t_r_i_n_g_=_n_e_w___s_t_r_i_n_g 764 This is the AT&T System V UNIX style variable substitution. It must 765 be the last modifier specified. If _o_l_d___s_t_r_i_n_g or _n_e_w___s_t_r_i_n_g do not 766 contain the pattern matching character _% then it is assumed that 767 they are anchored at the end of each word, so only suffixes or 768 entire words may be replaced. Otherwise _% is the substring of 769 _o_l_d___s_t_r_i_n_g to be replaced in _n_e_w___s_t_r_i_n_g. 770 771 Variable expansion occurs in the normal fashion inside both 772 _o_l_d___s_t_r_i_n_g and _n_e_w___s_t_r_i_n_g with the single exception that a backslash 773 is used to prevent the expansion of a dollar sign (`$'), not a pre- 774 ceding dollar sign as is usual. 775 776 ::@@_t_e_m_p@@_s_t_r_i_n_g@@ 777 This is the loop expansion mechanism from the OSF Development Envi- 778 ronment (ODE) make. Unlike ..ffoorr loops expansion occurs at the time 779 of reference. Assign _t_e_m_p to each word in the variable and evaluate 780 _s_t_r_i_n_g. The ODE convention is that _t_e_m_p should start and end with a 781 period. For example. 782 ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} 783 784 However a single character varaiable is often more readable: 785 ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} 786 787 ::UU_n_e_w_v_a_l 788 If the variable is undefined _n_e_w_v_a_l is the value. If the variable 789 is defined, the existing value is returned. This is another ODE 790 make feature. It is handy for setting per-target CFLAGS for 791 instance: 792 ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}} 793 If a value is only required if the variable is undefined, use: 794 ${VAR:D:Unewval} 795 796 ::DD_n_e_w_v_a_l 797 If the variable is defined _n_e_w_v_a_l is the value. 798 799 ::LL The name of the variable is the value. 800 801 ::PP The path of the node which has the same name as the variable is the 802 value. If no such node exists or its path is null, then the name of 803 the variable is used. In order for this modifier to work, the name 804 (node) must at least have appeared on the rhs of a dependency. 805 806 ::!!_c_m_d!! 807 The output of running _c_m_d is the value. 808 809 ::sshh If the variable is non-empty it is run as a command and the output 810 becomes the new value. 811 812 ::::==_s_t_r 813 The variable is assigned the value _s_t_r after substitution. This 814 modifier and its variations are useful in obscure situations such as 815 wanting to set a variable when shell commands are being parsed. 816 These assignment modifiers always expand to nothing, so if appearing 817 in a rule line by themselves should be preceded with something to 818 keep bbmmaakkee happy. 819 820 The `::::' helps avoid false matches with the AT&T System V UNIX style 821 ::== modifier and since substitution always occurs the ::::== form is 822 vaguely appropriate. 823 824 ::::??==_s_t_r 825 As for ::::== but only if the variable does not already have a value. 826 827 ::::++==_s_t_r 828 Append _s_t_r to the variable. 829 830 ::::!!==_c_m_d 831 Assign the output of _c_m_d to the variable. 832 833 ::[[_r_a_n_g_e]] 834 Selects one or more words from the value, or performs other opera- 835 tions related to the way in which the value is divided into words. 836 837 Ordinarily, a value is treated as a sequence of words delimited by 838 white space. Some modifiers suppress this behaviour, causing a 839 value to be treated as a single word (possibly containing embedded 840 white space). An empty value, or a value that consists entirely of 841 white-space, is treated as a single word. For the purposes of the 842 `::[[]]' modifier, the words are indexed both forwards using positive 843 integers (where index 1 represents the first word), and backwards 844 using negative integers (where index -1 represents the last word). 845 846 The _r_a_n_g_e is subjected to variable expansion, and the expanded 847 result is then interpreted as follows: 848 849 _i_n_d_e_x Selects a single word from the value. 850 851 _s_t_a_r_t...._e_n_d 852 Selects all words from _s_t_a_r_t to _e_n_d, inclusive. For example, 853 `::[[22....--11]]' selects all words from the second word to the last 854 word. If _s_t_a_r_t is greater than _e_n_d, then the words are out- 855 put in reverse order. For example, `::[[--11....11]]' selects all 856 the words from last to first. 857 858 ** Causes subsequent modifiers to treat the value as a single 859 word (possibly containing embedded white space). Analogous 860 to the effect of "$*" in Bourne shell. 861 862 0 Means the same as `::[[**]]'. 863 864 @@ Causes subsequent modifiers to treat the value as a sequence 865 of words delimited by white space. Analogous to the effect 866 of "$@" in Bourne shell. 867 868 ## Returns the number of words in the value. 869 870IINNCCLLUUDDEE SSTTAATTEEMMEENNTTSS,, CCOONNDDIITTIIOONNAALLSS AANNDD FFOORR LLOOOOPPSS 871 Makefile inclusion, conditional structures and for loops reminiscent of 872 the C programming language are provided in bbmmaakkee. All such structures 873 are identified by a line beginning with a single dot (`.') character. 874 Files are included with either ..iinncclluuddee <_f_i_l_e> or ..iinncclluuddee "_f_i_l_e". Vari- 875 ables between the angle brackets or double quotes are expanded to form 876 the file name. If angle brackets are used, the included makefile is 877 expected to be in the system makefile directory. If double quotes are 878 used, the including makefile's directory and any directories specified 879 using the --II option are searched before the system makefile directory. 880 For compatibility with other versions of bbmmaakkee `include file ...' is also 881 accepted. If the include statement is written as ..--iinncclluuddee or as 882 ..ssiinncclluuddee then errors locating and/or opening include files are ignored. 883 884 Conditional expressions are also preceded by a single dot as the first 885 character of a line. The possible conditionals are as follows: 886 887 ..eerrrroorr _m_e_s_s_a_g_e 888 The message is printed along with the name of the makefile and 889 line number, then bbmmaakkee will exit. 890 891 ..eexxppoorrtt _v_a_r_i_a_b_l_e _._._. 892 Export the specified global variable. If no variable list is 893 provided, all globals are exported except for internal variables 894 (those that start with `.'). This is not affected by the --XX 895 flag, so should be used with caution. For compatibility with 896 other bbmmaakkee programs `export variable=value' is also accepted. 897 898 Appending a variable name to _._M_A_K_E_._E_X_P_O_R_T_E_D is equivalent to 899 exporting a variable. 900 901 ..eexxppoorrtt--eennvv _v_a_r_i_a_b_l_e _._._. 902 The same as `.export', except that the variable is not appended 903 to _._M_A_K_E_._E_X_P_O_R_T_E_D. This allows exporting a value to the environ- 904 ment which is different from that used by bbmmaakkee internally. 905 906 ..iinnffoo _m_e_s_s_a_g_e 907 The message is printed along with the name of the makefile and 908 line number. 909 910 ..uunnddeeff _v_a_r_i_a_b_l_e 911 Un-define the specified global variable. Only global variables 912 may be un-defined. 913 914 ..uunneexxppoorrtt _v_a_r_i_a_b_l_e _._._. 915 The opposite of `.export'. The specified global _v_a_r_i_a_b_l_e will be 916 removed from _._M_A_K_E_._E_X_P_O_R_T_E_D. If no variable list is provided, 917 all globals are unexported, and _._M_A_K_E_._E_X_P_O_R_T_E_D deleted. 918 919 ..uunneexxppoorrtt--eennvv 920 Unexport all globals previously exported and clear the environ- 921 ment inherited from the parent. This operation will cause a mem- 922 ory leak of the original environment, so should be used spar- 923 ingly. Testing for _._M_A_K_E_._L_E_V_E_L being 0, would make sense. Also 924 note that any variables which originated in the parent environ- 925 ment should be explicitly preserved if desired. For example: 926 927 .if ${.MAKE.LEVEL} == 0 928 PATH := ${PATH} 929 .unexport-env 930 .export PATH 931 .endif 932 933 Would result in an environment containing only `PATH', which is 934 the minimal useful environment. Actually `.MAKE.LEVEL' will also 935 be pushed into the new environment. 936 937 ..wwaarrnniinngg _m_e_s_s_a_g_e 938 The message prefixed by `_w_a_r_n_i_n_g_:' is printed along with the name 939 of the makefile and line number. 940 941 ..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 _._._.] 942 Test the value of an expression. 943 944 ..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 _._._.] 945 Test the value of a variable. 946 947 ..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 _._._.] 948 Test the value of a variable. 949 950 ..iiffmmaakkee [!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 951 Test the target being built. 952 953 ..iiffnnmmaakkee [!] _t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 954 Test the target being built. 955 956 ..eellssee Reverse the sense of the last conditional. 957 958 ..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 _._._.] 959 A combination of `..eellssee' followed by `..iiff'. 960 961 ..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 _._._.] 962 A combination of `..eellssee' followed by `..iiffddeeff'. 963 964 ..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 _._._.] 965 A combination of `..eellssee' followed by `..iiffnnddeeff'. 966 967 ..eelliiffmmaakkee [!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 968 A combination of `..eellssee' followed by `..iiffmmaakkee'. 969 970 ..eelliiffnnmmaakkee [!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 971 A combination of `..eellssee' followed by `..iiffnnmmaakkee'. 972 973 ..eennddiiff End the body of the conditional. 974 975 The _o_p_e_r_a_t_o_r may be any one of the following: 976 977 |||| Logical OR. 978 979 &&&& Logical AND; of higher precedence than ``||''. 980 981 As in C, bbmmaakkee will only evaluate a conditional as far as is necessary to 982 determine its value. Parentheses may be used to change the order of 983 evaluation. The boolean operator `!!' may be used to logically negate an 984 entire conditional. It is of higher precedence than `&&&&'. 985 986 The value of _e_x_p_r_e_s_s_i_o_n may be any of the following: 987 988 ddeeffiinneedd Takes a variable name as an argument and evaluates to true if 989 the variable has been defined. 990 991 mmaakkee Takes a target name as an argument and evaluates to true if the 992 target was specified as part of bbmmaakkee's command line or was 993 declared the default target (either implicitly or explicitly, 994 see _._M_A_I_N) before the line containing the conditional. 995 996 eemmppttyy Takes a variable, with possible modifiers, and evaluates to true 997 if the expansion of the variable would result in an empty 998 string. 999 1000 eexxiissttss Takes a file name as an argument and evaluates to true if the 1001 file exists. The file is searched for on the system search path 1002 (see _._P_A_T_H). 1003 1004 ttaarrggeett Takes a target name as an argument and evaluates to true if the 1005 target has been defined. 1006 1007 ccoommmmaannddss 1008 Takes a target name as an argument and evaluates to true if the 1009 target has been defined and has commands associated with it. 1010 1011 _E_x_p_r_e_s_s_i_o_n may also be an arithmetic or string comparison. Variable 1012 expansion is performed on both sides of the comparison, after which the 1013 integral values are compared. A value is interpreted as hexadecimal if 1014 it is preceded by 0x, otherwise it is decimal; octal numbers are not sup- 1015 ported. The standard C relational operators are all supported. If after 1016 variable expansion, either the left or right hand side of a `====' or `!!==' 1017 operator is not an integral value, then string comparison is performed 1018 between the expanded variables. If no relational operator is given, it 1019 is assumed that the expanded variable is being compared against 0 or an 1020 empty string in the case of a string comparison. 1021 1022 When bbmmaakkee is evaluating one of these conditional expressions, and it 1023 encounters a (white-space separated) word it doesn't recognize, either 1024 the ``make'' or ``defined'' expression is applied to it, depending on the 1025 form of the conditional. If the form is `..iiffddeeff', `..iiffnnddeeff', or `..iiff' 1026 the ``defined'' expression is applied. Similarly, if the form is 1027 `..iiffmmaakkee' or `..iiffnnmmaakkee, tthhee' ``make'' expression is applied. 1028 1029 If the conditional evaluates to true the parsing of the makefile contin- 1030 ues as before. If it evaluates to false, the following lines are 1031 skipped. In both cases this continues until a `..eellssee' or `..eennddiiff' is 1032 found. 1033 1034 For loops are typically used to apply a set of rules to a list of files. 1035 The syntax of a for loop is: 1036 1037 ..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 1038 <make-rules> 1039 ..eennddffoorr 1040 1041 After the for eexxpprreessssiioonn is evaluated, it is split into words. On each 1042 iteration of the loop, one word is taken and assigned to each vvaarriiaabbllee, 1043 in order, and these vvaarriiaabblleess are substituted into the mmaakkee--rruulleess inside 1044 the body of the for loop. The number of words must come out even; that 1045 is, if there are three iteration variables, the number of words provided 1046 must be a multiple of three. 1047 1048CCOOMMMMEENNTTSS 1049 Comments begin with a hash (`#') character, anywhere but in a shell com- 1050 mand line, and continue to the end of an unescaped new line. 1051 1052SSPPEECCIIAALL SSOOUURRCCEESS ((AATTTTRRIIBBUUTTEESS)) 1053 ..EEXXEECC Target is never out of date, but always execute commands any- 1054 way. 1055 1056 ..IIGGNNOORREE Ignore any errors from the commands associated with this tar- 1057 get, exactly as if they all were preceded by a dash (`-'). 1058 1059 ..MMAADDEE Mark all sources of this target as being up-to-date. 1060 1061 ..MMAAKKEE Execute the commands associated with this target even if the --nn 1062 or --tt options were specified. Normally used to mark recursive 1063 bbmmaakkee's. 1064 1065 ..MMEETTAA Create a meta file for the target, even if it is flagged as 1066 ..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL. Usage in conjunction with ..MMAAKKEE is 1067 the most likely case. In "meta" mode, the target is out-of- 1068 date if the meta file is missing. 1069 1070 ..NNOOMMEETTAA Do not create a meta file for the target. Meta files are also 1071 not created for ..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL targets. 1072 1073 ..NNOOMMEETTAA__CCMMPP 1074 Ignore differences in commands when deciding if target is out 1075 of date. This is useful if the command contains a value which 1076 always changes. If the number of commands change, though, the 1077 target will still be out of date. 1078 1079 ..NNOOPPAATTHH Do not search for the target in the directories specified by 1080 ..PPAATTHH. 1081 1082 ..NNOOTTMMAAIINN Normally bbmmaakkee selects the first target it encounters as the 1083 default target to be built if no target was specified. This 1084 source prevents this target from being selected. 1085 1086 ..OOPPTTIIOONNAALL 1087 If a target is marked with this attribute and bbmmaakkee can't fig- 1088 ure out how to create it, it will ignore this fact and assume 1089 the file isn't needed or already exists. 1090 1091 ..PPHHOONNYY The target does not correspond to an actual file; it is always 1092 considered to be out of date, and will not be created with the 1093 --tt option. Suffix-transformation rules are not applied to 1094 ..PPHHOONNYY targets. 1095 1096 ..PPRREECCIIOOUUSS 1097 When bbmmaakkee is interrupted, it normally removes any partially 1098 made targets. This source prevents the target from being 1099 removed. 1100 1101 ..RREECCUURRSSIIVVEE 1102 Synonym for ..MMAAKKEE. 1103 1104 ..SSIILLEENNTT Do not echo any of the commands associated with this target, 1105 exactly as if they all were preceded by an at sign (`@'). 1106 1107 ..UUSSEE Turn the target into bbmmaakkee's version of a macro. When the tar- 1108 get is used as a source for another target, the other target 1109 acquires the commands, sources, and attributes (except for 1110 ..UUSSEE) of the source. If the target already has commands, the 1111 ..UUSSEE target's commands are appended to them. 1112 1113 ..UUSSEEBBEEFFOORREE 1114 Exactly like ..UUSSEE, but prepend the ..UUSSEEBBEEFFOORREE target commands 1115 to the target. 1116 1117 ..WWAAIITT If ..WWAAIITT appears in a dependency line, the sources that precede 1118 it are made before the sources that succeed it in the line. 1119 Since the dependents of files are not made until the file 1120 itself could be made, this also stops the dependents being 1121 built unless they are needed for another branch of the depen- 1122 dency tree. So given: 1123 1124 x: a .WAIT b 1125 echo x 1126 a: 1127 echo a 1128 b: b1 1129 echo b 1130 b1: 1131 echo b1 1132 1133 the output is always `a', `b1', `b', `x'. 1134 The ordering imposed by ..WWAAIITT is only relevant for parallel 1135 makes. 1136 1137SSPPEECCIIAALL TTAARRGGEETTSS 1138 Special targets may not be included with other targets, i.e. they must be 1139 the only target specified. 1140 1141 ..BBEEGGIINN Any command lines attached to this target are executed before 1142 anything else is done. 1143 1144 ..DDEEFFAAUULLTT 1145 This is sort of a ..UUSSEE rule for any target (that was used only 1146 as a source) that bbmmaakkee can't figure out any other way to cre- 1147 ate. Only the shell script is used. The ..IIMMPPSSRRCC variable of a 1148 target that inherits ..DDEEFFAAUULLTT's commands is set to the target's 1149 own name. 1150 1151 ..EENNDD Any command lines attached to this target are executed after 1152 everything else is done. 1153 1154 ..EERRRROORR Any command lines attached to this target are executed when 1155 another target fails. The ..EERRRROORR__TTAARRGGEETT variable is set to the 1156 target that failed. See also MMAAKKEE__PPRRIINNTT__VVAARR__OONN__EERRRROORR. 1157 1158 ..IIGGNNOORREE Mark each of the sources with the ..IIGGNNOORREE attribute. If no 1159 sources are specified, this is the equivalent of specifying the 1160 --ii option. 1161 1162 ..IINNTTEERRRRUUPPTT 1163 If bbmmaakkee is interrupted, the commands for this target will be 1164 executed. 1165 1166 ..MMAAIINN If no target is specified when bbmmaakkee is invoked, this target 1167 will be built. 1168 1169 ..MMAAKKEEFFLLAAGGSS 1170 This target provides a way to specify flags for bbmmaakkee when the 1171 makefile is used. The flags are as if typed to the shell, 1172 though the --ff option will have no effect. 1173 1174 ..NNOOPPAATTHH Apply the ..NNOOPPAATTHH attribute to any specified sources. 1175 1176 ..NNOOTTPPAARRAALLLLEELL 1177 Disable parallel mode. 1178 1179 ..NNOO__PPAARRAALLLLEELL 1180 Synonym for ..NNOOTTPPAARRAALLLLEELL, for compatibility with other pmake 1181 variants. 1182 1183 ..OORRDDEERR The named targets are made in sequence. This ordering does not 1184 add targets to the list of targets to be made. Since the depen- 1185 dents of a target do not get built until the target itself could 1186 be built, unless `a' is built by another part of the dependency 1187 graph, the following is a dependency loop: 1188 1189 .ORDER: b a 1190 b: a 1191 1192 The ordering imposed by ..OORRDDEERR is only relevant for parallel 1193 makes. 1194 1195 ..PPAATTHH The sources are directories which are to be searched for files 1196 not found in the current directory. If no sources are speci- 1197 fied, any previously specified directories are deleted. If the 1198 source is the special ..DDOOTTLLAASSTT target, then the current working 1199 directory is searched last. 1200 1201 ..PPHHOONNYY Apply the ..PPHHOONNYY attribute to any specified sources. 1202 1203 ..PPRREECCIIOOUUSS 1204 Apply the ..PPRREECCIIOOUUSS attribute to any specified sources. If no 1205 sources are specified, the ..PPRREECCIIOOUUSS attribute is applied to 1206 every target in the file. 1207 1208 ..SSHHEELLLL Sets the shell that bbmmaakkee will use to execute commands. The 1209 sources are a set of _f_i_e_l_d_=_v_a_l_u_e pairs. 1210 1211 _n_a_m_e This is the minimal specification, used to select 1212 one of the builtin shell specs; _s_h, _k_s_h, and _c_s_h. 1213 1214 _p_a_t_h Specifies the path to the shell. 1215 1216 _h_a_s_E_r_r_C_t_l Indicates whether the shell supports exit on error. 1217 1218 _c_h_e_c_k The command to turn on error checking. 1219 1220 _i_g_n_o_r_e The command to disable error checking. 1221 1222 _e_c_h_o The command to turn on echoing of commands executed. 1223 1224 _q_u_i_e_t The command to turn off echoing of commands exe- 1225 cuted. 1226 1227 _f_i_l_t_e_r The output to filter after issuing the _q_u_i_e_t com- 1228 mand. It is typically identical to _q_u_i_e_t. 1229 1230 _e_r_r_F_l_a_g The flag to pass the shell to enable error checking. 1231 1232 _e_c_h_o_F_l_a_g The flag to pass the shell to enable command echo- 1233 ing. 1234 1235 _n_e_w_l_i_n_e The string literal to pass the shell that results in 1236 a single newline character when used outside of any 1237 quoting characters. 1238 Example: 1239 1240 .SHELL: name=ksh path=/bin/ksh hasErrCtl=true \ 1241 check="set -e" ignore="set +e" \ 1242 echo="set -v" quiet="set +v" filter="set +v" \ 1243 echoFlag=v errFlag=e newline="'\n'" 1244 1245 ..SSIILLEENNTT Apply the ..SSIILLEENNTT attribute to any specified sources. If no 1246 sources are specified, the ..SSIILLEENNTT attribute is applied to every 1247 command in the file. 1248 1249 ..SSUUFFFFIIXXEESS 1250 Each source specifies a suffix to bbmmaakkee. If no sources are 1251 specified, any previously specified suffixes are deleted. It 1252 allows the creation of suffix-transformation rules. 1253 1254 Example: 1255 1256 .SUFFIXES: .o 1257 .c.o: 1258 cc -o ${.TARGET} -c ${.IMPSRC} 1259 1260EENNVVIIRROONNMMEENNTT 1261 bbmmaakkee uses the following environment variables, if they exist: MACHINE, 1262 MACHINE_ARCH, MAKE, MAKEFLAGS, MAKEOBJDIR, MAKEOBJDIRPREFIX, MAKESYSPATH, 1263 PWD, and TMPDIR. 1264 1265 MAKEOBJDIRPREFIX and MAKEOBJDIR may only be set in the environment or on 1266 the command line to bbmmaakkee and not as makefile variables; see the descrip- 1267 tion of `_._O_B_J_D_I_R' for more details. 1268 1269FFIILLEESS 1270 .depend list of dependencies 1271 Makefile list of dependencies 1272 makefile list of dependencies 1273 sys.mk system makefile 1274 /usr/share/mk system makefile directory 1275 1276CCOOMMPPAATTIIBBIILLIITTYY 1277 The basic make syntax is compatible between different versions of make, 1278 however the special variables, variable modifiers and conditionals are 1279 not. 1280 1281 The way that parallel makes are scheduled changed in NetBSD 4.0 so that 1282 .ORDER and .WAIT apply recursively to the dependent nodes. The algo- 1283 rithms used may change again in the future. 1284 1285 The way that .for loop variables are substituted changed after NetBSD 5.0 1286 so that they still appear to be variable expansions. In particular this 1287 stops them being treated as syntax, and removes some obscure problems 1288 using them in .if statements. 1289 1290 Unlike other bbmmaakkee programs, this implementation by default executes all 1291 commands for a given target using a single shell invocation. This is 1292 done for both efficiency and to simplify error handling in remote command 1293 invocations. Typically this is transparent to the user, unless the tar- 1294 get commands change the current working directory using ``cd'' or 1295 ``chdir''. To be compatible with Makefiles that do this, one can use --BB 1296 to disable this behavior. 1297 1298SSEEEE AALLSSOO 1299 mkdep(1) 1300 1301HHIISSTTOORRYY 1302 bbmmaakkee is derived from NetBSD make(1). It uses autoconf to facilitate 1303 portability to other platforms. 1304 1305NetBSD 5.1 April 24, 2012 NetBSD 5.1 1306