bmake.cat1 revision 240330
1236769SobrienMAKE(1) NetBSD General Commands Manual MAKE(1) 2236769Sobrien 3236769SobrienNNAAMMEE 4236769Sobrien bbmmaakkee -- maintain program dependencies 5236769Sobrien 6236769SobrienSSYYNNOOPPSSIISS 7236769Sobrien 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] 8236769Sobrien [--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] 9236769Sobrien [--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] 10236769Sobrien [_t_a_r_g_e_t _._._.] 11236769Sobrien 12236769SobrienDDEESSCCRRIIPPTTIIOONN 13236769Sobrien bbmmaakkee is a program designed to simplify the maintenance of other pro- 14236769Sobrien grams. Its input is a list of specifications as to the files upon which 15236769Sobrien programs and other files depend. If no --ff _m_a_k_e_f_i_l_e makefile option is 16236769Sobrien 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 17236769Sobrien the specifications. If the file `_._d_e_p_e_n_d' exists, it is read (see 18236769Sobrien mkdep(1)). 19236769Sobrien 20236769Sobrien This manual page is intended as a reference document only. For a more 21236769Sobrien thorough description of bbmmaakkee and makefiles, please refer to _P_M_a_k_e _- _A 22236769Sobrien _T_u_t_o_r_i_a_l. 23236769Sobrien 24236769Sobrien bbmmaakkee will prepend the contents of the _M_A_K_E_F_L_A_G_S environment variable to 25236769Sobrien the command line arguments before parsing them. 26236769Sobrien 27236769Sobrien The options are as follows: 28236769Sobrien 29236769Sobrien --BB Try to be backwards compatible by executing a single shell per 30236769Sobrien command and by executing the commands to make the sources of a 31236769Sobrien dependency line in sequence. 32236769Sobrien 33236769Sobrien --CC _d_i_r_e_c_t_o_r_y 34236769Sobrien Change to _d_i_r_e_c_t_o_r_y before reading the makefiles or doing any- 35236769Sobrien thing else. If multiple --CC options are specified, each is inter- 36236769Sobrien preted relative to the previous one: --CC _/ --CC _e_t_c is equivalent to 37236769Sobrien --CC _/_e_t_c. 38236769Sobrien 39236769Sobrien --DD _v_a_r_i_a_b_l_e 40236769Sobrien Define _v_a_r_i_a_b_l_e to be 1, in the global context. 41236769Sobrien 42236769Sobrien --dd _[_-_]_f_l_a_g_s 43236769Sobrien Turn on debugging, and specify which portions of bbmmaakkee are to 44236769Sobrien print debugging information. Unless the flags are preceded by 45236769Sobrien `-' they are added to the _M_A_K_E_F_L_A_G_S environment variable and will 46236769Sobrien be processed by any child make processes. By default, debugging 47236769Sobrien information is printed to standard error, but this can be changed 48236769Sobrien using the _F debugging flag. The debugging output is always 49236769Sobrien unbuffered; in addition, if debugging is enabled but debugging 50236769Sobrien output is not directed to standard output, then the standard out- 51236769Sobrien put is line buffered. _F_l_a_g_s is one or more of the following: 52236769Sobrien 53236769Sobrien _A Print all possible debugging information; equivalent to 54236769Sobrien specifying all of the debugging flags. 55236769Sobrien 56236769Sobrien _a Print debugging information about archive searching and 57236769Sobrien caching. 58236769Sobrien 59236769Sobrien _C Print debugging information about current working direc- 60236769Sobrien tory. 61236769Sobrien 62236769Sobrien _c Print debugging information about conditional evaluation. 63236769Sobrien 64236769Sobrien _d Print debugging information about directory searching and 65236769Sobrien caching. 66236769Sobrien 67236769Sobrien _e Print debugging information about failed commands and 68236769Sobrien targets. 69236769Sobrien 70236769Sobrien _F[++]_f_i_l_e_n_a_m_e 71236769Sobrien Specify where debugging output is written. This must be 72236769Sobrien the last flag, because it consumes the remainder of the 73236769Sobrien argument. If the character immediately after the `F' 74236769Sobrien flag is `+', then the file will be opened in append mode; 75236769Sobrien otherwise the file will be overwritten. If the file name 76236769Sobrien is `stdout' or `stderr' then debugging output will be 77236769Sobrien written to the standard output or standard error output 78236769Sobrien file descriptors respectively (and the `+' option has no 79236769Sobrien effect). Otherwise, the output will be written to the 80236769Sobrien named file. If the file name ends `.%d' then the `%d' is 81236769Sobrien replaced by the pid. 82236769Sobrien 83236769Sobrien _f Print debugging information about loop evaluation. 84236769Sobrien 85236769Sobrien _g_1 Print the input graph before making anything. 86236769Sobrien 87236769Sobrien _g_2 Print the input graph after making everything, or before 88236769Sobrien exiting on error. 89236769Sobrien 90236769Sobrien _g_3 Print the input graph before exiting on error. 91236769Sobrien 92236769Sobrien _j Print debugging information about running multiple 93236769Sobrien shells. 94236769Sobrien 95236769Sobrien _l Print commands in Makefiles regardless of whether or not 96236769Sobrien they are prefixed by `@' or other "quiet" flags. Also 97236769Sobrien known as "loud" behavior. 98236769Sobrien 99236769Sobrien _M Print debugging information about "meta" mode decisions 100236769Sobrien about targets. 101236769Sobrien 102236769Sobrien _m Print debugging information about making targets, includ- 103236769Sobrien ing modification dates. 104236769Sobrien 105236769Sobrien _n Don't delete the temporary command scripts created when 106236769Sobrien running commands. These temporary scripts are created in 107236769Sobrien the directory referred to by the TMPDIR environment vari- 108236769Sobrien able, or in _/_t_m_p if TMPDIR is unset or set to the empty 109236769Sobrien string. The temporary scripts are created by mkstemp(3), 110236769Sobrien and have names of the form _m_a_k_e_X_X_X_X_X_X. _N_O_T_E: This can 111236769Sobrien create many files in TMPDIR or _/_t_m_p, so use with care. 112236769Sobrien 113236769Sobrien _p Print debugging information about makefile parsing. 114236769Sobrien 115236769Sobrien _s Print debugging information about suffix-transformation 116236769Sobrien rules. 117236769Sobrien 118236769Sobrien _t Print debugging information about target list mainte- 119236769Sobrien nance. 120236769Sobrien 121240330Smarcel _V Force the --VV option to print raw values of variables. 122240330Smarcel 123236769Sobrien _v Print debugging information about variable assignment. 124236769Sobrien 125236769Sobrien _x Run shell commands with --xx so the actual commands are 126236769Sobrien printed as they are executed. 127236769Sobrien 128236769Sobrien --ee Specify that environment variables override macro assignments 129236769Sobrien within makefiles. 130236769Sobrien 131236769Sobrien --ff _m_a_k_e_f_i_l_e 132236769Sobrien Specify a makefile to read instead of the default `_m_a_k_e_f_i_l_e'. If 133236769Sobrien _m_a_k_e_f_i_l_e is `--', standard input is read. Multiple makefiles may 134236769Sobrien be specified, and are read in the order specified. 135236769Sobrien 136236769Sobrien --II _d_i_r_e_c_t_o_r_y 137236769Sobrien Specify a directory in which to search for makefiles and included 138236769Sobrien makefiles. The system makefile directory (or directories, see 139236769Sobrien the --mm option) is automatically included as part of this list. 140236769Sobrien 141236769Sobrien --ii Ignore non-zero exit of shell commands in the makefile. Equiva- 142236769Sobrien lent to specifying `--' before each command line in the makefile. 143236769Sobrien 144236769Sobrien --JJ _p_r_i_v_a_t_e 145236769Sobrien This option should _n_o_t be specified by the user. 146236769Sobrien 147236769Sobrien When the _j option is in use in a recursive build, this option is 148236769Sobrien passed by a make to child makes to allow all the make processes 149236769Sobrien in the build to cooperate to avoid overloading the system. 150236769Sobrien 151236769Sobrien --jj _m_a_x___j_o_b_s 152236769Sobrien Specify the maximum number of jobs that bbmmaakkee may have running at 153236769Sobrien any one time. The value is saved in _._M_A_K_E_._J_O_B_S. Turns compati- 154236769Sobrien bility mode off, unless the _B flag is also specified. When com- 155236769Sobrien patibility mode is off, all commands associated with a target are 156236769Sobrien executed in a single shell invocation as opposed to the tradi- 157236769Sobrien tional one shell invocation per line. This can break traditional 158236769Sobrien scripts which change directories on each command invocation and 159236769Sobrien then expect to start with a fresh environment on the next line. 160236769Sobrien It is more efficient to correct the scripts rather than turn 161236769Sobrien backwards compatibility on. 162236769Sobrien 163236769Sobrien --kk Continue processing after errors are encountered, but only on 164236769Sobrien those targets that do not depend on the target whose creation 165236769Sobrien caused the error. 166236769Sobrien 167236769Sobrien --mm _d_i_r_e_c_t_o_r_y 168236769Sobrien Specify a directory in which to search for sys.mk and makefiles 169236769Sobrien included via the <_f_i_l_e>-style include statement. The --mm option 170236769Sobrien can be used multiple times to form a search path. This path will 171236769Sobrien override the default system include path: /usr/share/mk. Fur- 172236769Sobrien thermore the system include path will be appended to the search 173236769Sobrien path used for "_f_i_l_e"-style include statements (see the --II 174236769Sobrien option). 175236769Sobrien 176236769Sobrien If a file or directory name in the --mm argument (or the 177236769Sobrien MAKESYSPATH environment variable) starts with the string ".../" 178236769Sobrien then bbmmaakkee will search for the specified file or directory named 179236769Sobrien in the remaining part of the argument string. The search starts 180236769Sobrien with the current directory of the Makefile and then works upward 181236769Sobrien towards the root of the filesystem. If the search is successful, 182236769Sobrien then the resulting directory replaces the ".../" specification in 183236769Sobrien the --mm argument. If used, this feature allows bbmmaakkee to easily 184236769Sobrien search in the current source tree for customized sys.mk files 185236769Sobrien (e.g., by using ".../mk/sys.mk" as an argument). 186236769Sobrien 187236769Sobrien --nn Display the commands that would have been executed, but do not 188236769Sobrien actually execute them unless the target depends on the .MAKE spe- 189236769Sobrien cial source (see below). 190236769Sobrien 191236769Sobrien --NN Display the commands which would have been executed, but do not 192236769Sobrien actually execute any of them; useful for debugging top-level 193236769Sobrien makefiles without descending into subdirectories. 194236769Sobrien 195236769Sobrien --qq Do not execute any commands, but exit 0 if the specified targets 196236769Sobrien are up-to-date and 1, otherwise. 197236769Sobrien 198236769Sobrien --rr Do not use the built-in rules specified in the system makefile. 199236769Sobrien 200236769Sobrien --ss Do not echo any commands as they are executed. Equivalent to 201236769Sobrien specifying `@@' before each command line in the makefile. 202236769Sobrien 203236769Sobrien --TT _t_r_a_c_e_f_i_l_e 204236769Sobrien When used with the --jj flag, append a trace record to _t_r_a_c_e_f_i_l_e 205236769Sobrien for each job started and completed. 206236769Sobrien 207236769Sobrien --tt Rather than re-building a target as specified in the makefile, 208236769Sobrien create it or update its modification time to make it appear up- 209236769Sobrien to-date. 210236769Sobrien 211236769Sobrien --VV _v_a_r_i_a_b_l_e 212236769Sobrien Print bbmmaakkee's idea of the value of _v_a_r_i_a_b_l_e, in the global con- 213236769Sobrien text. Do not build any targets. Multiple instances of this 214236769Sobrien option may be specified; the variables will be printed one per 215236769Sobrien line, with a blank line for each null or undefined variable. If 216236769Sobrien _v_a_r_i_a_b_l_e contains a `$' then the value will be expanded before 217236769Sobrien printing. 218236769Sobrien 219236769Sobrien --WW Treat any warnings during makefile parsing as errors. 220236769Sobrien 221236769Sobrien --XX Don't export variables passed on the command line to the environ- 222236769Sobrien ment individually. Variables passed on the command line are 223236769Sobrien still exported via the _M_A_K_E_F_L_A_G_S environment variable. This 224236769Sobrien option may be useful on systems which have a small limit on the 225236769Sobrien size of command arguments. 226236769Sobrien 227236769Sobrien _v_a_r_i_a_b_l_e_=_v_a_l_u_e 228236769Sobrien Set the value of the variable _v_a_r_i_a_b_l_e to _v_a_l_u_e. Normally, all 229236769Sobrien values passed on the command line are also exported to sub-makes 230236769Sobrien in the environment. The --XX flag disables this behavior. Vari- 231236769Sobrien able assignments should follow options for POSIX compatibility 232236769Sobrien but no ordering is enforced. 233236769Sobrien 234236769Sobrien There are seven different types of lines in a makefile: file dependency 235236769Sobrien specifications, shell commands, variable assignments, include statements, 236236769Sobrien conditional directives, for loops, and comments. 237236769Sobrien 238236769Sobrien In general, lines may be continued from one line to the next by ending 239236769Sobrien them with a backslash (`\'). The trailing newline character and initial 240236769Sobrien whitespace on the following line are compressed into a single space. 241236769Sobrien 242236769SobrienFFIILLEE DDEEPPEENNDDEENNCCYY SSPPEECCIIFFIICCAATTIIOONNSS 243236769Sobrien Dependency lines consist of one or more targets, an operator, and zero or 244236769Sobrien more sources. This creates a relationship where the targets ``depend'' 245236769Sobrien on the sources and are usually created from them. The exact relationship 246236769Sobrien between the target and the source is determined by the operator that sep- 247236769Sobrien arates them. The three operators are as follows: 248236769Sobrien 249236769Sobrien :: A target is considered out-of-date if its modification time is less 250236769Sobrien than those of any of its sources. Sources for a target accumulate 251236769Sobrien over dependency lines when this operator is used. The target is 252236769Sobrien removed if bbmmaakkee is interrupted. 253236769Sobrien 254236769Sobrien !! Targets are always re-created, but not until all sources have been 255236769Sobrien examined and re-created as necessary. Sources for a target accumu- 256236769Sobrien late over dependency lines when this operator is used. The target 257236769Sobrien is removed if bbmmaakkee is interrupted. 258236769Sobrien 259236769Sobrien :::: If no sources are specified, the target is always re-created. Oth- 260236769Sobrien erwise, a target is considered out-of-date if any of its sources 261236769Sobrien has been modified more recently than the target. Sources for a 262236769Sobrien target do not accumulate over dependency lines when this operator 263236769Sobrien is used. The target will not be removed if bbmmaakkee is interrupted. 264236769Sobrien 265236769Sobrien Targets and sources may contain the shell wildcard values `?', `*', `[]', 266236769Sobrien and `{}'. The values `?', `*', and `[]' may only be used as part of the 267236769Sobrien final component of the target or source, and must be used to describe 268236769Sobrien existing files. The value `{}' need not necessarily be used to describe 269236769Sobrien existing files. Expansion is in directory order, not alphabetically as 270236769Sobrien done in the shell. 271236769Sobrien 272236769SobrienSSHHEELLLL CCOOMMMMAANNDDSS 273236769Sobrien Each target may have associated with it a series of shell commands, nor- 274236769Sobrien mally used to create the target. Each of the commands in this script 275236769Sobrien _m_u_s_t be preceded by a tab. While any target may appear on a dependency 276236769Sobrien line, only one of these dependencies may be followed by a creation 277236769Sobrien script, unless the `::::' operator is used. 278236769Sobrien 279236769Sobrien If the first characters of the command line are any combination of `@@', 280236769Sobrien `++', or `--', the command is treated specially. A `@@' causes the command 281236769Sobrien not to be echoed before it is executed. A `++' causes the command to be 282236769Sobrien executed even when --nn is given. This is similar to the effect of the 283236769Sobrien .MAKE special source, except that the effect can be limited to a single 284236769Sobrien line of a script. A `--' causes any non-zero exit status of the command 285236769Sobrien line to be ignored. 286236769Sobrien 287236769SobrienVVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS 288236769Sobrien Variables in make are much like variables in the shell, and, by tradi- 289236769Sobrien tion, consist of all upper-case letters. 290236769Sobrien 291236769Sobrien VVaarriiaabbllee aassssiiggnnmmeenntt mmooddiiffiieerrss 292236769Sobrien The five operators that can be used to assign values to variables are as 293236769Sobrien follows: 294236769Sobrien 295236769Sobrien == Assign the value to the variable. Any previous value is overrid- 296236769Sobrien den. 297236769Sobrien 298236769Sobrien ++== Append the value to the current value of the variable. 299236769Sobrien 300236769Sobrien ??== Assign the value to the variable if it is not already defined. 301236769Sobrien 302236769Sobrien ::== Assign with expansion, i.e. expand the value before assigning it 303236769Sobrien to the variable. Normally, expansion is not done until the vari- 304236769Sobrien able is referenced. _N_O_T_E: References to undefined variables are 305236769Sobrien _n_o_t expanded. This can cause problems when variable modifiers 306236769Sobrien are used. 307236769Sobrien 308236769Sobrien !!== Expand the value and pass it to the shell for execution and 309236769Sobrien assign the result to the variable. Any newlines in the result 310236769Sobrien are replaced with spaces. 311236769Sobrien 312236769Sobrien Any white-space before the assigned _v_a_l_u_e is removed; if the value is 313236769Sobrien being appended, a single space is inserted between the previous contents 314236769Sobrien of the variable and the appended value. 315236769Sobrien 316236769Sobrien Variables are expanded by surrounding the variable name with either curly 317236769Sobrien braces (`{}') or parentheses (`()') and preceding it with a dollar sign 318236769Sobrien (`$'). If the variable name contains only a single letter, the surround- 319236769Sobrien ing braces or parentheses are not required. This shorter form is not 320236769Sobrien recommended. 321236769Sobrien 322236769Sobrien If the variable name contains a dollar, then the name itself is expanded 323236769Sobrien first. This allows almost arbitrary variable names, however names con- 324236769Sobrien taining dollar, braces, parenthesis, or whitespace are really best 325236769Sobrien avoided! 326236769Sobrien 327236769Sobrien If the result of expanding a variable contains a dollar sign (`$') the 328236769Sobrien string is expanded again. 329236769Sobrien 330236769Sobrien Variable substitution occurs at three distinct times, depending on where 331236769Sobrien the variable is being used. 332236769Sobrien 333236769Sobrien 1. Variables in dependency lines are expanded as the line is read. 334236769Sobrien 335236769Sobrien 2. Variables in shell commands are expanded when the shell command is 336236769Sobrien executed. 337236769Sobrien 338236769Sobrien 3. ``.for'' loop index variables are expanded on each loop iteration. 339236769Sobrien Note that other variables are not expanded inside loops so the fol- 340236769Sobrien lowing example code: 341236769Sobrien 342236769Sobrien 343236769Sobrien .for i in 1 2 3 344236769Sobrien a+= ${i} 345236769Sobrien j= ${i} 346236769Sobrien b+= ${j} 347236769Sobrien .endfor 348236769Sobrien 349236769Sobrien all: 350236769Sobrien @echo ${a} 351236769Sobrien @echo ${b} 352236769Sobrien 353236769Sobrien will print: 354236769Sobrien 355236769Sobrien 1 2 3 356236769Sobrien 3 3 3 357236769Sobrien 358236769Sobrien Because while ${a} contains ``1 2 3'' after the loop is executed, 359236769Sobrien ${b} contains ``${j} ${j} ${j}'' which expands to ``3 3 3'' since 360236769Sobrien after the loop completes ${j} contains ``3''. 361236769Sobrien 362236769Sobrien VVaarriiaabbllee ccllaasssseess 363236769Sobrien The four different classes of variables (in order of increasing prece- 364236769Sobrien dence) are: 365236769Sobrien 366236769Sobrien Environment variables 367236769Sobrien Variables defined as part of bbmmaakkee's environment. 368236769Sobrien 369236769Sobrien Global variables 370236769Sobrien Variables defined in the makefile or in included makefiles. 371236769Sobrien 372236769Sobrien Command line variables 373236769Sobrien Variables defined as part of the command line. 374236769Sobrien 375236769Sobrien Local variables 376236769Sobrien Variables that are defined specific to a certain target. The 377236769Sobrien seven local variables are as follows: 378236769Sobrien 379236769Sobrien _._A_L_L_S_R_C The list of all sources for this target; also known as 380236769Sobrien `_>'. 381236769Sobrien 382236769Sobrien _._A_R_C_H_I_V_E The name of the archive file. 383236769Sobrien 384236769Sobrien _._I_M_P_S_R_C In suffix-transformation rules, the name/path of the 385236769Sobrien source from which the target is to be transformed (the 386236769Sobrien ``implied'' source); also known as `_<'. It is not 387236769Sobrien defined in explicit rules. 388236769Sobrien 389236769Sobrien _._M_E_M_B_E_R The name of the archive member. 390236769Sobrien 391236769Sobrien _._O_O_D_A_T_E The list of sources for this target that were deemed 392236769Sobrien out-of-date; also known as `_?'. 393236769Sobrien 394236769Sobrien _._P_R_E_F_I_X The file prefix of the target, containing only the file 395236769Sobrien portion, no suffix or preceding directory components; 396236769Sobrien also known as `_*'. 397236769Sobrien 398236769Sobrien _._T_A_R_G_E_T The name of the target; also known as `_@'. 399236769Sobrien 400236769Sobrien The shorter forms `_@', `_?', `_<', `_>', and `_*' are permitted for 401236769Sobrien backward compatibility with historical makefiles and are not rec- 402236769Sobrien ommended. The six variables `_@_F', `_@_D', `_<_F', `_<_D', `_*_F', and 403236769Sobrien `_*_D' are permitted for compatibility with AT&T System V UNIX 404236769Sobrien makefiles and are not recommended. 405236769Sobrien 406236769Sobrien Four of the local variables may be used in sources on dependency 407236769Sobrien lines because they expand to the proper value for each target on 408236769Sobrien the line. These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E', 409236769Sobrien and `_._M_E_M_B_E_R'. 410236769Sobrien 411236769Sobrien AAddddiittiioonnaall bbuuiilltt--iinn vvaarriiaabblleess 412236769Sobrien In addition, bbmmaakkee sets or knows about the following variables: 413236769Sobrien 414236769Sobrien _$ A single dollar sign `$', i.e. `$$' expands to a single 415236769Sobrien dollar sign. 416236769Sobrien 417236769Sobrien _._A_L_L_T_A_R_G_E_T_S The list of all targets encountered in the Makefile. If 418236769Sobrien evaluated during Makefile parsing, lists only those tar- 419236769Sobrien gets encountered thus far. 420236769Sobrien 421236769Sobrien _._C_U_R_D_I_R A path to the directory where bbmmaakkee was executed. Refer 422236769Sobrien to the description of `PWD' for more details. 423236769Sobrien 424236769Sobrien MAKE The name that bbmmaakkee was executed with (_a_r_g_v_[_0_]). For 425236769Sobrien compatibility bbmmaakkee also sets _._M_A_K_E with the same value. 426236769Sobrien The preferred variable to use is the environment variable 427236769Sobrien MAKE because it is more compatible with other versions of 428236769Sobrien bbmmaakkee and cannot be confused with the special target with 429236769Sobrien the same name. 430236769Sobrien 431236769Sobrien _._M_A_K_E_._D_E_P_E_N_D_F_I_L_E 432236769Sobrien Names the makefile (default `_._d_e_p_e_n_d') from which gener- 433236769Sobrien ated dependencies are read. 434236769Sobrien 435240330Smarcel _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S 436240330Smarcel A boolean that controls the default behavior of the --VV 437240330Smarcel option. 438240330Smarcel 439236769Sobrien _._M_A_K_E_._E_X_P_O_R_T_E_D The list of variables exported by bbmmaakkee. 440236769Sobrien 441236769Sobrien _._M_A_K_E_._J_O_B_S The argument to the --jj option. 442236769Sobrien 443236769Sobrien _._M_A_K_E_._J_O_B_._P_R_E_F_I_X 444236769Sobrien If bbmmaakkee is run with _j then output for each target is 445236769Sobrien prefixed with a token `--- target ---' the first part of 446236769Sobrien which can be controlled via _._M_A_K_E_._J_O_B_._P_R_E_F_I_X. 447236769Sobrien For example: 448236769Sobrien .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] 449236769Sobrien would produce tokens like `---make[1234] target ---' mak- 450236769Sobrien ing it easier to track the degree of parallelism being 451236769Sobrien achieved. 452236769Sobrien 453236769Sobrien MAKEFLAGS The environment variable `MAKEFLAGS' may contain anything 454236769Sobrien that may be specified on bbmmaakkee's command line. Anything 455236769Sobrien specified on bbmmaakkee's command line is appended to the 456236769Sobrien `MAKEFLAGS' variable which is then entered into the envi- 457236769Sobrien ronment for all programs which bbmmaakkee executes. 458236769Sobrien 459236769Sobrien _._M_A_K_E_._L_E_V_E_L The recursion depth of bbmmaakkee. The initial instance of 460236769Sobrien bbmmaakkee will be 0, and an incremented value is put into the 461236769Sobrien environment to be seen by the next generation. This 462236769Sobrien allows tests like: .if ${.MAKE.LEVEL} == 0 to protect 463236769Sobrien things which should only be evaluated in the initial 464236769Sobrien instance of bbmmaakkee. 465236769Sobrien 466236769Sobrien _._M_A_K_E_._M_A_K_E_F_I_L_E___P_R_E_F_E_R_E_N_C_E 467236769Sobrien The ordered list of makefile names (default `_m_a_k_e_f_i_l_e', 468236769Sobrien `_M_a_k_e_f_i_l_e') that bbmmaakkee will look for. 469236769Sobrien 470236769Sobrien _._M_A_K_E_._M_A_K_E_F_I_L_E_S 471236769Sobrien The list of makefiles read by bbmmaakkee, which is useful for 472236769Sobrien tracking dependencies. Each makefile is recorded only 473236769Sobrien once, regardless of the number of times read. 474236769Sobrien 475236769Sobrien _._M_A_K_E_._M_O_D_E Processed after reading all makefiles. Can affect the 476236769Sobrien mode that bbmmaakkee runs in. It can contain a number of key- 477236769Sobrien words: 478236769Sobrien 479236769Sobrien _c_o_m_p_a_t Like --BB, puts bbmmaakkee into "compat" mode. 480236769Sobrien 481236769Sobrien _m_e_t_a Puts bbmmaakkee into "meta" mode, where meta files 482236769Sobrien are created for each target to capture the 483236769Sobrien command run, the output generated and if 484236769Sobrien filemon(4) is available, the system calls 485236769Sobrien which are of interest to bbmmaakkee. The captured 486236769Sobrien output can be very useful when diagnosing 487236769Sobrien errors. 488236769Sobrien 489236769Sobrien _c_u_r_d_i_r_O_k_= _b_f Normally bbmmaakkee will not create .meta files 490236769Sobrien in `_._C_U_R_D_I_R'. This can be overridden by set- 491236769Sobrien ting _b_f to a value which represents True. 492236769Sobrien 493236769Sobrien _e_n_v For debugging, it can be useful to inlcude 494236769Sobrien the environment in the .meta file. 495236769Sobrien 496236769Sobrien _v_e_r_b_o_s_e If in "meta" mode, print a clue about the 497236769Sobrien target being built. This is useful if the 498236769Sobrien build is otherwise running silently. The 499236769Sobrien message printed the value of: 500236769Sobrien _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X. 501236769Sobrien 502236769Sobrien _i_g_n_o_r_e_-_c_m_d Some makefiles have commands which are simply 503236769Sobrien not stable. This keyword causes them to be 504236769Sobrien ignored for determining whether a target is 505236769Sobrien out of date in "meta" mode. See also 506236769Sobrien ..NNOOMMEETTAA__CCMMPP. 507236769Sobrien 508236769Sobrien _s_i_l_e_n_t_= _b_f If _b_f is True, when a .meta file is created, 509236769Sobrien mark the target ..SSIILLEENNTT. 510236769Sobrien 511236769Sobrien _._M_A_K_E_._M_E_T_A_._B_A_I_L_I_W_I_C_K 512236769Sobrien In "meta" mode, provides a list of prefixes which match 513236769Sobrien the directories controlled by bbmmaakkee. If a file that was 514236769Sobrien generated outside of _._O_B_J_D_I_R but within said bailiwick is 515236769Sobrien missing, the current target is considered out-of-date. 516236769Sobrien 517236769Sobrien _._M_A_K_E_._M_E_T_A_._C_R_E_A_T_E_D 518236769Sobrien In "meta" mode, this variable contains a list of all the 519236769Sobrien meta files updated. If not empty, it can be used to 520236769Sobrien trigger processing of _._M_A_K_E_._M_E_T_A_._F_I_L_E_S. 521236769Sobrien 522236769Sobrien _._M_A_K_E_._M_E_T_A_._F_I_L_E_S 523236769Sobrien In "meta" mode, this variable contains a list of all the 524236769Sobrien meta files used (updated or not). This list can be used 525236769Sobrien to process the meta files to extract dependency informa- 526236769Sobrien tion. 527236769Sobrien 528236769Sobrien _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X 529236769Sobrien Defines the message printed for each meta file updated in 530236769Sobrien "meta verbose" mode. The default value is: 531236769Sobrien Building ${.TARGET:H:tA}/${.TARGET:T} 532236769Sobrien 533236769Sobrien _._M_A_K_E_O_V_E_R_R_I_D_E_S This variable is used to record the names of variables 534236769Sobrien assigned to on the command line, so that they may be 535236769Sobrien exported as part of `MAKEFLAGS'. This behaviour can be 536236769Sobrien disabled by assigning an empty value to `_._M_A_K_E_O_V_E_R_R_I_D_E_S' 537236769Sobrien within a makefile. Extra variables can be exported from 538236769Sobrien a makefile by appending their names to `_._M_A_K_E_O_V_E_R_R_I_D_E_S'. 539236769Sobrien `MAKEFLAGS' is re-exported whenever `_._M_A_K_E_O_V_E_R_R_I_D_E_S' is 540236769Sobrien modified. 541236769Sobrien 542236769Sobrien _._M_A_K_E_._P_I_D The process-id of bbmmaakkee. 543236769Sobrien 544236769Sobrien _._M_A_K_E_._P_P_I_D The parent process-id of bbmmaakkee. 545236769Sobrien 546236769Sobrien _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R 547236769Sobrien When bbmmaakkee stops due to an error, it prints its name and 548236769Sobrien the value of `_._C_U_R_D_I_R' as well as the value of any vari- 549236769Sobrien ables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. 550236769Sobrien 551236769Sobrien _._n_e_w_l_i_n_e This variable is simply assigned a newline character as 552236769Sobrien its value. This allows expansions using the ::@@ modifier 553236769Sobrien to put a newline between iterations of the loop rather 554236769Sobrien than a space. For example, the printing of 555236769Sobrien `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R' could be done as 556236769Sobrien ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}. 557236769Sobrien 558236769Sobrien _._O_B_J_D_I_R A path to the directory where the targets are built. Its 559236769Sobrien value is determined by trying to chdir(2) to the follow- 560236769Sobrien ing directories in order and using the first match: 561236769Sobrien 562236769Sobrien 1. ${MAKEOBJDIRPREFIX}${.CURDIR} 563236769Sobrien 564236769Sobrien (Only if `MAKEOBJDIRPREFIX' is set in the environ- 565236769Sobrien ment or on the command line.) 566236769Sobrien 567236769Sobrien 2. ${MAKEOBJDIR} 568236769Sobrien 569236769Sobrien (Only if `MAKEOBJDIR' is set in the environment or 570236769Sobrien on the command line.) 571236769Sobrien 572236769Sobrien 3. ${.CURDIR}_/_o_b_j_.${MACHINE} 573236769Sobrien 574236769Sobrien 4. ${.CURDIR}_/_o_b_j 575236769Sobrien 576236769Sobrien 5. _/_u_s_r_/_o_b_j_/${.CURDIR} 577236769Sobrien 578236769Sobrien 6. ${.CURDIR} 579236769Sobrien 580236769Sobrien Variable expansion is performed on the value before it's 581236769Sobrien used, so expressions such as 582236769Sobrien ${.CURDIR:S,^/usr/src,/var/obj,} 583236769Sobrien may be used. This is especially useful with 584236769Sobrien `MAKEOBJDIR'. 585236769Sobrien 586236769Sobrien `_._O_B_J_D_I_R' may be modified in the makefile as a global 587236769Sobrien variable. In all cases, bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' 588236769Sobrien and set `PWD' to that directory before executing any tar- 589236769Sobrien gets. 590236769Sobrien 591236769Sobrien _._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 592236769Sobrien parsed. 593236769Sobrien 594236769Sobrien _._P_A_R_S_E_F_I_L_E The basename of the current `_M_a_k_e_f_i_l_e' being parsed. 595236769Sobrien This variable and `_._P_A_R_S_E_D_I_R' are both set only while the 596236769Sobrien `_M_a_k_e_f_i_l_e_s' are being parsed. If you want to retain 597236769Sobrien their current values, assign them to a variable using 598236769Sobrien assignment with expansion: (`::=='). 599236769Sobrien 600236769Sobrien _._P_A_T_H A variable that represents the list of directories that 601236769Sobrien bbmmaakkee will search for files. The search list should be 602236769Sobrien updated using the target `_._P_A_T_H' rather than the vari- 603236769Sobrien able. 604236769Sobrien 605236769Sobrien PWD Alternate path to the current directory. bbmmaakkee normally 606236769Sobrien sets `_._C_U_R_D_I_R' to the canonical path given by getcwd(3). 607236769Sobrien However, if the environment variable `PWD' is set and 608236769Sobrien gives a path to the current directory, then bbmmaakkee sets 609236769Sobrien `_._C_U_R_D_I_R' to the value of `PWD' instead. This behaviour 610236769Sobrien is disabled if `MAKEOBJDIRPREFIX' is set or `MAKEOBJDIR' 611236769Sobrien contains a variable transform. `PWD' is set to the value 612236769Sobrien of `_._O_B_J_D_I_R' for all programs which bbmmaakkee executes. 613236769Sobrien 614236769Sobrien .TARGETS The list of targets explicitly specified on the command 615236769Sobrien line, if any. 616236769Sobrien 617236769Sobrien VPATH Colon-separated (``:'') lists of directories that bbmmaakkee 618236769Sobrien will search for files. The variable is supported for 619236769Sobrien compatibility with old make programs only, use `_._P_A_T_H' 620236769Sobrien instead. 621236769Sobrien 622236769Sobrien VVaarriiaabbllee mmooddiiffiieerrss 623236769Sobrien Variable expansion may be modified to select or modify each word of the 624236769Sobrien variable (where a ``word'' is white-space delimited sequence of charac- 625236769Sobrien ters). The general format of a variable expansion is as follows: 626236769Sobrien 627236769Sobrien ${variable[:modifier[:...]]} 628236769Sobrien 629236769Sobrien Each modifier begins with a colon, which may be escaped with a backslash 630236769Sobrien (`\'). 631236769Sobrien 632236769Sobrien A set of modifiers can be specified via a variable, as follows: 633236769Sobrien 634236769Sobrien modifier_variable=modifier[:...] 635236769Sobrien ${variable:${modifier_variable}[:...]} 636236769Sobrien 637236769Sobrien In this case the first modifier in the modifier_variable does not start 638236769Sobrien with a colon, since that must appear in the referencing variable. If any 639236769Sobrien of the modifiers in the modifier_variable contain a dollar sign (`$'), 640236769Sobrien these must be doubled to avoid early expansion. 641236769Sobrien 642236769Sobrien The supported modifiers are: 643236769Sobrien 644236769Sobrien ::EE Replaces each word in the variable with its suffix. 645236769Sobrien 646236769Sobrien ::HH Replaces each word in the variable with everything but the last com- 647236769Sobrien ponent. 648236769Sobrien 649236769Sobrien ::MM_p_a_t_t_e_r_n 650236769Sobrien Select only those words that match _p_a_t_t_e_r_n. The standard shell 651236769Sobrien wildcard characters (`*', `?', and `[]') may be used. The wildcard 652236769Sobrien characters may be escaped with a backslash (`\'). 653236769Sobrien 654236769Sobrien ::NN_p_a_t_t_e_r_n 655236769Sobrien This is identical to `::MM', but selects all words which do not match 656236769Sobrien _p_a_t_t_e_r_n. 657236769Sobrien 658236769Sobrien ::OO Order every word in variable alphabetically. To sort words in 659236769Sobrien reverse order use the `::OO::[[--11....11]]' combination of modifiers. 660236769Sobrien 661236769Sobrien ::OOxx Randomize words in variable. The results will be different each 662236769Sobrien time you are referring to the modified variable; use the assignment 663236769Sobrien with expansion (`::==') to prevent such behaviour. For example, 664236769Sobrien 665236769Sobrien LIST= uno due tre quattro 666236769Sobrien RANDOM_LIST= ${LIST:Ox} 667236769Sobrien STATIC_RANDOM_LIST:= ${LIST:Ox} 668236769Sobrien 669236769Sobrien all: 670236769Sobrien @echo "${RANDOM_LIST}" 671236769Sobrien @echo "${RANDOM_LIST}" 672236769Sobrien @echo "${STATIC_RANDOM_LIST}" 673236769Sobrien @echo "${STATIC_RANDOM_LIST}" 674236769Sobrien may produce output similar to: 675236769Sobrien 676236769Sobrien quattro due tre uno 677236769Sobrien tre due quattro uno 678236769Sobrien due uno quattro tre 679236769Sobrien due uno quattro tre 680236769Sobrien 681236769Sobrien ::QQ Quotes every shell meta-character in the variable, so that it can be 682236769Sobrien passed safely through recursive invocations of bbmmaakkee. 683236769Sobrien 684236769Sobrien ::RR Replaces each word in the variable with everything but its suffix. 685236769Sobrien 686236769Sobrien ::ggmmttiimmee 687236769Sobrien The value is a format string for strftime(3), using the current 688236769Sobrien gmtime(3). 689236769Sobrien 690236769Sobrien ::hhaasshh 691236769Sobrien Compute a 32bit hash of the value and encode it as hex digits. 692236769Sobrien 693236769Sobrien ::llooccaallttiimmee 694236769Sobrien The value is a format string for strftime(3), using the current 695236769Sobrien localtime(3). 696236769Sobrien 697236769Sobrien ::ttAA Attempt to convert variable to an absolute path using realpath(3), 698236769Sobrien if that fails, the value is unchanged. 699236769Sobrien 700236769Sobrien ::ttll Converts variable to lower-case letters. 701236769Sobrien 702236769Sobrien ::ttss_c 703236769Sobrien Words in the variable are normally separated by a space on expan- 704236769Sobrien sion. This modifier sets the separator to the character _c. If _c is 705236769Sobrien omitted, then no separator is used. The common escapes (including 706236769Sobrien octal numeric codes), work as expected. 707236769Sobrien 708236769Sobrien ::ttuu Converts variable to upper-case letters. 709236769Sobrien 710236769Sobrien ::ttWW Causes the value to be treated as a single word (possibly containing 711236769Sobrien embedded white space). See also `::[[**]]'. 712236769Sobrien 713236769Sobrien ::ttww Causes the value to be treated as a sequence of words delimited by 714236769Sobrien white space. See also `::[[@@]]'. 715236769Sobrien 716236769Sobrien ::SS/_o_l_d___s_t_r_i_n_g/_n_e_w___s_t_r_i_n_g/[11ggWW] 717236769Sobrien Modify the first occurrence of _o_l_d___s_t_r_i_n_g in the variable's value, 718236769Sobrien replacing it with _n_e_w___s_t_r_i_n_g. If a `g' is appended to the last 719236769Sobrien slash of the pattern, all occurrences in each word are replaced. If 720236769Sobrien a `1' is appended to the last slash of the pattern, only the first 721236769Sobrien word is affected. If a `W' is appended to the last slash of the 722236769Sobrien pattern, then the value is treated as a single word (possibly con- 723236769Sobrien taining embedded white space). If _o_l_d___s_t_r_i_n_g begins with a caret 724236769Sobrien (`^'), _o_l_d___s_t_r_i_n_g is anchored at the beginning of each word. If 725236769Sobrien _o_l_d___s_t_r_i_n_g ends with a dollar sign (`$'), it is anchored at the end 726236769Sobrien of each word. Inside _n_e_w___s_t_r_i_n_g, an ampersand (`&') is replaced by 727236769Sobrien _o_l_d___s_t_r_i_n_g (without any `^' or `$'). Any character may be used as a 728236769Sobrien delimiter for the parts of the modifier string. The anchoring, 729236769Sobrien ampersand and delimiter characters may be escaped with a backslash 730236769Sobrien (`\'). 731236769Sobrien 732236769Sobrien Variable expansion occurs in the normal fashion inside both 733236769Sobrien _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 734236769Sobrien is used to prevent the expansion of a dollar sign (`$'), not a pre- 735236769Sobrien ceding dollar sign as is usual. 736236769Sobrien 737236769Sobrien ::CC/_p_a_t_t_e_r_n/_r_e_p_l_a_c_e_m_e_n_t/[11ggWW] 738236769Sobrien The ::CC modifier is just like the ::SS modifier except that the old and 739236769Sobrien new strings, instead of being simple strings, are a regular expres- 740236769Sobrien sion (see regex(3)) string _p_a_t_t_e_r_n and an ed(1)-style string 741236769Sobrien _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 742236769Sobrien in each word of the value is substituted with _r_e_p_l_a_c_e_m_e_n_t. The `1' 743236769Sobrien modifier causes the substitution to apply to at most one word; the 744236769Sobrien `g' modifier causes the substitution to apply to as many instances 745236769Sobrien of the search pattern _p_a_t_t_e_r_n as occur in the word or words it is 746236769Sobrien found in; the `W' modifier causes the value to be treated as a sin- 747236769Sobrien gle word (possibly containing embedded white space). Note that `1' 748236769Sobrien and `g' are orthogonal; the former specifies whether multiple words 749236769Sobrien are potentially affected, the latter whether multiple substitutions 750236769Sobrien can potentially occur within each affected word. 751236769Sobrien 752236769Sobrien ::TT Replaces each word in the variable with its last component. 753236769Sobrien 754236769Sobrien ::uu Remove adjacent duplicate words (like uniq(1)). 755236769Sobrien 756236769Sobrien ::??_t_r_u_e___s_t_r_i_n_g::_f_a_l_s_e___s_t_r_i_n_g 757236769Sobrien If the variable name (not its value), when parsed as a .if condi- 758236769Sobrien tional expression, evaluates to true, return as its value the 759236769Sobrien _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 760236769Sobrien name is used as the expression, :? must be the first modifier after 761236769Sobrien the variable name itself - which will, of course, usually contain 762236769Sobrien variable expansions. A common error is trying to use expressions 763236769Sobrien like 764236769Sobrien ${NUMBERS:M42:?match:no} 765236769Sobrien which actually tests defined(NUMBERS), to determine is any words 766236769Sobrien match "42" you need to use something like: 767236769Sobrien ${"${NUMBERS:M42}" != "":?match:no}. 768236769Sobrien 769236769Sobrien _:_o_l_d___s_t_r_i_n_g_=_n_e_w___s_t_r_i_n_g 770236769Sobrien This is the AT&T System V UNIX style variable substitution. It must 771236769Sobrien 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 772236769Sobrien contain the pattern matching character _% then it is assumed that 773236769Sobrien they are anchored at the end of each word, so only suffixes or 774236769Sobrien entire words may be replaced. Otherwise _% is the substring of 775236769Sobrien _o_l_d___s_t_r_i_n_g to be replaced in _n_e_w___s_t_r_i_n_g. 776236769Sobrien 777236769Sobrien Variable expansion occurs in the normal fashion inside both 778236769Sobrien _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 779236769Sobrien is used to prevent the expansion of a dollar sign (`$'), not a pre- 780236769Sobrien ceding dollar sign as is usual. 781236769Sobrien 782236769Sobrien ::@@_t_e_m_p@@_s_t_r_i_n_g@@ 783236769Sobrien This is the loop expansion mechanism from the OSF Development Envi- 784236769Sobrien ronment (ODE) make. Unlike ..ffoorr loops expansion occurs at the time 785236769Sobrien of reference. Assign _t_e_m_p to each word in the variable and evaluate 786236769Sobrien _s_t_r_i_n_g. The ODE convention is that _t_e_m_p should start and end with a 787236769Sobrien period. For example. 788236769Sobrien ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} 789236769Sobrien 790236769Sobrien However a single character varaiable is often more readable: 791236769Sobrien ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} 792236769Sobrien 793236769Sobrien ::UU_n_e_w_v_a_l 794236769Sobrien If the variable is undefined _n_e_w_v_a_l is the value. If the variable 795236769Sobrien is defined, the existing value is returned. This is another ODE 796236769Sobrien make feature. It is handy for setting per-target CFLAGS for 797236769Sobrien instance: 798236769Sobrien ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}} 799236769Sobrien If a value is only required if the variable is undefined, use: 800236769Sobrien ${VAR:D:Unewval} 801236769Sobrien 802236769Sobrien ::DD_n_e_w_v_a_l 803236769Sobrien If the variable is defined _n_e_w_v_a_l is the value. 804236769Sobrien 805236769Sobrien ::LL The name of the variable is the value. 806236769Sobrien 807236769Sobrien ::PP The path of the node which has the same name as the variable is the 808236769Sobrien value. If no such node exists or its path is null, then the name of 809236769Sobrien the variable is used. In order for this modifier to work, the name 810236769Sobrien (node) must at least have appeared on the rhs of a dependency. 811236769Sobrien 812236769Sobrien ::!!_c_m_d!! 813236769Sobrien The output of running _c_m_d is the value. 814236769Sobrien 815236769Sobrien ::sshh If the variable is non-empty it is run as a command and the output 816236769Sobrien becomes the new value. 817236769Sobrien 818236769Sobrien ::::==_s_t_r 819236769Sobrien The variable is assigned the value _s_t_r after substitution. This 820236769Sobrien modifier and its variations are useful in obscure situations such as 821236769Sobrien wanting to set a variable when shell commands are being parsed. 822236769Sobrien These assignment modifiers always expand to nothing, so if appearing 823236769Sobrien in a rule line by themselves should be preceded with something to 824236769Sobrien keep bbmmaakkee happy. 825236769Sobrien 826236769Sobrien The `::::' helps avoid false matches with the AT&T System V UNIX style 827236769Sobrien ::== modifier and since substitution always occurs the ::::== form is 828236769Sobrien vaguely appropriate. 829236769Sobrien 830236769Sobrien ::::??==_s_t_r 831236769Sobrien As for ::::== but only if the variable does not already have a value. 832236769Sobrien 833236769Sobrien ::::++==_s_t_r 834236769Sobrien Append _s_t_r to the variable. 835236769Sobrien 836236769Sobrien ::::!!==_c_m_d 837236769Sobrien Assign the output of _c_m_d to the variable. 838236769Sobrien 839236769Sobrien ::[[_r_a_n_g_e]] 840236769Sobrien Selects one or more words from the value, or performs other opera- 841236769Sobrien tions related to the way in which the value is divided into words. 842236769Sobrien 843236769Sobrien Ordinarily, a value is treated as a sequence of words delimited by 844236769Sobrien white space. Some modifiers suppress this behaviour, causing a 845236769Sobrien value to be treated as a single word (possibly containing embedded 846236769Sobrien white space). An empty value, or a value that consists entirely of 847236769Sobrien white-space, is treated as a single word. For the purposes of the 848236769Sobrien `::[[]]' modifier, the words are indexed both forwards using positive 849236769Sobrien integers (where index 1 represents the first word), and backwards 850236769Sobrien using negative integers (where index -1 represents the last word). 851236769Sobrien 852236769Sobrien The _r_a_n_g_e is subjected to variable expansion, and the expanded 853236769Sobrien result is then interpreted as follows: 854236769Sobrien 855236769Sobrien _i_n_d_e_x Selects a single word from the value. 856236769Sobrien 857236769Sobrien _s_t_a_r_t...._e_n_d 858236769Sobrien Selects all words from _s_t_a_r_t to _e_n_d, inclusive. For example, 859236769Sobrien `::[[22....--11]]' selects all words from the second word to the last 860236769Sobrien word. If _s_t_a_r_t is greater than _e_n_d, then the words are out- 861236769Sobrien put in reverse order. For example, `::[[--11....11]]' selects all 862236769Sobrien the words from last to first. 863236769Sobrien 864236769Sobrien ** Causes subsequent modifiers to treat the value as a single 865236769Sobrien word (possibly containing embedded white space). Analogous 866236769Sobrien to the effect of "$*" in Bourne shell. 867236769Sobrien 868236769Sobrien 0 Means the same as `::[[**]]'. 869236769Sobrien 870236769Sobrien @@ Causes subsequent modifiers to treat the value as a sequence 871236769Sobrien of words delimited by white space. Analogous to the effect 872236769Sobrien of "$@" in Bourne shell. 873236769Sobrien 874236769Sobrien ## Returns the number of words in the value. 875236769Sobrien 876236769SobrienIINNCCLLUUDDEE SSTTAATTEEMMEENNTTSS,, CCOONNDDIITTIIOONNAALLSS AANNDD FFOORR LLOOOOPPSS 877236769Sobrien Makefile inclusion, conditional structures and for loops reminiscent of 878236769Sobrien the C programming language are provided in bbmmaakkee. All such structures 879236769Sobrien are identified by a line beginning with a single dot (`.') character. 880236769Sobrien Files are included with either ..iinncclluuddee <_f_i_l_e> or ..iinncclluuddee "_f_i_l_e". Vari- 881236769Sobrien ables between the angle brackets or double quotes are expanded to form 882236769Sobrien the file name. If angle brackets are used, the included makefile is 883236769Sobrien expected to be in the system makefile directory. If double quotes are 884236769Sobrien used, the including makefile's directory and any directories specified 885236769Sobrien using the --II option are searched before the system makefile directory. 886236769Sobrien For compatibility with other versions of bbmmaakkee `include file ...' is also 887236769Sobrien accepted. If the include statement is written as ..--iinncclluuddee or as 888236769Sobrien ..ssiinncclluuddee then errors locating and/or opening include files are ignored. 889236769Sobrien 890236769Sobrien Conditional expressions are also preceded by a single dot as the first 891236769Sobrien character of a line. The possible conditionals are as follows: 892236769Sobrien 893236769Sobrien ..eerrrroorr _m_e_s_s_a_g_e 894236769Sobrien The message is printed along with the name of the makefile and 895236769Sobrien line number, then bbmmaakkee will exit. 896236769Sobrien 897236769Sobrien ..eexxppoorrtt _v_a_r_i_a_b_l_e _._._. 898236769Sobrien Export the specified global variable. If no variable list is 899236769Sobrien provided, all globals are exported except for internal variables 900236769Sobrien (those that start with `.'). This is not affected by the --XX 901236769Sobrien flag, so should be used with caution. For compatibility with 902236769Sobrien other bbmmaakkee programs `export variable=value' is also accepted. 903236769Sobrien 904236769Sobrien Appending a variable name to _._M_A_K_E_._E_X_P_O_R_T_E_D is equivalent to 905236769Sobrien exporting a variable. 906236769Sobrien 907236769Sobrien ..eexxppoorrtt--eennvv _v_a_r_i_a_b_l_e _._._. 908236769Sobrien The same as `.export', except that the variable is not appended 909236769Sobrien to _._M_A_K_E_._E_X_P_O_R_T_E_D. This allows exporting a value to the environ- 910236769Sobrien ment which is different from that used by bbmmaakkee internally. 911236769Sobrien 912236769Sobrien ..iinnffoo _m_e_s_s_a_g_e 913236769Sobrien The message is printed along with the name of the makefile and 914236769Sobrien line number. 915236769Sobrien 916236769Sobrien ..uunnddeeff _v_a_r_i_a_b_l_e 917236769Sobrien Un-define the specified global variable. Only global variables 918236769Sobrien may be un-defined. 919236769Sobrien 920236769Sobrien ..uunneexxppoorrtt _v_a_r_i_a_b_l_e _._._. 921236769Sobrien The opposite of `.export'. The specified global _v_a_r_i_a_b_l_e will be 922236769Sobrien removed from _._M_A_K_E_._E_X_P_O_R_T_E_D. If no variable list is provided, 923236769Sobrien all globals are unexported, and _._M_A_K_E_._E_X_P_O_R_T_E_D deleted. 924236769Sobrien 925236769Sobrien ..uunneexxppoorrtt--eennvv 926236769Sobrien Unexport all globals previously exported and clear the environ- 927236769Sobrien ment inherited from the parent. This operation will cause a mem- 928236769Sobrien ory leak of the original environment, so should be used spar- 929236769Sobrien ingly. Testing for _._M_A_K_E_._L_E_V_E_L being 0, would make sense. Also 930236769Sobrien note that any variables which originated in the parent environ- 931236769Sobrien ment should be explicitly preserved if desired. For example: 932236769Sobrien 933236769Sobrien .if ${.MAKE.LEVEL} == 0 934236769Sobrien PATH := ${PATH} 935236769Sobrien .unexport-env 936236769Sobrien .export PATH 937236769Sobrien .endif 938236769Sobrien 939236769Sobrien Would result in an environment containing only `PATH', which is 940236769Sobrien the minimal useful environment. Actually `.MAKE.LEVEL' will also 941236769Sobrien be pushed into the new environment. 942236769Sobrien 943236769Sobrien ..wwaarrnniinngg _m_e_s_s_a_g_e 944236769Sobrien The message prefixed by `_w_a_r_n_i_n_g_:' is printed along with the name 945236769Sobrien of the makefile and line number. 946236769Sobrien 947236769Sobrien ..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 _._._.] 948236769Sobrien Test the value of an expression. 949236769Sobrien 950236769Sobrien ..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 _._._.] 951236769Sobrien Test the value of a variable. 952236769Sobrien 953236769Sobrien ..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 _._._.] 954236769Sobrien Test the value of a variable. 955236769Sobrien 956236769Sobrien ..iiffmmaakkee [!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 957236769Sobrien Test the target being built. 958236769Sobrien 959236769Sobrien ..iiffnnmmaakkee [!] _t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 960236769Sobrien Test the target being built. 961236769Sobrien 962236769Sobrien ..eellssee Reverse the sense of the last conditional. 963236769Sobrien 964236769Sobrien ..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 _._._.] 965236769Sobrien A combination of `..eellssee' followed by `..iiff'. 966236769Sobrien 967236769Sobrien ..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 _._._.] 968236769Sobrien A combination of `..eellssee' followed by `..iiffddeeff'. 969236769Sobrien 970236769Sobrien ..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 _._._.] 971236769Sobrien A combination of `..eellssee' followed by `..iiffnnddeeff'. 972236769Sobrien 973236769Sobrien ..eelliiffmmaakkee [!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 974236769Sobrien A combination of `..eellssee' followed by `..iiffmmaakkee'. 975236769Sobrien 976236769Sobrien ..eelliiffnnmmaakkee [!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 977236769Sobrien A combination of `..eellssee' followed by `..iiffnnmmaakkee'. 978236769Sobrien 979236769Sobrien ..eennddiiff End the body of the conditional. 980236769Sobrien 981236769Sobrien The _o_p_e_r_a_t_o_r may be any one of the following: 982236769Sobrien 983236769Sobrien |||| Logical OR. 984236769Sobrien 985236769Sobrien &&&& Logical AND; of higher precedence than ``||''. 986236769Sobrien 987236769Sobrien As in C, bbmmaakkee will only evaluate a conditional as far as is necessary to 988236769Sobrien determine its value. Parentheses may be used to change the order of 989236769Sobrien evaluation. The boolean operator `!!' may be used to logically negate an 990236769Sobrien entire conditional. It is of higher precedence than `&&&&'. 991236769Sobrien 992236769Sobrien The value of _e_x_p_r_e_s_s_i_o_n may be any of the following: 993236769Sobrien 994236769Sobrien ddeeffiinneedd Takes a variable name as an argument and evaluates to true if 995236769Sobrien the variable has been defined. 996236769Sobrien 997236769Sobrien mmaakkee Takes a target name as an argument and evaluates to true if the 998236769Sobrien target was specified as part of bbmmaakkee's command line or was 999236769Sobrien declared the default target (either implicitly or explicitly, 1000236769Sobrien see _._M_A_I_N) before the line containing the conditional. 1001236769Sobrien 1002236769Sobrien eemmppttyy Takes a variable, with possible modifiers, and evaluates to true 1003236769Sobrien if the expansion of the variable would result in an empty 1004236769Sobrien string. 1005236769Sobrien 1006236769Sobrien eexxiissttss Takes a file name as an argument and evaluates to true if the 1007236769Sobrien file exists. The file is searched for on the system search path 1008236769Sobrien (see _._P_A_T_H). 1009236769Sobrien 1010236769Sobrien ttaarrggeett Takes a target name as an argument and evaluates to true if the 1011236769Sobrien target has been defined. 1012236769Sobrien 1013236769Sobrien ccoommmmaannddss 1014236769Sobrien Takes a target name as an argument and evaluates to true if the 1015236769Sobrien target has been defined and has commands associated with it. 1016236769Sobrien 1017236769Sobrien _E_x_p_r_e_s_s_i_o_n may also be an arithmetic or string comparison. Variable 1018236769Sobrien expansion is performed on both sides of the comparison, after which the 1019236769Sobrien integral values are compared. A value is interpreted as hexadecimal if 1020236769Sobrien it is preceded by 0x, otherwise it is decimal; octal numbers are not sup- 1021236769Sobrien ported. The standard C relational operators are all supported. If after 1022236769Sobrien variable expansion, either the left or right hand side of a `====' or `!!==' 1023236769Sobrien operator is not an integral value, then string comparison is performed 1024236769Sobrien between the expanded variables. If no relational operator is given, it 1025236769Sobrien is assumed that the expanded variable is being compared against 0 or an 1026236769Sobrien empty string in the case of a string comparison. 1027236769Sobrien 1028236769Sobrien When bbmmaakkee is evaluating one of these conditional expressions, and it 1029236769Sobrien encounters a (white-space separated) word it doesn't recognize, either 1030236769Sobrien the ``make'' or ``defined'' expression is applied to it, depending on the 1031236769Sobrien form of the conditional. If the form is `..iiffddeeff', `..iiffnnddeeff', or `..iiff' 1032236769Sobrien the ``defined'' expression is applied. Similarly, if the form is 1033236769Sobrien `..iiffmmaakkee' or `..iiffnnmmaakkee, tthhee' ``make'' expression is applied. 1034236769Sobrien 1035236769Sobrien If the conditional evaluates to true the parsing of the makefile contin- 1036236769Sobrien ues as before. If it evaluates to false, the following lines are 1037236769Sobrien skipped. In both cases this continues until a `..eellssee' or `..eennddiiff' is 1038236769Sobrien found. 1039236769Sobrien 1040236769Sobrien For loops are typically used to apply a set of rules to a list of files. 1041236769Sobrien The syntax of a for loop is: 1042236769Sobrien 1043236769Sobrien ..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 1044236769Sobrien <make-rules> 1045236769Sobrien ..eennddffoorr 1046236769Sobrien 1047236769Sobrien After the for eexxpprreessssiioonn is evaluated, it is split into words. On each 1048236769Sobrien iteration of the loop, one word is taken and assigned to each vvaarriiaabbllee, 1049236769Sobrien in order, and these vvaarriiaabblleess are substituted into the mmaakkee--rruulleess inside 1050236769Sobrien the body of the for loop. The number of words must come out even; that 1051236769Sobrien is, if there are three iteration variables, the number of words provided 1052236769Sobrien must be a multiple of three. 1053236769Sobrien 1054236769SobrienCCOOMMMMEENNTTSS 1055236769Sobrien Comments begin with a hash (`#') character, anywhere but in a shell com- 1056236769Sobrien mand line, and continue to the end of an unescaped new line. 1057236769Sobrien 1058236769SobrienSSPPEECCIIAALL SSOOUURRCCEESS ((AATTTTRRIIBBUUTTEESS)) 1059236769Sobrien ..EEXXEECC Target is never out of date, but always execute commands any- 1060236769Sobrien way. 1061236769Sobrien 1062236769Sobrien ..IIGGNNOORREE Ignore any errors from the commands associated with this tar- 1063236769Sobrien get, exactly as if they all were preceded by a dash (`-'). 1064236769Sobrien 1065236769Sobrien ..MMAADDEE Mark all sources of this target as being up-to-date. 1066236769Sobrien 1067236769Sobrien ..MMAAKKEE Execute the commands associated with this target even if the --nn 1068236769Sobrien or --tt options were specified. Normally used to mark recursive 1069236769Sobrien bbmmaakkee's. 1070236769Sobrien 1071236769Sobrien ..MMEETTAA Create a meta file for the target, even if it is flagged as 1072236769Sobrien ..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL. Usage in conjunction with ..MMAAKKEE is 1073236769Sobrien the most likely case. In "meta" mode, the target is out-of- 1074236769Sobrien date if the meta file is missing. 1075236769Sobrien 1076236769Sobrien ..NNOOMMEETTAA Do not create a meta file for the target. Meta files are also 1077236769Sobrien not created for ..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL targets. 1078236769Sobrien 1079236769Sobrien ..NNOOMMEETTAA__CCMMPP 1080236769Sobrien Ignore differences in commands when deciding if target is out 1081236769Sobrien of date. This is useful if the command contains a value which 1082236769Sobrien always changes. If the number of commands change, though, the 1083236769Sobrien target will still be out of date. 1084236769Sobrien 1085236769Sobrien ..NNOOPPAATTHH Do not search for the target in the directories specified by 1086236769Sobrien ..PPAATTHH. 1087236769Sobrien 1088236769Sobrien ..NNOOTTMMAAIINN Normally bbmmaakkee selects the first target it encounters as the 1089236769Sobrien default target to be built if no target was specified. This 1090236769Sobrien source prevents this target from being selected. 1091236769Sobrien 1092236769Sobrien ..OOPPTTIIOONNAALL 1093236769Sobrien If a target is marked with this attribute and bbmmaakkee can't fig- 1094236769Sobrien ure out how to create it, it will ignore this fact and assume 1095236769Sobrien the file isn't needed or already exists. 1096236769Sobrien 1097236769Sobrien ..PPHHOONNYY The target does not correspond to an actual file; it is always 1098236769Sobrien considered to be out of date, and will not be created with the 1099236769Sobrien --tt option. Suffix-transformation rules are not applied to 1100236769Sobrien ..PPHHOONNYY targets. 1101236769Sobrien 1102236769Sobrien ..PPRREECCIIOOUUSS 1103236769Sobrien When bbmmaakkee is interrupted, it normally removes any partially 1104236769Sobrien made targets. This source prevents the target from being 1105236769Sobrien removed. 1106236769Sobrien 1107236769Sobrien ..RREECCUURRSSIIVVEE 1108236769Sobrien Synonym for ..MMAAKKEE. 1109236769Sobrien 1110236769Sobrien ..SSIILLEENNTT Do not echo any of the commands associated with this target, 1111236769Sobrien exactly as if they all were preceded by an at sign (`@'). 1112236769Sobrien 1113236769Sobrien ..UUSSEE Turn the target into bbmmaakkee's version of a macro. When the tar- 1114236769Sobrien get is used as a source for another target, the other target 1115236769Sobrien acquires the commands, sources, and attributes (except for 1116236769Sobrien ..UUSSEE) of the source. If the target already has commands, the 1117236769Sobrien ..UUSSEE target's commands are appended to them. 1118236769Sobrien 1119236769Sobrien ..UUSSEEBBEEFFOORREE 1120236769Sobrien Exactly like ..UUSSEE, but prepend the ..UUSSEEBBEEFFOORREE target commands 1121236769Sobrien to the target. 1122236769Sobrien 1123236769Sobrien ..WWAAIITT If ..WWAAIITT appears in a dependency line, the sources that precede 1124236769Sobrien it are made before the sources that succeed it in the line. 1125236769Sobrien Since the dependents of files are not made until the file 1126236769Sobrien itself could be made, this also stops the dependents being 1127236769Sobrien built unless they are needed for another branch of the depen- 1128236769Sobrien dency tree. So given: 1129236769Sobrien 1130236769Sobrien x: a .WAIT b 1131236769Sobrien echo x 1132236769Sobrien a: 1133236769Sobrien echo a 1134236769Sobrien b: b1 1135236769Sobrien echo b 1136236769Sobrien b1: 1137236769Sobrien echo b1 1138236769Sobrien 1139236769Sobrien the output is always `a', `b1', `b', `x'. 1140236769Sobrien The ordering imposed by ..WWAAIITT is only relevant for parallel 1141236769Sobrien makes. 1142236769Sobrien 1143236769SobrienSSPPEECCIIAALL TTAARRGGEETTSS 1144236769Sobrien Special targets may not be included with other targets, i.e. they must be 1145236769Sobrien the only target specified. 1146236769Sobrien 1147236769Sobrien ..BBEEGGIINN Any command lines attached to this target are executed before 1148236769Sobrien anything else is done. 1149236769Sobrien 1150236769Sobrien ..DDEEFFAAUULLTT 1151236769Sobrien This is sort of a ..UUSSEE rule for any target (that was used only 1152236769Sobrien as a source) that bbmmaakkee can't figure out any other way to cre- 1153236769Sobrien ate. Only the shell script is used. The ..IIMMPPSSRRCC variable of a 1154236769Sobrien target that inherits ..DDEEFFAAUULLTT's commands is set to the target's 1155236769Sobrien own name. 1156236769Sobrien 1157236769Sobrien ..EENNDD Any command lines attached to this target are executed after 1158236769Sobrien everything else is done. 1159236769Sobrien 1160236769Sobrien ..EERRRROORR Any command lines attached to this target are executed when 1161236769Sobrien another target fails. The ..EERRRROORR__TTAARRGGEETT variable is set to the 1162236769Sobrien target that failed. See also MMAAKKEE__PPRRIINNTT__VVAARR__OONN__EERRRROORR. 1163236769Sobrien 1164236769Sobrien ..IIGGNNOORREE Mark each of the sources with the ..IIGGNNOORREE attribute. If no 1165236769Sobrien sources are specified, this is the equivalent of specifying the 1166236769Sobrien --ii option. 1167236769Sobrien 1168236769Sobrien ..IINNTTEERRRRUUPPTT 1169236769Sobrien If bbmmaakkee is interrupted, the commands for this target will be 1170236769Sobrien executed. 1171236769Sobrien 1172236769Sobrien ..MMAAIINN If no target is specified when bbmmaakkee is invoked, this target 1173236769Sobrien will be built. 1174236769Sobrien 1175236769Sobrien ..MMAAKKEEFFLLAAGGSS 1176236769Sobrien This target provides a way to specify flags for bbmmaakkee when the 1177236769Sobrien makefile is used. The flags are as if typed to the shell, 1178236769Sobrien though the --ff option will have no effect. 1179236769Sobrien 1180236769Sobrien ..NNOOPPAATTHH Apply the ..NNOOPPAATTHH attribute to any specified sources. 1181236769Sobrien 1182236769Sobrien ..NNOOTTPPAARRAALLLLEELL 1183236769Sobrien Disable parallel mode. 1184236769Sobrien 1185236769Sobrien ..NNOO__PPAARRAALLLLEELL 1186236769Sobrien Synonym for ..NNOOTTPPAARRAALLLLEELL, for compatibility with other pmake 1187236769Sobrien variants. 1188236769Sobrien 1189236769Sobrien ..OORRDDEERR The named targets are made in sequence. This ordering does not 1190236769Sobrien add targets to the list of targets to be made. Since the depen- 1191236769Sobrien dents of a target do not get built until the target itself could 1192236769Sobrien be built, unless `a' is built by another part of the dependency 1193236769Sobrien graph, the following is a dependency loop: 1194236769Sobrien 1195236769Sobrien .ORDER: b a 1196236769Sobrien b: a 1197236769Sobrien 1198236769Sobrien The ordering imposed by ..OORRDDEERR is only relevant for parallel 1199236769Sobrien makes. 1200236769Sobrien 1201236769Sobrien ..PPAATTHH The sources are directories which are to be searched for files 1202236769Sobrien not found in the current directory. If no sources are speci- 1203236769Sobrien fied, any previously specified directories are deleted. If the 1204236769Sobrien source is the special ..DDOOTTLLAASSTT target, then the current working 1205236769Sobrien directory is searched last. 1206236769Sobrien 1207236769Sobrien ..PPHHOONNYY Apply the ..PPHHOONNYY attribute to any specified sources. 1208236769Sobrien 1209236769Sobrien ..PPRREECCIIOOUUSS 1210236769Sobrien Apply the ..PPRREECCIIOOUUSS attribute to any specified sources. If no 1211236769Sobrien sources are specified, the ..PPRREECCIIOOUUSS attribute is applied to 1212236769Sobrien every target in the file. 1213236769Sobrien 1214236769Sobrien ..SSHHEELLLL Sets the shell that bbmmaakkee will use to execute commands. The 1215236769Sobrien sources are a set of _f_i_e_l_d_=_v_a_l_u_e pairs. 1216236769Sobrien 1217236769Sobrien _n_a_m_e This is the minimal specification, used to select 1218236769Sobrien one of the builtin shell specs; _s_h, _k_s_h, and _c_s_h. 1219236769Sobrien 1220236769Sobrien _p_a_t_h Specifies the path to the shell. 1221236769Sobrien 1222236769Sobrien _h_a_s_E_r_r_C_t_l Indicates whether the shell supports exit on error. 1223236769Sobrien 1224236769Sobrien _c_h_e_c_k The command to turn on error checking. 1225236769Sobrien 1226236769Sobrien _i_g_n_o_r_e The command to disable error checking. 1227236769Sobrien 1228236769Sobrien _e_c_h_o The command to turn on echoing of commands executed. 1229236769Sobrien 1230236769Sobrien _q_u_i_e_t The command to turn off echoing of commands exe- 1231236769Sobrien cuted. 1232236769Sobrien 1233236769Sobrien _f_i_l_t_e_r The output to filter after issuing the _q_u_i_e_t com- 1234236769Sobrien mand. It is typically identical to _q_u_i_e_t. 1235236769Sobrien 1236236769Sobrien _e_r_r_F_l_a_g The flag to pass the shell to enable error checking. 1237236769Sobrien 1238236769Sobrien _e_c_h_o_F_l_a_g The flag to pass the shell to enable command echo- 1239236769Sobrien ing. 1240236769Sobrien 1241236769Sobrien _n_e_w_l_i_n_e The string literal to pass the shell that results in 1242236769Sobrien a single newline character when used outside of any 1243236769Sobrien quoting characters. 1244236769Sobrien Example: 1245236769Sobrien 1246236769Sobrien .SHELL: name=ksh path=/bin/ksh hasErrCtl=true \ 1247236769Sobrien check="set -e" ignore="set +e" \ 1248236769Sobrien echo="set -v" quiet="set +v" filter="set +v" \ 1249236769Sobrien echoFlag=v errFlag=e newline="'\n'" 1250236769Sobrien 1251236769Sobrien ..SSIILLEENNTT Apply the ..SSIILLEENNTT attribute to any specified sources. If no 1252236769Sobrien sources are specified, the ..SSIILLEENNTT attribute is applied to every 1253236769Sobrien command in the file. 1254236769Sobrien 1255236769Sobrien ..SSUUFFFFIIXXEESS 1256236769Sobrien Each source specifies a suffix to bbmmaakkee. If no sources are 1257236769Sobrien specified, any previously specified suffixes are deleted. It 1258236769Sobrien allows the creation of suffix-transformation rules. 1259236769Sobrien 1260236769Sobrien Example: 1261236769Sobrien 1262236769Sobrien .SUFFIXES: .o 1263236769Sobrien .c.o: 1264236769Sobrien cc -o ${.TARGET} -c ${.IMPSRC} 1265236769Sobrien 1266236769SobrienEENNVVIIRROONNMMEENNTT 1267236769Sobrien bbmmaakkee uses the following environment variables, if they exist: MACHINE, 1268236769Sobrien MACHINE_ARCH, MAKE, MAKEFLAGS, MAKEOBJDIR, MAKEOBJDIRPREFIX, MAKESYSPATH, 1269236769Sobrien PWD, and TMPDIR. 1270236769Sobrien 1271236769Sobrien MAKEOBJDIRPREFIX and MAKEOBJDIR may only be set in the environment or on 1272236769Sobrien the command line to bbmmaakkee and not as makefile variables; see the descrip- 1273236769Sobrien tion of `_._O_B_J_D_I_R' for more details. 1274236769Sobrien 1275236769SobrienFFIILLEESS 1276236769Sobrien .depend list of dependencies 1277236769Sobrien Makefile list of dependencies 1278236769Sobrien makefile list of dependencies 1279236769Sobrien sys.mk system makefile 1280236769Sobrien /usr/share/mk system makefile directory 1281236769Sobrien 1282236769SobrienCCOOMMPPAATTIIBBIILLIITTYY 1283236769Sobrien The basic make syntax is compatible between different versions of make, 1284236769Sobrien however the special variables, variable modifiers and conditionals are 1285236769Sobrien not. 1286236769Sobrien 1287236769Sobrien The way that parallel makes are scheduled changed in NetBSD 4.0 so that 1288236769Sobrien .ORDER and .WAIT apply recursively to the dependent nodes. The algo- 1289236769Sobrien rithms used may change again in the future. 1290236769Sobrien 1291236769Sobrien The way that .for loop variables are substituted changed after NetBSD 5.0 1292236769Sobrien so that they still appear to be variable expansions. In particular this 1293236769Sobrien stops them being treated as syntax, and removes some obscure problems 1294236769Sobrien using them in .if statements. 1295236769Sobrien 1296236769Sobrien Unlike other bbmmaakkee programs, this implementation by default executes all 1297236769Sobrien commands for a given target using a single shell invocation. This is 1298236769Sobrien done for both efficiency and to simplify error handling in remote command 1299236769Sobrien invocations. Typically this is transparent to the user, unless the tar- 1300236769Sobrien get commands change the current working directory using ``cd'' or 1301236769Sobrien ``chdir''. To be compatible with Makefiles that do this, one can use --BB 1302236769Sobrien to disable this behavior. 1303236769Sobrien 1304236769SobrienSSEEEE AALLSSOO 1305236769Sobrien mkdep(1) 1306236769Sobrien 1307236769SobrienHHIISSTTOORRYY 1308236769Sobrien bbmmaakkee is derived from NetBSD make(1). It uses autoconf to facilitate 1309240330SmarcelMAKE(1) NetBSD General Commands Manual MAKE(1) 1310240330Smarcel 1311236769Sobrien portability to other platforms. 1312236769Sobrien 1313240330SmarcelNNAAMMEE 1314240330Smarcel bbmmaakkee -- maintain program dependencies 1315240330Smarcel 1316240330SmarcelSSYYNNOOPPSSIISS 1317240330Smarcel 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] 1318240330Smarcel [--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] 1319240330Smarcel [--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] 1320240330Smarcel [_t_a_r_g_e_t _._._.] 1321240330Smarcel 1322240330SmarcelDDEESSCCRRIIPPTTIIOONN 1323240330Smarcel bbmmaakkee is a program designed to simplify the maintenance of other pro- 1324240330Smarcel grams. Its input is a list of specifications as to the files upon which 1325240330Smarcel programs and other files depend. If no --ff _m_a_k_e_f_i_l_e makefile option is 1326240330Smarcel 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 1327240330Smarcel the specifications. If the file `_._d_e_p_e_n_d' exists, it is read (see 1328240330Smarcel mkdep(1)). 1329240330Smarcel 1330240330Smarcel This manual page is intended as a reference document only. For a more 1331240330Smarcel thorough description of bbmmaakkee and makefiles, please refer to _P_M_a_k_e _- _A 1332240330Smarcel _T_u_t_o_r_i_a_l. 1333240330Smarcel 1334240330Smarcel bbmmaakkee will prepend the contents of the _M_A_K_E_F_L_A_G_S environment variable to 1335240330Smarcel the command line arguments before parsing them. 1336240330Smarcel 1337240330Smarcel The options are as follows: 1338240330Smarcel 1339240330Smarcel --BB Try to be backwards compatible by executing a single shell per 1340240330Smarcel command and by executing the commands to make the sources of a 1341240330Smarcel dependency line in sequence. 1342240330Smarcel 1343240330Smarcel --CC _d_i_r_e_c_t_o_r_y 1344240330Smarcel Change to _d_i_r_e_c_t_o_r_y before reading the makefiles or doing any- 1345240330Smarcel thing else. If multiple --CC options are specified, each is inter- 1346240330Smarcel preted relative to the previous one: --CC _/ --CC _e_t_c is equivalent to 1347240330Smarcel --CC _/_e_t_c. 1348240330Smarcel 1349240330Smarcel --DD _v_a_r_i_a_b_l_e 1350240330Smarcel Define _v_a_r_i_a_b_l_e to be 1, in the global context. 1351240330Smarcel 1352240330Smarcel --dd _[_-_]_f_l_a_g_s 1353240330Smarcel Turn on debugging, and specify which portions of bbmmaakkee are to 1354240330Smarcel print debugging information. Unless the flags are preceded by 1355240330Smarcel `-' they are added to the _M_A_K_E_F_L_A_G_S environment variable and will 1356240330Smarcel be processed by any child make processes. By default, debugging 1357240330Smarcel information is printed to standard error, but this can be changed 1358240330Smarcel using the _F debugging flag. The debugging output is always 1359240330Smarcel unbuffered; in addition, if debugging is enabled but debugging 1360240330Smarcel output is not directed to standard output, then the standard out- 1361240330Smarcel put is line buffered. _F_l_a_g_s is one or more of the following: 1362240330Smarcel 1363240330Smarcel _A Print all possible debugging information; equivalent to 1364240330Smarcel specifying all of the debugging flags. 1365240330Smarcel 1366240330Smarcel _a Print debugging information about archive searching and 1367240330Smarcel caching. 1368240330Smarcel 1369240330Smarcel _C Print debugging information about current working direc- 1370240330Smarcel tory. 1371240330Smarcel 1372240330Smarcel _c Print debugging information about conditional evaluation. 1373240330Smarcel 1374240330Smarcel _d Print debugging information about directory searching and 1375240330Smarcel caching. 1376240330Smarcel 1377240330Smarcel _e Print debugging information about failed commands and 1378240330Smarcel targets. 1379240330Smarcel 1380240330Smarcel _F[++]_f_i_l_e_n_a_m_e 1381240330Smarcel Specify where debugging output is written. This must be 1382240330Smarcel the last flag, because it consumes the remainder of the 1383240330Smarcel argument. If the character immediately after the `F' 1384240330Smarcel flag is `+', then the file will be opened in append mode; 1385240330Smarcel otherwise the file will be overwritten. If the file name 1386240330Smarcel is `stdout' or `stderr' then debugging output will be 1387240330Smarcel written to the standard output or standard error output 1388240330Smarcel file descriptors respectively (and the `+' option has no 1389240330Smarcel effect). Otherwise, the output will be written to the 1390240330Smarcel named file. If the file name ends `.%d' then the `%d' is 1391240330Smarcel replaced by the pid. 1392240330Smarcel 1393240330Smarcel _f Print debugging information about loop evaluation. 1394240330Smarcel 1395240330Smarcel _g_1 Print the input graph before making anything. 1396240330Smarcel 1397240330Smarcel _g_2 Print the input graph after making everything, or before 1398240330Smarcel exiting on error. 1399240330Smarcel 1400240330Smarcel _g_3 Print the input graph before exiting on error. 1401240330Smarcel 1402240330Smarcel _j Print debugging information about running multiple 1403240330Smarcel shells. 1404240330Smarcel 1405240330Smarcel _l Print commands in Makefiles regardless of whether or not 1406240330Smarcel they are prefixed by `@' or other "quiet" flags. Also 1407240330Smarcel known as "loud" behavior. 1408240330Smarcel 1409240330Smarcel _M Print debugging information about "meta" mode decisions 1410240330Smarcel about targets. 1411240330Smarcel 1412240330Smarcel _m Print debugging information about making targets, includ- 1413240330Smarcel ing modification dates. 1414240330Smarcel 1415240330Smarcel _n Don't delete the temporary command scripts created when 1416240330Smarcel running commands. These temporary scripts are created in 1417240330Smarcel the directory referred to by the TMPDIR environment vari- 1418240330Smarcel able, or in _/_t_m_p if TMPDIR is unset or set to the empty 1419240330Smarcel string. The temporary scripts are created by mkstemp(3), 1420240330Smarcel and have names of the form _m_a_k_e_X_X_X_X_X_X. _N_O_T_E: This can 1421240330Smarcel create many files in TMPDIR or _/_t_m_p, so use with care. 1422240330Smarcel 1423240330Smarcel _p Print debugging information about makefile parsing. 1424240330Smarcel 1425240330Smarcel _s Print debugging information about suffix-transformation 1426240330Smarcel rules. 1427240330Smarcel 1428240330Smarcel _t Print debugging information about target list mainte- 1429240330Smarcel nance. 1430240330Smarcel 1431240330Smarcel _V Force the --VV option to print raw value of variables. 1432240330Smarcel 1433240330Smarcel _v Print debugging information about variable assignment. 1434240330Smarcel 1435240330Smarcel _x Run shell commands with --xx so the actual commands are 1436240330Smarcel printed as they are executed. 1437240330Smarcel 1438240330Smarcel --ee Specify that environment variables override macro assignments 1439240330Smarcel within makefiles. 1440240330Smarcel 1441240330Smarcel --ff _m_a_k_e_f_i_l_e 1442240330Smarcel Specify a makefile to read instead of the default `_m_a_k_e_f_i_l_e'. If 1443240330Smarcel _m_a_k_e_f_i_l_e is `--', standard input is read. Multiple makefiles may 1444240330Smarcel be specified, and are read in the order specified. 1445240330Smarcel 1446240330Smarcel --II _d_i_r_e_c_t_o_r_y 1447240330Smarcel Specify a directory in which to search for makefiles and included 1448240330Smarcel makefiles. The system makefile directory (or directories, see 1449240330Smarcel the --mm option) is automatically included as part of this list. 1450240330Smarcel 1451240330Smarcel --ii Ignore non-zero exit of shell commands in the makefile. Equiva- 1452240330Smarcel lent to specifying `--' before each command line in the makefile. 1453240330Smarcel 1454240330Smarcel --JJ _p_r_i_v_a_t_e 1455240330Smarcel This option should _n_o_t be specified by the user. 1456240330Smarcel 1457240330Smarcel When the _j option is in use in a recursive build, this option is 1458240330Smarcel passed by a make to child makes to allow all the make processes 1459240330Smarcel in the build to cooperate to avoid overloading the system. 1460240330Smarcel 1461240330Smarcel --jj _m_a_x___j_o_b_s 1462240330Smarcel Specify the maximum number of jobs that bbmmaakkee may have running at 1463240330Smarcel any one time. The value is saved in _._M_A_K_E_._J_O_B_S. Turns compati- 1464240330Smarcel bility mode off, unless the _B flag is also specified. When com- 1465240330Smarcel patibility mode is off, all commands associated with a target are 1466240330Smarcel executed in a single shell invocation as opposed to the tradi- 1467240330Smarcel tional one shell invocation per line. This can break traditional 1468240330Smarcel scripts which change directories on each command invocation and 1469240330Smarcel then expect to start with a fresh environment on the next line. 1470240330Smarcel It is more efficient to correct the scripts rather than turn 1471240330Smarcel backwards compatibility on. 1472240330Smarcel 1473240330Smarcel --kk Continue processing after errors are encountered, but only on 1474240330Smarcel those targets that do not depend on the target whose creation 1475240330Smarcel caused the error. 1476240330Smarcel 1477240330Smarcel --mm _d_i_r_e_c_t_o_r_y 1478240330Smarcel Specify a directory in which to search for sys.mk and makefiles 1479240330Smarcel included via the <_f_i_l_e>-style include statement. The --mm option 1480240330Smarcel can be used multiple times to form a search path. This path will 1481240330Smarcel override the default system include path: /usr/share/mk. Fur- 1482240330Smarcel thermore the system include path will be appended to the search 1483240330Smarcel path used for "_f_i_l_e"-style include statements (see the --II 1484240330Smarcel option). 1485240330Smarcel 1486240330Smarcel If a file or directory name in the --mm argument (or the 1487240330Smarcel MAKESYSPATH environment variable) starts with the string ".../" 1488240330Smarcel then bbmmaakkee will search for the specified file or directory named 1489240330Smarcel in the remaining part of the argument string. The search starts 1490240330Smarcel with the current directory of the Makefile and then works upward 1491240330Smarcel towards the root of the filesystem. If the search is successful, 1492240330Smarcel then the resulting directory replaces the ".../" specification in 1493240330Smarcel the --mm argument. If used, this feature allows bbmmaakkee to easily 1494240330Smarcel search in the current source tree for customized sys.mk files 1495240330Smarcel (e.g., by using ".../mk/sys.mk" as an argument). 1496240330Smarcel 1497240330Smarcel --nn Display the commands that would have been executed, but do not 1498240330Smarcel actually execute them unless the target depends on the .MAKE spe- 1499240330Smarcel cial source (see below). 1500240330Smarcel 1501240330Smarcel --NN Display the commands which would have been executed, but do not 1502240330Smarcel actually execute any of them; useful for debugging top-level 1503240330Smarcel makefiles without descending into subdirectories. 1504240330Smarcel 1505240330Smarcel --qq Do not execute any commands, but exit 0 if the specified targets 1506240330Smarcel are up-to-date and 1, otherwise. 1507240330Smarcel 1508240330Smarcel --rr Do not use the built-in rules specified in the system makefile. 1509240330Smarcel 1510240330Smarcel --ss Do not echo any commands as they are executed. Equivalent to 1511240330Smarcel specifying `@@' before each command line in the makefile. 1512240330Smarcel 1513240330Smarcel --TT _t_r_a_c_e_f_i_l_e 1514240330Smarcel When used with the --jj flag, append a trace record to _t_r_a_c_e_f_i_l_e 1515240330Smarcel for each job started and completed. 1516240330Smarcel 1517240330Smarcel --tt Rather than re-building a target as specified in the makefile, 1518240330Smarcel create it or update its modification time to make it appear up- 1519240330Smarcel to-date. 1520240330Smarcel 1521240330Smarcel --VV _v_a_r_i_a_b_l_e 1522240330Smarcel Print bbmmaakkee's idea of the value of _v_a_r_i_a_b_l_e, in the global con- 1523240330Smarcel text. Do not build any targets. Multiple instances of this 1524240330Smarcel option may be specified; the variables will be printed one per 1525240330Smarcel line, with a blank line for each null or undefined variable. If 1526240330Smarcel _v_a_r_i_a_b_l_e contains a `$' then the value will be expanded before 1527240330Smarcel printing. 1528240330Smarcel 1529240330Smarcel --WW Treat any warnings during makefile parsing as errors. 1530240330Smarcel 1531240330Smarcel --XX Don't export variables passed on the command line to the environ- 1532240330Smarcel ment individually. Variables passed on the command line are 1533240330Smarcel still exported via the _M_A_K_E_F_L_A_G_S environment variable. This 1534240330Smarcel option may be useful on systems which have a small limit on the 1535240330Smarcel size of command arguments. 1536240330Smarcel 1537240330Smarcel _v_a_r_i_a_b_l_e_=_v_a_l_u_e 1538240330Smarcel Set the value of the variable _v_a_r_i_a_b_l_e to _v_a_l_u_e. Normally, all 1539240330Smarcel values passed on the command line are also exported to sub-makes 1540240330Smarcel in the environment. The --XX flag disables this behavior. Vari- 1541240330Smarcel able assignments should follow options for POSIX compatibility 1542240330Smarcel but no ordering is enforced. 1543240330Smarcel 1544240330Smarcel There are seven different types of lines in a makefile: file dependency 1545240330Smarcel specifications, shell commands, variable assignments, include statements, 1546240330Smarcel conditional directives, for loops, and comments. 1547240330Smarcel 1548240330Smarcel In general, lines may be continued from one line to the next by ending 1549240330Smarcel them with a backslash (`\'). The trailing newline character and initial 1550240330Smarcel whitespace on the following line are compressed into a single space. 1551240330Smarcel 1552240330SmarcelFFIILLEE DDEEPPEENNDDEENNCCYY SSPPEECCIIFFIICCAATTIIOONNSS 1553240330Smarcel Dependency lines consist of one or more targets, an operator, and zero or 1554240330Smarcel more sources. This creates a relationship where the targets ``depend'' 1555240330Smarcel on the sources and are usually created from them. The exact relationship 1556240330Smarcel between the target and the source is determined by the operator that sep- 1557240330Smarcel arates them. The three operators are as follows: 1558240330Smarcel 1559240330Smarcel :: A target is considered out-of-date if its modification time is less 1560240330Smarcel than those of any of its sources. Sources for a target accumulate 1561240330Smarcel over dependency lines when this operator is used. The target is 1562240330Smarcel removed if bbmmaakkee is interrupted. 1563240330Smarcel 1564240330Smarcel !! Targets are always re-created, but not until all sources have been 1565240330Smarcel examined and re-created as necessary. Sources for a target accumu- 1566240330Smarcel late over dependency lines when this operator is used. The target 1567240330Smarcel is removed if bbmmaakkee is interrupted. 1568240330Smarcel 1569240330Smarcel :::: If no sources are specified, the target is always re-created. Oth- 1570240330Smarcel erwise, a target is considered out-of-date if any of its sources 1571240330Smarcel has been modified more recently than the target. Sources for a 1572240330Smarcel target do not accumulate over dependency lines when this operator 1573240330Smarcel is used. The target will not be removed if bbmmaakkee is interrupted. 1574240330Smarcel 1575240330Smarcel Targets and sources may contain the shell wildcard values `?', `*', `[]', 1576240330Smarcel and `{}'. The values `?', `*', and `[]' may only be used as part of the 1577240330Smarcel final component of the target or source, and must be used to describe 1578240330Smarcel existing files. The value `{}' need not necessarily be used to describe 1579240330Smarcel existing files. Expansion is in directory order, not alphabetically as 1580240330Smarcel done in the shell. 1581240330Smarcel 1582240330SmarcelSSHHEELLLL CCOOMMMMAANNDDSS 1583240330Smarcel Each target may have associated with it a series of shell commands, nor- 1584240330Smarcel mally used to create the target. Each of the commands in this script 1585240330Smarcel _m_u_s_t be preceded by a tab. While any target may appear on a dependency 1586240330Smarcel line, only one of these dependencies may be followed by a creation 1587240330Smarcel script, unless the `::::' operator is used. 1588240330Smarcel 1589240330Smarcel If the first characters of the command line are any combination of `@@', 1590240330Smarcel `++', or `--', the command is treated specially. A `@@' causes the command 1591240330Smarcel not to be echoed before it is executed. A `++' causes the command to be 1592240330Smarcel executed even when --nn is given. This is similar to the effect of the 1593240330Smarcel .MAKE special source, except that the effect can be limited to a single 1594240330Smarcel line of a script. A `--' causes any non-zero exit status of the command 1595240330Smarcel line to be ignored. 1596240330Smarcel 1597240330SmarcelVVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS 1598240330Smarcel Variables in make are much like variables in the shell, and, by tradi- 1599240330Smarcel tion, consist of all upper-case letters. 1600240330Smarcel 1601240330Smarcel VVaarriiaabbllee aassssiiggnnmmeenntt mmooddiiffiieerrss 1602240330Smarcel The five operators that can be used to assign values to variables are as 1603240330Smarcel follows: 1604240330Smarcel 1605240330Smarcel == Assign the value to the variable. Any previous value is overrid- 1606240330Smarcel den. 1607240330Smarcel 1608240330Smarcel ++== Append the value to the current value of the variable. 1609240330Smarcel 1610240330Smarcel ??== Assign the value to the variable if it is not already defined. 1611240330Smarcel 1612240330Smarcel ::== Assign with expansion, i.e. expand the value before assigning it 1613240330Smarcel to the variable. Normally, expansion is not done until the vari- 1614240330Smarcel able is referenced. _N_O_T_E: References to undefined variables are 1615240330Smarcel _n_o_t expanded. This can cause problems when variable modifiers 1616240330Smarcel are used. 1617240330Smarcel 1618240330Smarcel !!== Expand the value and pass it to the shell for execution and 1619240330Smarcel assign the result to the variable. Any newlines in the result 1620240330Smarcel are replaced with spaces. 1621240330Smarcel 1622240330Smarcel Any white-space before the assigned _v_a_l_u_e is removed; if the value is 1623240330Smarcel being appended, a single space is inserted between the previous contents 1624240330Smarcel of the variable and the appended value. 1625240330Smarcel 1626240330Smarcel Variables are expanded by surrounding the variable name with either curly 1627240330Smarcel braces (`{}') or parentheses (`()') and preceding it with a dollar sign 1628240330Smarcel (`$'). If the variable name contains only a single letter, the surround- 1629240330Smarcel ing braces or parentheses are not required. This shorter form is not 1630240330Smarcel recommended. 1631240330Smarcel 1632240330Smarcel If the variable name contains a dollar, then the name itself is expanded 1633240330Smarcel first. This allows almost arbitrary variable names, however names con- 1634240330Smarcel taining dollar, braces, parenthesis, or whitespace are really best 1635240330Smarcel avoided! 1636240330Smarcel 1637240330Smarcel If the result of expanding a variable contains a dollar sign (`$') the 1638240330Smarcel string is expanded again. 1639240330Smarcel 1640240330Smarcel Variable substitution occurs at three distinct times, depending on where 1641240330Smarcel the variable is being used. 1642240330Smarcel 1643240330Smarcel 1. Variables in dependency lines are expanded as the line is read. 1644240330Smarcel 1645240330Smarcel 2. Variables in shell commands are expanded when the shell command is 1646240330Smarcel executed. 1647240330Smarcel 1648240330Smarcel 3. ``.for'' loop index variables are expanded on each loop iteration. 1649240330Smarcel Note that other variables are not expanded inside loops so the fol- 1650240330Smarcel lowing example code: 1651240330Smarcel 1652240330Smarcel 1653240330Smarcel .for i in 1 2 3 1654240330Smarcel a+= ${i} 1655240330Smarcel j= ${i} 1656240330Smarcel b+= ${j} 1657240330Smarcel .endfor 1658240330Smarcel 1659240330Smarcel all: 1660240330Smarcel @echo ${a} 1661240330Smarcel @echo ${b} 1662240330Smarcel 1663240330Smarcel will print: 1664240330Smarcel 1665240330Smarcel 1 2 3 1666240330Smarcel 3 3 3 1667240330Smarcel 1668240330Smarcel Because while ${a} contains ``1 2 3'' after the loop is executed, 1669240330Smarcel ${b} contains ``${j} ${j} ${j}'' which expands to ``3 3 3'' since 1670240330Smarcel after the loop completes ${j} contains ``3''. 1671240330Smarcel 1672240330Smarcel VVaarriiaabbllee ccllaasssseess 1673240330Smarcel The four different classes of variables (in order of increasing prece- 1674240330Smarcel dence) are: 1675240330Smarcel 1676240330Smarcel Environment variables 1677240330Smarcel Variables defined as part of bbmmaakkee's environment. 1678240330Smarcel 1679240330Smarcel Global variables 1680240330Smarcel Variables defined in the makefile or in included makefiles. 1681240330Smarcel 1682240330Smarcel Command line variables 1683240330Smarcel Variables defined as part of the command line. 1684240330Smarcel 1685240330Smarcel Local variables 1686240330Smarcel Variables that are defined specific to a certain target. The 1687240330Smarcel seven local variables are as follows: 1688240330Smarcel 1689240330Smarcel _._A_L_L_S_R_C The list of all sources for this target; also known as 1690240330Smarcel `_>'. 1691240330Smarcel 1692240330Smarcel _._A_R_C_H_I_V_E The name of the archive file. 1693240330Smarcel 1694240330Smarcel _._I_M_P_S_R_C In suffix-transformation rules, the name/path of the 1695240330Smarcel source from which the target is to be transformed (the 1696240330Smarcel ``implied'' source); also known as `_<'. It is not 1697240330Smarcel defined in explicit rules. 1698240330Smarcel 1699240330Smarcel _._M_E_M_B_E_R The name of the archive member. 1700240330Smarcel 1701240330Smarcel _._O_O_D_A_T_E The list of sources for this target that were deemed 1702240330Smarcel out-of-date; also known as `_?'. 1703240330Smarcel 1704240330Smarcel _._P_R_E_F_I_X The file prefix of the target, containing only the file 1705240330Smarcel portion, no suffix or preceding directory components; 1706240330Smarcel also known as `_*'. 1707240330Smarcel 1708240330Smarcel _._T_A_R_G_E_T The name of the target; also known as `_@'. 1709240330Smarcel 1710240330Smarcel The shorter forms `_@', `_?', `_<', `_>', and `_*' are permitted for 1711240330Smarcel backward compatibility with historical makefiles and are not rec- 1712240330Smarcel ommended. The six variables `_@_F', `_@_D', `_<_F', `_<_D', `_*_F', and 1713240330Smarcel `_*_D' are permitted for compatibility with AT&T System V UNIX 1714240330Smarcel makefiles and are not recommended. 1715240330Smarcel 1716240330Smarcel Four of the local variables may be used in sources on dependency 1717240330Smarcel lines because they expand to the proper value for each target on 1718240330Smarcel the line. These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E', 1719240330Smarcel and `_._M_E_M_B_E_R'. 1720240330Smarcel 1721240330Smarcel AAddddiittiioonnaall bbuuiilltt--iinn vvaarriiaabblleess 1722240330Smarcel In addition, bbmmaakkee sets or knows about the following variables: 1723240330Smarcel 1724240330Smarcel _$ A single dollar sign `$', i.e. `$$' expands to a single 1725240330Smarcel dollar sign. 1726240330Smarcel 1727240330Smarcel _._A_L_L_T_A_R_G_E_T_S The list of all targets encountered in the Makefile. If 1728240330Smarcel evaluated during Makefile parsing, lists only those tar- 1729240330Smarcel gets encountered thus far. 1730240330Smarcel 1731240330Smarcel _._C_U_R_D_I_R A path to the directory where bbmmaakkee was executed. Refer 1732240330Smarcel to the description of `PWD' for more details. 1733240330Smarcel 1734240330Smarcel MAKE The name that bbmmaakkee was executed with (_a_r_g_v_[_0_]). For 1735240330Smarcel compatibility bbmmaakkee also sets _._M_A_K_E with the same value. 1736240330Smarcel The preferred variable to use is the environment variable 1737240330Smarcel MAKE because it is more compatible with other versions of 1738240330Smarcel bbmmaakkee and cannot be confused with the special target with 1739240330Smarcel the same name. 1740240330Smarcel 1741240330Smarcel _._M_A_K_E_._D_E_P_E_N_D_F_I_L_E 1742240330Smarcel Names the makefile (default `_._d_e_p_e_n_d') from which gener- 1743240330Smarcel ated dependencies are read. 1744240330Smarcel 1745240330Smarcel _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S 1746240330Smarcel A boolean that controls the default behavior of the --VV 1747240330Smarcel option. 1748240330Smarcel 1749240330Smarcel _._M_A_K_E_._E_X_P_O_R_T_E_D The list of variables exported by bbmmaakkee. 1750240330Smarcel 1751240330Smarcel _._M_A_K_E_._J_O_B_S The argument to the --jj option. 1752240330Smarcel 1753240330Smarcel _._M_A_K_E_._J_O_B_._P_R_E_F_I_X 1754240330Smarcel If bbmmaakkee is run with _j then output for each target is 1755240330Smarcel prefixed with a token `--- target ---' the first part of 1756240330Smarcel which can be controlled via _._M_A_K_E_._J_O_B_._P_R_E_F_I_X. 1757240330Smarcel For example: 1758240330Smarcel .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}] 1759240330Smarcel would produce tokens like `---make[1234] target ---' mak- 1760240330Smarcel ing it easier to track the degree of parallelism being 1761240330Smarcel achieved. 1762240330Smarcel 1763240330Smarcel MAKEFLAGS The environment variable `MAKEFLAGS' may contain anything 1764240330Smarcel that may be specified on bbmmaakkee's command line. Anything 1765240330Smarcel specified on bbmmaakkee's command line is appended to the 1766240330Smarcel `MAKEFLAGS' variable which is then entered into the envi- 1767240330Smarcel ronment for all programs which bbmmaakkee executes. 1768240330Smarcel 1769240330Smarcel _._M_A_K_E_._L_E_V_E_L The recursion depth of bbmmaakkee. The initial instance of 1770240330Smarcel bbmmaakkee will be 0, and an incremented value is put into the 1771240330Smarcel environment to be seen by the next generation. This 1772240330Smarcel allows tests like: .if ${.MAKE.LEVEL} == 0 to protect 1773240330Smarcel things which should only be evaluated in the initial 1774240330Smarcel instance of bbmmaakkee. 1775240330Smarcel 1776240330Smarcel _._M_A_K_E_._M_A_K_E_F_I_L_E___P_R_E_F_E_R_E_N_C_E 1777240330Smarcel The ordered list of makefile names (default `_m_a_k_e_f_i_l_e', 1778240330Smarcel `_M_a_k_e_f_i_l_e') that bbmmaakkee will look for. 1779240330Smarcel 1780240330Smarcel _._M_A_K_E_._M_A_K_E_F_I_L_E_S 1781240330Smarcel The list of makefiles read by bbmmaakkee, which is useful for 1782240330Smarcel tracking dependencies. Each makefile is recorded only 1783240330Smarcel once, regardless of the number of times read. 1784240330Smarcel 1785240330Smarcel _._M_A_K_E_._M_O_D_E Processed after reading all makefiles. Can affect the 1786240330Smarcel mode that bbmmaakkee runs in. It can contain a number of key- 1787240330Smarcel words: 1788240330Smarcel 1789240330Smarcel _c_o_m_p_a_t Like --BB, puts bbmmaakkee into "compat" mode. 1790240330Smarcel 1791240330Smarcel _m_e_t_a Puts bbmmaakkee into "meta" mode, where meta files 1792240330Smarcel are created for each target to capture the 1793240330Smarcel command run, the output generated and if 1794240330Smarcel filemon(4) is available, the system calls 1795240330Smarcel which are of interest to bbmmaakkee. The captured 1796240330Smarcel output can be very useful when diagnosing 1797240330Smarcel errors. 1798240330Smarcel 1799240330Smarcel _c_u_r_d_i_r_O_k_= _b_f Normally bbmmaakkee will not create .meta files 1800240330Smarcel in `_._C_U_R_D_I_R'. This can be overridden by set- 1801240330Smarcel ting _b_f to a value which represents True. 1802240330Smarcel 1803240330Smarcel _e_n_v For debugging, it can be useful to inlcude 1804240330Smarcel the environment in the .meta file. 1805240330Smarcel 1806240330Smarcel _v_e_r_b_o_s_e If in "meta" mode, print a clue about the 1807240330Smarcel target being built. This is useful if the 1808240330Smarcel build is otherwise running silently. The 1809240330Smarcel message printed the value of: 1810240330Smarcel _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X. 1811240330Smarcel 1812240330Smarcel _i_g_n_o_r_e_-_c_m_d Some makefiles have commands which are simply 1813240330Smarcel not stable. This keyword causes them to be 1814240330Smarcel ignored for determining whether a target is 1815240330Smarcel out of date in "meta" mode. See also 1816240330Smarcel ..NNOOMMEETTAA__CCMMPP. 1817240330Smarcel 1818240330Smarcel _s_i_l_e_n_t_= _b_f If _b_f is True, when a .meta file is created, 1819240330Smarcel mark the target ..SSIILLEENNTT. 1820240330Smarcel 1821240330Smarcel _._M_A_K_E_._M_E_T_A_._B_A_I_L_I_W_I_C_K 1822240330Smarcel In "meta" mode, provides a list of prefixes which match 1823240330Smarcel the directories controlled by bbmmaakkee. If a file that was 1824240330Smarcel generated outside of _._O_B_J_D_I_R but within said bailiwick is 1825240330Smarcel missing, the current target is considered out-of-date. 1826240330Smarcel 1827240330Smarcel _._M_A_K_E_._M_E_T_A_._C_R_E_A_T_E_D 1828240330Smarcel In "meta" mode, this variable contains a list of all the 1829240330Smarcel meta files updated. If not empty, it can be used to 1830240330Smarcel trigger processing of _._M_A_K_E_._M_E_T_A_._F_I_L_E_S. 1831240330Smarcel 1832240330Smarcel _._M_A_K_E_._M_E_T_A_._F_I_L_E_S 1833240330Smarcel In "meta" mode, this variable contains a list of all the 1834240330Smarcel meta files used (updated or not). This list can be used 1835240330Smarcel to process the meta files to extract dependency informa- 1836240330Smarcel tion. 1837240330Smarcel 1838240330Smarcel _._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X 1839240330Smarcel Defines the message printed for each meta file updated in 1840240330Smarcel "meta verbose" mode. The default value is: 1841240330Smarcel Building ${.TARGET:H:tA}/${.TARGET:T} 1842240330Smarcel 1843240330Smarcel _._M_A_K_E_O_V_E_R_R_I_D_E_S This variable is used to record the names of variables 1844240330Smarcel assigned to on the command line, so that they may be 1845240330Smarcel exported as part of `MAKEFLAGS'. This behaviour can be 1846240330Smarcel disabled by assigning an empty value to `_._M_A_K_E_O_V_E_R_R_I_D_E_S' 1847240330Smarcel within a makefile. Extra variables can be exported from 1848240330Smarcel a makefile by appending their names to `_._M_A_K_E_O_V_E_R_R_I_D_E_S'. 1849240330Smarcel `MAKEFLAGS' is re-exported whenever `_._M_A_K_E_O_V_E_R_R_I_D_E_S' is 1850240330Smarcel modified. 1851240330Smarcel 1852240330Smarcel _._M_A_K_E_._P_I_D The process-id of bbmmaakkee. 1853240330Smarcel 1854240330Smarcel _._M_A_K_E_._P_P_I_D The parent process-id of bbmmaakkee. 1855240330Smarcel 1856240330Smarcel _M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R 1857240330Smarcel When bbmmaakkee stops due to an error, it prints its name and 1858240330Smarcel the value of `_._C_U_R_D_I_R' as well as the value of any vari- 1859240330Smarcel ables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. 1860240330Smarcel 1861240330Smarcel _._n_e_w_l_i_n_e This variable is simply assigned a newline character as 1862240330Smarcel its value. This allows expansions using the ::@@ modifier 1863240330Smarcel to put a newline between iterations of the loop rather 1864240330Smarcel than a space. For example, the printing of 1865240330Smarcel `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R' could be done as 1866240330Smarcel ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}. 1867240330Smarcel 1868240330Smarcel _._O_B_J_D_I_R A path to the directory where the targets are built. Its 1869240330Smarcel value is determined by trying to chdir(2) to the follow- 1870240330Smarcel ing directories in order and using the first match: 1871240330Smarcel 1872240330Smarcel 1. ${MAKEOBJDIRPREFIX}${.CURDIR} 1873240330Smarcel 1874240330Smarcel (Only if `MAKEOBJDIRPREFIX' is set in the environ- 1875240330Smarcel ment or on the command line.) 1876240330Smarcel 1877240330Smarcel 2. ${MAKEOBJDIR} 1878240330Smarcel 1879240330Smarcel (Only if `MAKEOBJDIR' is set in the environment or 1880240330Smarcel on the command line.) 1881240330Smarcel 1882240330Smarcel 3. ${.CURDIR}_/_o_b_j_.${MACHINE} 1883240330Smarcel 1884240330Smarcel 4. ${.CURDIR}_/_o_b_j 1885240330Smarcel 1886240330Smarcel 5. _/_u_s_r_/_o_b_j_/${.CURDIR} 1887240330Smarcel 1888240330Smarcel 6. ${.CURDIR} 1889240330Smarcel 1890240330Smarcel Variable expansion is performed on the value before it's 1891240330Smarcel used, so expressions such as 1892240330Smarcel ${.CURDIR:S,^/usr/src,/var/obj,} 1893240330Smarcel may be used. This is especially useful with 1894240330Smarcel `MAKEOBJDIR'. 1895240330Smarcel 1896240330Smarcel `_._O_B_J_D_I_R' may be modified in the makefile as a global 1897240330Smarcel variable. In all cases, bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' 1898240330Smarcel and set `PWD' to that directory before executing any tar- 1899240330Smarcel gets. 1900240330Smarcel 1901240330Smarcel _._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 1902240330Smarcel parsed. 1903240330Smarcel 1904240330Smarcel _._P_A_R_S_E_F_I_L_E The basename of the current `_M_a_k_e_f_i_l_e' being parsed. 1905240330Smarcel This variable and `_._P_A_R_S_E_D_I_R' are both set only while the 1906240330Smarcel `_M_a_k_e_f_i_l_e_s' are being parsed. If you want to retain 1907240330Smarcel their current values, assign them to a variable using 1908240330Smarcel assignment with expansion: (`::=='). 1909240330Smarcel 1910240330Smarcel _._P_A_T_H A variable that represents the list of directories that 1911240330Smarcel bbmmaakkee will search for files. The search list should be 1912240330Smarcel updated using the target `_._P_A_T_H' rather than the vari- 1913240330Smarcel able. 1914240330Smarcel 1915240330Smarcel PWD Alternate path to the current directory. bbmmaakkee normally 1916240330Smarcel sets `_._C_U_R_D_I_R' to the canonical path given by getcwd(3). 1917240330Smarcel However, if the environment variable `PWD' is set and 1918240330Smarcel gives a path to the current directory, then bbmmaakkee sets 1919240330Smarcel `_._C_U_R_D_I_R' to the value of `PWD' instead. This behaviour 1920240330Smarcel is disabled if `MAKEOBJDIRPREFIX' is set or `MAKEOBJDIR' 1921240330Smarcel contains a variable transform. `PWD' is set to the value 1922240330Smarcel of `_._O_B_J_D_I_R' for all programs which bbmmaakkee executes. 1923240330Smarcel 1924240330Smarcel .TARGETS The list of targets explicitly specified on the command 1925240330Smarcel line, if any. 1926240330Smarcel 1927240330Smarcel VPATH Colon-separated (``:'') lists of directories that bbmmaakkee 1928240330Smarcel will search for files. The variable is supported for 1929240330Smarcel compatibility with old make programs only, use `_._P_A_T_H' 1930240330Smarcel instead. 1931240330Smarcel 1932240330Smarcel VVaarriiaabbllee mmooddiiffiieerrss 1933240330Smarcel Variable expansion may be modified to select or modify each word of the 1934240330Smarcel variable (where a ``word'' is white-space delimited sequence of charac- 1935240330Smarcel ters). The general format of a variable expansion is as follows: 1936240330Smarcel 1937240330Smarcel ${variable[:modifier[:...]]} 1938240330Smarcel 1939240330Smarcel Each modifier begins with a colon, which may be escaped with a backslash 1940240330Smarcel (`\'). 1941240330Smarcel 1942240330Smarcel A set of modifiers can be specified via a variable, as follows: 1943240330Smarcel 1944240330Smarcel modifier_variable=modifier[:...] 1945240330Smarcel ${variable:${modifier_variable}[:...]} 1946240330Smarcel 1947240330Smarcel In this case the first modifier in the modifier_variable does not start 1948240330Smarcel with a colon, since that must appear in the referencing variable. If any 1949240330Smarcel of the modifiers in the modifier_variable contain a dollar sign (`$'), 1950240330Smarcel these must be doubled to avoid early expansion. 1951240330Smarcel 1952240330Smarcel The supported modifiers are: 1953240330Smarcel 1954240330Smarcel ::EE Replaces each word in the variable with its suffix. 1955240330Smarcel 1956240330Smarcel ::HH Replaces each word in the variable with everything but the last com- 1957240330Smarcel ponent. 1958240330Smarcel 1959240330Smarcel ::MM_p_a_t_t_e_r_n 1960240330Smarcel Select only those words that match _p_a_t_t_e_r_n. The standard shell 1961240330Smarcel wildcard characters (`*', `?', and `[]') may be used. The wildcard 1962240330Smarcel characters may be escaped with a backslash (`\'). 1963240330Smarcel 1964240330Smarcel ::NN_p_a_t_t_e_r_n 1965240330Smarcel This is identical to `::MM', but selects all words which do not match 1966240330Smarcel _p_a_t_t_e_r_n. 1967240330Smarcel 1968240330Smarcel ::OO Order every word in variable alphabetically. To sort words in 1969240330Smarcel reverse order use the `::OO::[[--11....11]]' combination of modifiers. 1970240330Smarcel 1971240330Smarcel ::OOxx Randomize words in variable. The results will be different each 1972240330Smarcel time you are referring to the modified variable; use the assignment 1973240330Smarcel with expansion (`::==') to prevent such behaviour. For example, 1974240330Smarcel 1975240330Smarcel LIST= uno due tre quattro 1976240330Smarcel RANDOM_LIST= ${LIST:Ox} 1977240330Smarcel STATIC_RANDOM_LIST:= ${LIST:Ox} 1978240330Smarcel 1979240330Smarcel all: 1980240330Smarcel @echo "${RANDOM_LIST}" 1981240330Smarcel @echo "${RANDOM_LIST}" 1982240330Smarcel @echo "${STATIC_RANDOM_LIST}" 1983240330Smarcel @echo "${STATIC_RANDOM_LIST}" 1984240330Smarcel may produce output similar to: 1985240330Smarcel 1986240330Smarcel quattro due tre uno 1987240330Smarcel tre due quattro uno 1988240330Smarcel due uno quattro tre 1989240330Smarcel due uno quattro tre 1990240330Smarcel 1991240330Smarcel ::QQ Quotes every shell meta-character in the variable, so that it can be 1992240330Smarcel passed safely through recursive invocations of bbmmaakkee. 1993240330Smarcel 1994240330Smarcel ::RR Replaces each word in the variable with everything but its suffix. 1995240330Smarcel 1996240330Smarcel ::ggmmttiimmee 1997240330Smarcel The value is a format string for strftime(3), using the current 1998240330Smarcel gmtime(3). 1999240330Smarcel 2000240330Smarcel ::hhaasshh 2001240330Smarcel Compute a 32bit hash of the value and encode it as hex digits. 2002240330Smarcel 2003240330Smarcel ::llooccaallttiimmee 2004240330Smarcel The value is a format string for strftime(3), using the current 2005240330Smarcel localtime(3). 2006240330Smarcel 2007240330Smarcel ::ttAA Attempt to convert variable to an absolute path using realpath(3), 2008240330Smarcel if that fails, the value is unchanged. 2009240330Smarcel 2010240330Smarcel ::ttll Converts variable to lower-case letters. 2011240330Smarcel 2012240330Smarcel ::ttss_c 2013240330Smarcel Words in the variable are normally separated by a space on expan- 2014240330Smarcel sion. This modifier sets the separator to the character _c. If _c is 2015240330Smarcel omitted, then no separator is used. The common escapes (including 2016240330Smarcel octal numeric codes), work as expected. 2017240330Smarcel 2018240330Smarcel ::ttuu Converts variable to upper-case letters. 2019240330Smarcel 2020240330Smarcel ::ttWW Causes the value to be treated as a single word (possibly containing 2021240330Smarcel embedded white space). See also `::[[**]]'. 2022240330Smarcel 2023240330Smarcel ::ttww Causes the value to be treated as a sequence of words delimited by 2024240330Smarcel white space. See also `::[[@@]]'. 2025240330Smarcel 2026240330Smarcel ::SS/_o_l_d___s_t_r_i_n_g/_n_e_w___s_t_r_i_n_g/[11ggWW] 2027240330Smarcel Modify the first occurrence of _o_l_d___s_t_r_i_n_g in the variable's value, 2028240330Smarcel replacing it with _n_e_w___s_t_r_i_n_g. If a `g' is appended to the last 2029240330Smarcel slash of the pattern, all occurrences in each word are replaced. If 2030240330Smarcel a `1' is appended to the last slash of the pattern, only the first 2031240330Smarcel word is affected. If a `W' is appended to the last slash of the 2032240330Smarcel pattern, then the value is treated as a single word (possibly con- 2033240330Smarcel taining embedded white space). If _o_l_d___s_t_r_i_n_g begins with a caret 2034240330Smarcel (`^'), _o_l_d___s_t_r_i_n_g is anchored at the beginning of each word. If 2035240330Smarcel _o_l_d___s_t_r_i_n_g ends with a dollar sign (`$'), it is anchored at the end 2036240330Smarcel of each word. Inside _n_e_w___s_t_r_i_n_g, an ampersand (`&') is replaced by 2037240330Smarcel _o_l_d___s_t_r_i_n_g (without any `^' or `$'). Any character may be used as a 2038240330Smarcel delimiter for the parts of the modifier string. The anchoring, 2039240330Smarcel ampersand and delimiter characters may be escaped with a backslash 2040240330Smarcel (`\'). 2041240330Smarcel 2042240330Smarcel Variable expansion occurs in the normal fashion inside both 2043240330Smarcel _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 2044240330Smarcel is used to prevent the expansion of a dollar sign (`$'), not a pre- 2045240330Smarcel ceding dollar sign as is usual. 2046240330Smarcel 2047240330Smarcel ::CC/_p_a_t_t_e_r_n/_r_e_p_l_a_c_e_m_e_n_t/[11ggWW] 2048240330Smarcel The ::CC modifier is just like the ::SS modifier except that the old and 2049240330Smarcel new strings, instead of being simple strings, are a regular expres- 2050240330Smarcel sion (see regex(3)) string _p_a_t_t_e_r_n and an ed(1)-style string 2051240330Smarcel _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 2052240330Smarcel in each word of the value is substituted with _r_e_p_l_a_c_e_m_e_n_t. The `1' 2053240330Smarcel modifier causes the substitution to apply to at most one word; the 2054240330Smarcel `g' modifier causes the substitution to apply to as many instances 2055240330Smarcel of the search pattern _p_a_t_t_e_r_n as occur in the word or words it is 2056240330Smarcel found in; the `W' modifier causes the value to be treated as a sin- 2057240330Smarcel gle word (possibly containing embedded white space). Note that `1' 2058240330Smarcel and `g' are orthogonal; the former specifies whether multiple words 2059240330Smarcel are potentially affected, the latter whether multiple substitutions 2060240330Smarcel can potentially occur within each affected word. 2061240330Smarcel 2062240330Smarcel ::TT Replaces each word in the variable with its last component. 2063240330Smarcel 2064240330Smarcel ::uu Remove adjacent duplicate words (like uniq(1)). 2065240330Smarcel 2066240330Smarcel ::??_t_r_u_e___s_t_r_i_n_g::_f_a_l_s_e___s_t_r_i_n_g 2067240330Smarcel If the variable name (not its value), when parsed as a .if condi- 2068240330Smarcel tional expression, evaluates to true, return as its value the 2069240330Smarcel _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 2070240330Smarcel name is used as the expression, :? must be the first modifier after 2071240330Smarcel the variable name itself - which will, of course, usually contain 2072240330Smarcel variable expansions. A common error is trying to use expressions 2073240330Smarcel like 2074240330Smarcel ${NUMBERS:M42:?match:no} 2075240330Smarcel which actually tests defined(NUMBERS), to determine is any words 2076240330Smarcel match "42" you need to use something like: 2077240330Smarcel ${"${NUMBERS:M42}" != "":?match:no}. 2078240330Smarcel 2079240330Smarcel _:_o_l_d___s_t_r_i_n_g_=_n_e_w___s_t_r_i_n_g 2080240330Smarcel This is the AT&T System V UNIX style variable substitution. It must 2081240330Smarcel 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 2082240330Smarcel contain the pattern matching character _% then it is assumed that 2083240330Smarcel they are anchored at the end of each word, so only suffixes or 2084240330Smarcel entire words may be replaced. Otherwise _% is the substring of 2085240330Smarcel _o_l_d___s_t_r_i_n_g to be replaced in _n_e_w___s_t_r_i_n_g. 2086240330Smarcel 2087240330Smarcel Variable expansion occurs in the normal fashion inside both 2088240330Smarcel _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 2089240330Smarcel is used to prevent the expansion of a dollar sign (`$'), not a pre- 2090240330Smarcel ceding dollar sign as is usual. 2091240330Smarcel 2092240330Smarcel ::@@_t_e_m_p@@_s_t_r_i_n_g@@ 2093240330Smarcel This is the loop expansion mechanism from the OSF Development Envi- 2094240330Smarcel ronment (ODE) make. Unlike ..ffoorr loops expansion occurs at the time 2095240330Smarcel of reference. Assign _t_e_m_p to each word in the variable and evaluate 2096240330Smarcel _s_t_r_i_n_g. The ODE convention is that _t_e_m_p should start and end with a 2097240330Smarcel period. For example. 2098240330Smarcel ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} 2099240330Smarcel 2100240330Smarcel However a single character varaiable is often more readable: 2101240330Smarcel ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} 2102240330Smarcel 2103240330Smarcel ::UU_n_e_w_v_a_l 2104240330Smarcel If the variable is undefined _n_e_w_v_a_l is the value. If the variable 2105240330Smarcel is defined, the existing value is returned. This is another ODE 2106240330Smarcel make feature. It is handy for setting per-target CFLAGS for 2107240330Smarcel instance: 2108240330Smarcel ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}} 2109240330Smarcel If a value is only required if the variable is undefined, use: 2110240330Smarcel ${VAR:D:Unewval} 2111240330Smarcel 2112240330Smarcel ::DD_n_e_w_v_a_l 2113240330Smarcel If the variable is defined _n_e_w_v_a_l is the value. 2114240330Smarcel 2115240330Smarcel ::LL The name of the variable is the value. 2116240330Smarcel 2117240330Smarcel ::PP The path of the node which has the same name as the variable is the 2118240330Smarcel value. If no such node exists or its path is null, then the name of 2119240330Smarcel the variable is used. In order for this modifier to work, the name 2120240330Smarcel (node) must at least have appeared on the rhs of a dependency. 2121240330Smarcel 2122240330Smarcel ::!!_c_m_d!! 2123240330Smarcel The output of running _c_m_d is the value. 2124240330Smarcel 2125240330Smarcel ::sshh If the variable is non-empty it is run as a command and the output 2126240330Smarcel becomes the new value. 2127240330Smarcel 2128240330Smarcel ::::==_s_t_r 2129240330Smarcel The variable is assigned the value _s_t_r after substitution. This 2130240330Smarcel modifier and its variations are useful in obscure situations such as 2131240330Smarcel wanting to set a variable when shell commands are being parsed. 2132240330Smarcel These assignment modifiers always expand to nothing, so if appearing 2133240330Smarcel in a rule line by themselves should be preceded with something to 2134240330Smarcel keep bbmmaakkee happy. 2135240330Smarcel 2136240330Smarcel The `::::' helps avoid false matches with the AT&T System V UNIX style 2137240330Smarcel ::== modifier and since substitution always occurs the ::::== form is 2138240330Smarcel vaguely appropriate. 2139240330Smarcel 2140240330Smarcel ::::??==_s_t_r 2141240330Smarcel As for ::::== but only if the variable does not already have a value. 2142240330Smarcel 2143240330Smarcel ::::++==_s_t_r 2144240330Smarcel Append _s_t_r to the variable. 2145240330Smarcel 2146240330Smarcel ::::!!==_c_m_d 2147240330Smarcel Assign the output of _c_m_d to the variable. 2148240330Smarcel 2149240330Smarcel ::[[_r_a_n_g_e]] 2150240330Smarcel Selects one or more words from the value, or performs other opera- 2151240330Smarcel tions related to the way in which the value is divided into words. 2152240330Smarcel 2153240330Smarcel Ordinarily, a value is treated as a sequence of words delimited by 2154240330Smarcel white space. Some modifiers suppress this behaviour, causing a 2155240330Smarcel value to be treated as a single word (possibly containing embedded 2156240330Smarcel white space). An empty value, or a value that consists entirely of 2157240330Smarcel white-space, is treated as a single word. For the purposes of the 2158240330Smarcel `::[[]]' modifier, the words are indexed both forwards using positive 2159240330Smarcel integers (where index 1 represents the first word), and backwards 2160240330Smarcel using negative integers (where index -1 represents the last word). 2161240330Smarcel 2162240330Smarcel The _r_a_n_g_e is subjected to variable expansion, and the expanded 2163240330Smarcel result is then interpreted as follows: 2164240330Smarcel 2165240330Smarcel _i_n_d_e_x Selects a single word from the value. 2166240330Smarcel 2167240330Smarcel _s_t_a_r_t...._e_n_d 2168240330Smarcel Selects all words from _s_t_a_r_t to _e_n_d, inclusive. For example, 2169240330Smarcel `::[[22....--11]]' selects all words from the second word to the last 2170240330Smarcel word. If _s_t_a_r_t is greater than _e_n_d, then the words are out- 2171240330Smarcel put in reverse order. For example, `::[[--11....11]]' selects all 2172240330Smarcel the words from last to first. 2173240330Smarcel 2174240330Smarcel ** Causes subsequent modifiers to treat the value as a single 2175240330Smarcel word (possibly containing embedded white space). Analogous 2176240330Smarcel to the effect of "$*" in Bourne shell. 2177240330Smarcel 2178240330Smarcel 0 Means the same as `::[[**]]'. 2179240330Smarcel 2180240330Smarcel @@ Causes subsequent modifiers to treat the value as a sequence 2181240330Smarcel of words delimited by white space. Analogous to the effect 2182240330Smarcel of "$@" in Bourne shell. 2183240330Smarcel 2184240330Smarcel ## Returns the number of words in the value. 2185240330Smarcel 2186240330SmarcelIINNCCLLUUDDEE SSTTAATTEEMMEENNTTSS,, CCOONNDDIITTIIOONNAALLSS AANNDD FFOORR LLOOOOPPSS 2187240330Smarcel Makefile inclusion, conditional structures and for loops reminiscent of 2188240330Smarcel the C programming language are provided in bbmmaakkee. All such structures 2189240330Smarcel are identified by a line beginning with a single dot (`.') character. 2190240330Smarcel Files are included with either ..iinncclluuddee <_f_i_l_e> or ..iinncclluuddee "_f_i_l_e". Vari- 2191240330Smarcel ables between the angle brackets or double quotes are expanded to form 2192240330Smarcel the file name. If angle brackets are used, the included makefile is 2193240330Smarcel expected to be in the system makefile directory. If double quotes are 2194240330Smarcel used, the including makefile's directory and any directories specified 2195240330Smarcel using the --II option are searched before the system makefile directory. 2196240330Smarcel For compatibility with other versions of bbmmaakkee `include file ...' is also 2197240330Smarcel accepted. If the include statement is written as ..--iinncclluuddee or as 2198240330Smarcel ..ssiinncclluuddee then errors locating and/or opening include files are ignored. 2199240330Smarcel 2200240330Smarcel Conditional expressions are also preceded by a single dot as the first 2201240330Smarcel character of a line. The possible conditionals are as follows: 2202240330Smarcel 2203240330Smarcel ..eerrrroorr _m_e_s_s_a_g_e 2204240330Smarcel The message is printed along with the name of the makefile and 2205240330Smarcel line number, then bbmmaakkee will exit. 2206240330Smarcel 2207240330Smarcel ..eexxppoorrtt _v_a_r_i_a_b_l_e _._._. 2208240330Smarcel Export the specified global variable. If no variable list is 2209240330Smarcel provided, all globals are exported except for internal variables 2210240330Smarcel (those that start with `.'). This is not affected by the --XX 2211240330Smarcel flag, so should be used with caution. For compatibility with 2212240330Smarcel other bbmmaakkee programs `export variable=value' is also accepted. 2213240330Smarcel 2214240330Smarcel Appending a variable name to _._M_A_K_E_._E_X_P_O_R_T_E_D is equivalent to 2215240330Smarcel exporting a variable. 2216240330Smarcel 2217240330Smarcel ..eexxppoorrtt--eennvv _v_a_r_i_a_b_l_e _._._. 2218240330Smarcel The same as `.export', except that the variable is not appended 2219240330Smarcel to _._M_A_K_E_._E_X_P_O_R_T_E_D. This allows exporting a value to the environ- 2220240330Smarcel ment which is different from that used by bbmmaakkee internally. 2221240330Smarcel 2222240330Smarcel ..iinnffoo _m_e_s_s_a_g_e 2223240330Smarcel The message is printed along with the name of the makefile and 2224240330Smarcel line number. 2225240330Smarcel 2226240330Smarcel ..uunnddeeff _v_a_r_i_a_b_l_e 2227240330Smarcel Un-define the specified global variable. Only global variables 2228240330Smarcel may be un-defined. 2229240330Smarcel 2230240330Smarcel ..uunneexxppoorrtt _v_a_r_i_a_b_l_e _._._. 2231240330Smarcel The opposite of `.export'. The specified global _v_a_r_i_a_b_l_e will be 2232240330Smarcel removed from _._M_A_K_E_._E_X_P_O_R_T_E_D. If no variable list is provided, 2233240330Smarcel all globals are unexported, and _._M_A_K_E_._E_X_P_O_R_T_E_D deleted. 2234240330Smarcel 2235240330Smarcel ..uunneexxppoorrtt--eennvv 2236240330Smarcel Unexport all globals previously exported and clear the environ- 2237240330Smarcel ment inherited from the parent. This operation will cause a mem- 2238240330Smarcel ory leak of the original environment, so should be used spar- 2239240330Smarcel ingly. Testing for _._M_A_K_E_._L_E_V_E_L being 0, would make sense. Also 2240240330Smarcel note that any variables which originated in the parent environ- 2241240330Smarcel ment should be explicitly preserved if desired. For example: 2242240330Smarcel 2243240330Smarcel .if ${.MAKE.LEVEL} == 0 2244240330Smarcel PATH := ${PATH} 2245240330Smarcel .unexport-env 2246240330Smarcel .export PATH 2247240330Smarcel .endif 2248240330Smarcel 2249240330Smarcel Would result in an environment containing only `PATH', which is 2250240330Smarcel the minimal useful environment. Actually `.MAKE.LEVEL' will also 2251240330Smarcel be pushed into the new environment. 2252240330Smarcel 2253240330Smarcel ..wwaarrnniinngg _m_e_s_s_a_g_e 2254240330Smarcel The message prefixed by `_w_a_r_n_i_n_g_:' is printed along with the name 2255240330Smarcel of the makefile and line number. 2256240330Smarcel 2257240330Smarcel ..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 _._._.] 2258240330Smarcel Test the value of an expression. 2259240330Smarcel 2260240330Smarcel ..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 _._._.] 2261240330Smarcel Test the value of a variable. 2262240330Smarcel 2263240330Smarcel ..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 _._._.] 2264240330Smarcel Test the value of a variable. 2265240330Smarcel 2266240330Smarcel ..iiffmmaakkee [!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 2267240330Smarcel Test the target being built. 2268240330Smarcel 2269240330Smarcel ..iiffnnmmaakkee [!] _t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 2270240330Smarcel Test the target being built. 2271240330Smarcel 2272240330Smarcel ..eellssee Reverse the sense of the last conditional. 2273240330Smarcel 2274240330Smarcel ..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 _._._.] 2275240330Smarcel A combination of `..eellssee' followed by `..iiff'. 2276240330Smarcel 2277240330Smarcel ..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 _._._.] 2278240330Smarcel A combination of `..eellssee' followed by `..iiffddeeff'. 2279240330Smarcel 2280240330Smarcel ..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 _._._.] 2281240330Smarcel A combination of `..eellssee' followed by `..iiffnnddeeff'. 2282240330Smarcel 2283240330Smarcel ..eelliiffmmaakkee [!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 2284240330Smarcel A combination of `..eellssee' followed by `..iiffmmaakkee'. 2285240330Smarcel 2286240330Smarcel ..eelliiffnnmmaakkee [!]_t_a_r_g_e_t [_o_p_e_r_a_t_o_r _t_a_r_g_e_t _._._.] 2287240330Smarcel A combination of `..eellssee' followed by `..iiffnnmmaakkee'. 2288240330Smarcel 2289240330Smarcel ..eennddiiff End the body of the conditional. 2290240330Smarcel 2291240330Smarcel The _o_p_e_r_a_t_o_r may be any one of the following: 2292240330Smarcel 2293240330Smarcel |||| Logical OR. 2294240330Smarcel 2295240330Smarcel &&&& Logical AND; of higher precedence than ``||''. 2296240330Smarcel 2297240330Smarcel As in C, bbmmaakkee will only evaluate a conditional as far as is necessary to 2298240330Smarcel determine its value. Parentheses may be used to change the order of 2299240330Smarcel evaluation. The boolean operator `!!' may be used to logically negate an 2300240330Smarcel entire conditional. It is of higher precedence than `&&&&'. 2301240330Smarcel 2302240330Smarcel The value of _e_x_p_r_e_s_s_i_o_n may be any of the following: 2303240330Smarcel 2304240330Smarcel ddeeffiinneedd Takes a variable name as an argument and evaluates to true if 2305240330Smarcel the variable has been defined. 2306240330Smarcel 2307240330Smarcel mmaakkee Takes a target name as an argument and evaluates to true if the 2308240330Smarcel target was specified as part of bbmmaakkee's command line or was 2309240330Smarcel declared the default target (either implicitly or explicitly, 2310240330Smarcel see _._M_A_I_N) before the line containing the conditional. 2311240330Smarcel 2312240330Smarcel eemmppttyy Takes a variable, with possible modifiers, and evaluates to true 2313240330Smarcel if the expansion of the variable would result in an empty 2314240330Smarcel string. 2315240330Smarcel 2316240330Smarcel eexxiissttss Takes a file name as an argument and evaluates to true if the 2317240330Smarcel file exists. The file is searched for on the system search path 2318240330Smarcel (see _._P_A_T_H). 2319240330Smarcel 2320240330Smarcel ttaarrggeett Takes a target name as an argument and evaluates to true if the 2321240330Smarcel target has been defined. 2322240330Smarcel 2323240330Smarcel ccoommmmaannddss 2324240330Smarcel Takes a target name as an argument and evaluates to true if the 2325240330Smarcel target has been defined and has commands associated with it. 2326240330Smarcel 2327240330Smarcel _E_x_p_r_e_s_s_i_o_n may also be an arithmetic or string comparison. Variable 2328240330Smarcel expansion is performed on both sides of the comparison, after which the 2329240330Smarcel integral values are compared. A value is interpreted as hexadecimal if 2330240330Smarcel it is preceded by 0x, otherwise it is decimal; octal numbers are not sup- 2331240330Smarcel ported. The standard C relational operators are all supported. If after 2332240330Smarcel variable expansion, either the left or right hand side of a `====' or `!!==' 2333240330Smarcel operator is not an integral value, then string comparison is performed 2334240330Smarcel between the expanded variables. If no relational operator is given, it 2335240330Smarcel is assumed that the expanded variable is being compared against 0 or an 2336240330Smarcel empty string in the case of a string comparison. 2337240330Smarcel 2338240330Smarcel When bbmmaakkee is evaluating one of these conditional expressions, and it 2339240330Smarcel encounters a (white-space separated) word it doesn't recognize, either 2340240330Smarcel the ``make'' or ``defined'' expression is applied to it, depending on the 2341240330Smarcel form of the conditional. If the form is `..iiffddeeff', `..iiffnnddeeff', or `..iiff' 2342240330Smarcel the ``defined'' expression is applied. Similarly, if the form is 2343240330Smarcel `..iiffmmaakkee' or `..iiffnnmmaakkee, tthhee' ``make'' expression is applied. 2344240330Smarcel 2345240330Smarcel If the conditional evaluates to true the parsing of the makefile contin- 2346240330Smarcel ues as before. If it evaluates to false, the following lines are 2347240330Smarcel skipped. In both cases this continues until a `..eellssee' or `..eennddiiff' is 2348240330Smarcel found. 2349240330Smarcel 2350240330Smarcel For loops are typically used to apply a set of rules to a list of files. 2351240330Smarcel The syntax of a for loop is: 2352240330Smarcel 2353240330Smarcel ..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 2354240330Smarcel <make-rules> 2355240330Smarcel ..eennddffoorr 2356240330Smarcel 2357240330Smarcel After the for eexxpprreessssiioonn is evaluated, it is split into words. On each 2358240330Smarcel iteration of the loop, one word is taken and assigned to each vvaarriiaabbllee, 2359240330Smarcel in order, and these vvaarriiaabblleess are substituted into the mmaakkee--rruulleess inside 2360240330Smarcel the body of the for loop. The number of words must come out even; that 2361240330Smarcel is, if there are three iteration variables, the number of words provided 2362240330Smarcel must be a multiple of three. 2363240330Smarcel 2364240330SmarcelCCOOMMMMEENNTTSS 2365240330Smarcel Comments begin with a hash (`#') character, anywhere but in a shell com- 2366240330Smarcel mand line, and continue to the end of an unescaped new line. 2367240330Smarcel 2368240330SmarcelSSPPEECCIIAALL SSOOUURRCCEESS ((AATTTTRRIIBBUUTTEESS)) 2369240330Smarcel ..EEXXEECC Target is never out of date, but always execute commands any- 2370240330Smarcel way. 2371240330Smarcel 2372240330Smarcel ..IIGGNNOORREE Ignore any errors from the commands associated with this tar- 2373240330Smarcel get, exactly as if they all were preceded by a dash (`-'). 2374240330Smarcel 2375240330Smarcel ..MMAADDEE Mark all sources of this target as being up-to-date. 2376240330Smarcel 2377240330Smarcel ..MMAAKKEE Execute the commands associated with this target even if the --nn 2378240330Smarcel or --tt options were specified. Normally used to mark recursive 2379240330Smarcel bbmmaakkee's. 2380240330Smarcel 2381240330Smarcel ..MMEETTAA Create a meta file for the target, even if it is flagged as 2382240330Smarcel ..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL. Usage in conjunction with ..MMAAKKEE is 2383240330Smarcel the most likely case. In "meta" mode, the target is out-of- 2384240330Smarcel date if the meta file is missing. 2385240330Smarcel 2386240330Smarcel ..NNOOMMEETTAA Do not create a meta file for the target. Meta files are also 2387240330Smarcel not created for ..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL targets. 2388240330Smarcel 2389240330Smarcel ..NNOOMMEETTAA__CCMMPP 2390240330Smarcel Ignore differences in commands when deciding if target is out 2391240330Smarcel of date. This is useful if the command contains a value which 2392240330Smarcel always changes. If the number of commands change, though, the 2393240330Smarcel target will still be out of date. 2394240330Smarcel 2395240330Smarcel ..NNOOPPAATTHH Do not search for the target in the directories specified by 2396240330Smarcel ..PPAATTHH. 2397240330Smarcel 2398240330Smarcel ..NNOOTTMMAAIINN Normally bbmmaakkee selects the first target it encounters as the 2399240330Smarcel default target to be built if no target was specified. This 2400240330Smarcel source prevents this target from being selected. 2401240330Smarcel 2402240330Smarcel ..OOPPTTIIOONNAALL 2403240330Smarcel If a target is marked with this attribute and bbmmaakkee can't fig- 2404240330Smarcel ure out how to create it, it will ignore this fact and assume 2405240330Smarcel the file isn't needed or already exists. 2406240330Smarcel 2407240330Smarcel ..PPHHOONNYY The target does not correspond to an actual file; it is always 2408240330Smarcel considered to be out of date, and will not be created with the 2409240330Smarcel --tt option. Suffix-transformation rules are not applied to 2410240330Smarcel ..PPHHOONNYY targets. 2411240330Smarcel 2412240330Smarcel ..PPRREECCIIOOUUSS 2413240330Smarcel When bbmmaakkee is interrupted, it normally removes any partially 2414240330Smarcel made targets. This source prevents the target from being 2415240330Smarcel removed. 2416240330Smarcel 2417240330Smarcel ..RREECCUURRSSIIVVEE 2418240330Smarcel Synonym for ..MMAAKKEE. 2419240330Smarcel 2420240330Smarcel ..SSIILLEENNTT Do not echo any of the commands associated with this target, 2421240330Smarcel exactly as if they all were preceded by an at sign (`@'). 2422240330Smarcel 2423240330Smarcel ..UUSSEE Turn the target into bbmmaakkee's version of a macro. When the tar- 2424240330Smarcel get is used as a source for another target, the other target 2425240330Smarcel acquires the commands, sources, and attributes (except for 2426240330Smarcel ..UUSSEE) of the source. If the target already has commands, the 2427240330Smarcel ..UUSSEE target's commands are appended to them. 2428240330Smarcel 2429240330Smarcel ..UUSSEEBBEEFFOORREE 2430240330Smarcel Exactly like ..UUSSEE, but prepend the ..UUSSEEBBEEFFOORREE target commands 2431240330Smarcel to the target. 2432240330Smarcel 2433240330Smarcel ..WWAAIITT If ..WWAAIITT appears in a dependency line, the sources that precede 2434240330Smarcel it are made before the sources that succeed it in the line. 2435240330Smarcel Since the dependents of files are not made until the file 2436240330Smarcel itself could be made, this also stops the dependents being 2437240330Smarcel built unless they are needed for another branch of the depen- 2438240330Smarcel dency tree. So given: 2439240330Smarcel 2440240330Smarcel x: a .WAIT b 2441240330Smarcel echo x 2442240330Smarcel a: 2443240330Smarcel echo a 2444240330Smarcel b: b1 2445240330Smarcel echo b 2446240330Smarcel b1: 2447240330Smarcel echo b1 2448240330Smarcel 2449240330Smarcel the output is always `a', `b1', `b', `x'. 2450240330Smarcel The ordering imposed by ..WWAAIITT is only relevant for parallel 2451240330Smarcel makes. 2452240330Smarcel 2453240330SmarcelSSPPEECCIIAALL TTAARRGGEETTSS 2454240330Smarcel Special targets may not be included with other targets, i.e. they must be 2455240330Smarcel the only target specified. 2456240330Smarcel 2457240330Smarcel ..BBEEGGIINN Any command lines attached to this target are executed before 2458240330Smarcel anything else is done. 2459240330Smarcel 2460240330Smarcel ..DDEEFFAAUULLTT 2461240330Smarcel This is sort of a ..UUSSEE rule for any target (that was used only 2462240330Smarcel as a source) that bbmmaakkee can't figure out any other way to cre- 2463240330Smarcel ate. Only the shell script is used. The ..IIMMPPSSRRCC variable of a 2464240330Smarcel target that inherits ..DDEEFFAAUULLTT's commands is set to the target's 2465240330Smarcel own name. 2466240330Smarcel 2467240330Smarcel ..EENNDD Any command lines attached to this target are executed after 2468240330Smarcel everything else is done. 2469240330Smarcel 2470240330Smarcel ..EERRRROORR Any command lines attached to this target are executed when 2471240330Smarcel another target fails. The ..EERRRROORR__TTAARRGGEETT variable is set to the 2472240330Smarcel target that failed. See also MMAAKKEE__PPRRIINNTT__VVAARR__OONN__EERRRROORR. 2473240330Smarcel 2474240330Smarcel ..IIGGNNOORREE Mark each of the sources with the ..IIGGNNOORREE attribute. If no 2475240330Smarcel sources are specified, this is the equivalent of specifying the 2476240330Smarcel --ii option. 2477240330Smarcel 2478240330Smarcel ..IINNTTEERRRRUUPPTT 2479240330Smarcel If bbmmaakkee is interrupted, the commands for this target will be 2480240330Smarcel executed. 2481240330Smarcel 2482240330Smarcel ..MMAAIINN If no target is specified when bbmmaakkee is invoked, this target 2483240330Smarcel will be built. 2484240330Smarcel 2485240330Smarcel ..MMAAKKEEFFLLAAGGSS 2486240330Smarcel This target provides a way to specify flags for bbmmaakkee when the 2487240330Smarcel makefile is used. The flags are as if typed to the shell, 2488240330Smarcel though the --ff option will have no effect. 2489240330Smarcel 2490240330Smarcel ..NNOOPPAATTHH Apply the ..NNOOPPAATTHH attribute to any specified sources. 2491240330Smarcel 2492240330Smarcel ..NNOOTTPPAARRAALLLLEELL 2493240330Smarcel Disable parallel mode. 2494240330Smarcel 2495240330Smarcel ..NNOO__PPAARRAALLLLEELL 2496240330Smarcel Synonym for ..NNOOTTPPAARRAALLLLEELL, for compatibility with other pmake 2497240330Smarcel variants. 2498240330Smarcel 2499240330Smarcel ..OORRDDEERR The named targets are made in sequence. This ordering does not 2500240330Smarcel add targets to the list of targets to be made. Since the depen- 2501240330Smarcel dents of a target do not get built until the target itself could 2502240330Smarcel be built, unless `a' is built by another part of the dependency 2503240330Smarcel graph, the following is a dependency loop: 2504240330Smarcel 2505240330Smarcel .ORDER: b a 2506240330Smarcel b: a 2507240330Smarcel 2508240330Smarcel The ordering imposed by ..OORRDDEERR is only relevant for parallel 2509240330Smarcel makes. 2510240330Smarcel 2511240330Smarcel ..PPAATTHH The sources are directories which are to be searched for files 2512240330Smarcel not found in the current directory. If no sources are speci- 2513240330Smarcel fied, any previously specified directories are deleted. If the 2514240330Smarcel source is the special ..DDOOTTLLAASSTT target, then the current working 2515240330Smarcel directory is searched last. 2516240330Smarcel 2517240330Smarcel ..PPHHOONNYY Apply the ..PPHHOONNYY attribute to any specified sources. 2518240330Smarcel 2519240330Smarcel ..PPRREECCIIOOUUSS 2520240330Smarcel Apply the ..PPRREECCIIOOUUSS attribute to any specified sources. If no 2521240330Smarcel sources are specified, the ..PPRREECCIIOOUUSS attribute is applied to 2522240330Smarcel every target in the file. 2523240330Smarcel 2524240330Smarcel ..SSHHEELLLL Sets the shell that bbmmaakkee will use to execute commands. The 2525240330Smarcel sources are a set of _f_i_e_l_d_=_v_a_l_u_e pairs. 2526240330Smarcel 2527240330Smarcel _n_a_m_e This is the minimal specification, used to select 2528240330Smarcel one of the builtin shell specs; _s_h, _k_s_h, and _c_s_h. 2529240330Smarcel 2530240330Smarcel _p_a_t_h Specifies the path to the shell. 2531240330Smarcel 2532240330Smarcel _h_a_s_E_r_r_C_t_l Indicates whether the shell supports exit on error. 2533240330Smarcel 2534240330Smarcel _c_h_e_c_k The command to turn on error checking. 2535240330Smarcel 2536240330Smarcel _i_g_n_o_r_e The command to disable error checking. 2537240330Smarcel 2538240330Smarcel _e_c_h_o The command to turn on echoing of commands executed. 2539240330Smarcel 2540240330Smarcel _q_u_i_e_t The command to turn off echoing of commands exe- 2541240330Smarcel cuted. 2542240330Smarcel 2543240330Smarcel _f_i_l_t_e_r The output to filter after issuing the _q_u_i_e_t com- 2544240330Smarcel mand. It is typically identical to _q_u_i_e_t. 2545240330Smarcel 2546240330Smarcel _e_r_r_F_l_a_g The flag to pass the shell to enable error checking. 2547240330Smarcel 2548240330Smarcel _e_c_h_o_F_l_a_g The flag to pass the shell to enable command echo- 2549240330Smarcel ing. 2550240330Smarcel 2551240330Smarcel _n_e_w_l_i_n_e The string literal to pass the shell that results in 2552240330Smarcel a single newline character when used outside of any 2553240330Smarcel quoting characters. 2554240330Smarcel Example: 2555240330Smarcel 2556240330Smarcel .SHELL: name=ksh path=/bin/ksh hasErrCtl=true \ 2557240330Smarcel check="set -e" ignore="set +e" \ 2558240330Smarcel echo="set -v" quiet="set +v" filter="set +v" \ 2559240330Smarcel echoFlag=v errFlag=e newline="'\n'" 2560240330Smarcel 2561240330Smarcel ..SSIILLEENNTT Apply the ..SSIILLEENNTT attribute to any specified sources. If no 2562240330Smarcel sources are specified, the ..SSIILLEENNTT attribute is applied to every 2563240330Smarcel command in the file. 2564240330Smarcel 2565240330Smarcel ..SSUUFFFFIIXXEESS 2566240330Smarcel Each source specifies a suffix to bbmmaakkee. If no sources are 2567240330Smarcel specified, any previously specified suffixes are deleted. It 2568240330Smarcel allows the creation of suffix-transformation rules. 2569240330Smarcel 2570240330Smarcel Example: 2571240330Smarcel 2572240330Smarcel .SUFFIXES: .o 2573240330Smarcel .c.o: 2574240330Smarcel cc -o ${.TARGET} -c ${.IMPSRC} 2575240330Smarcel 2576240330SmarcelEENNVVIIRROONNMMEENNTT 2577240330Smarcel bbmmaakkee uses the following environment variables, if they exist: MACHINE, 2578240330Smarcel MACHINE_ARCH, MAKE, MAKEFLAGS, MAKEOBJDIR, MAKEOBJDIRPREFIX, MAKESYSPATH, 2579240330Smarcel PWD, and TMPDIR. 2580240330Smarcel 2581240330Smarcel MAKEOBJDIRPREFIX and MAKEOBJDIR may only be set in the environment or on 2582240330Smarcel the command line to bbmmaakkee and not as makefile variables; see the descrip- 2583240330Smarcel tion of `_._O_B_J_D_I_R' for more details. 2584240330Smarcel 2585240330SmarcelFFIILLEESS 2586240330Smarcel .depend list of dependencies 2587240330Smarcel Makefile list of dependencies 2588240330Smarcel makefile list of dependencies 2589240330Smarcel sys.mk system makefile 2590240330Smarcel /usr/share/mk system makefile directory 2591240330Smarcel 2592240330SmarcelCCOOMMPPAATTIIBBIILLIITTYY 2593240330Smarcel The basic make syntax is compatible between different versions of make, 2594240330Smarcel however the special variables, variable modifiers and conditionals are 2595240330Smarcel not. 2596240330Smarcel 2597240330Smarcel The way that parallel makes are scheduled changed in NetBSD 4.0 so that 2598240330Smarcel .ORDER and .WAIT apply recursively to the dependent nodes. The algo- 2599240330Smarcel rithms used may change again in the future. 2600240330Smarcel 2601240330Smarcel The way that .for loop variables are substituted changed after NetBSD 5.0 2602240330Smarcel so that they still appear to be variable expansions. In particular this 2603240330Smarcel stops them being treated as syntax, and removes some obscure problems 2604240330Smarcel using them in .if statements. 2605240330Smarcel 2606240330Smarcel Unlike other bbmmaakkee programs, this implementation by default executes all 2607240330Smarcel commands for a given target using a single shell invocation. This is 2608240330Smarcel done for both efficiency and to simplify error handling in remote command 2609240330Smarcel invocations. Typically this is transparent to the user, unless the tar- 2610240330Smarcel get commands change the current working directory using ``cd'' or 2611240330Smarcel ``chdir''. To be compatible with Makefiles that do this, one can use --BB 2612240330Smarcel to disable this behavior. 2613240330Smarcel 2614240330SmarcelSSEEEE AALLSSOO 2615240330Smarcel mkdep(1) 2616240330Smarcel 2617240330SmarcelHHIISSTTOORRYY 2618240330Smarcel bbmmaakkee is derived from NetBSD make(1). It uses autoconf to facilitate 2619240330Smarcel portability to other platforms. 2620240330Smarcel 2621240330SmarcelNetBSD 5.1 August 30, 2012 NetBSD 5.1 2622