1 |
< |
MAKE(1) NetBSD General Commands Manual MAKE(1) |
1 |
> |
BMAKE(1) NetBSD General Commands Manual BMAKE(1) |
2 |
|
|
3 |
|
NNAAMMEE |
4 |
|
bbmmaakkee -- maintain program dependencies |
6 |
|
SSYYNNOOPPSSIISS |
7 |
|
bbmmaakkee [--BBeeiikkNNnnqqrrssttWWwwXX] [--CC _d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd _f_l_a_g_s] |
8 |
|
[--ff _m_a_k_e_f_i_l_e] [--II _d_i_r_e_c_t_o_r_y] [--JJ _p_r_i_v_a_t_e] [--jj _m_a_x___j_o_b_s] |
9 |
< |
[--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [_v_a_r_i_a_b_l_e_=_v_a_l_u_e] |
10 |
< |
[_t_a_r_g_e_t _._._.] |
9 |
> |
[--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [--vv _v_a_r_i_a_b_l_e] |
10 |
> |
[_v_a_r_i_a_b_l_e_=_v_a_l_u_e] [_t_a_r_g_e_t _._._.] |
11 |
|
|
12 |
|
DDEESSCCRRIIPPTTIIOONN |
13 |
|
bbmmaakkee is a program designed to simplify the maintenance of other pro- |
118 |
|
_t Print debugging information about target list mainte- |
119 |
|
nance. |
120 |
|
|
121 |
< |
_V Force the --VV option to print raw values of variables. |
121 |
> |
_V Force the --VV option to print raw values of variables, |
122 |
> |
overriding the default behavior set via |
123 |
> |
_._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S. |
124 |
|
|
125 |
|
_v Print debugging information about variable assignment. |
126 |
|
|
125 |
– |
_w Print entering and leaving directory messages, pre and |
126 |
– |
post processing. |
127 |
– |
|
127 |
|
_x Run shell commands with --xx so the actual commands are |
128 |
|
printed as they are executed. |
129 |
|
|
180 |
|
then bbmmaakkee will search for the specified file or directory named |
181 |
|
in the remaining part of the argument string. The search starts |
182 |
|
with the current directory of the Makefile and then works upward |
183 |
< |
towards the root of the filesystem. If the search is successful, |
184 |
< |
then the resulting directory replaces the ".../" specification in |
185 |
< |
the --mm argument. If used, this feature allows bbmmaakkee to easily |
186 |
< |
search in the current source tree for customized sys.mk files |
187 |
< |
(e.g., by using ".../mk/sys.mk" as an argument). |
183 |
> |
towards the root of the file system. If the search is success- |
184 |
> |
ful, then the resulting directory replaces the ".../" specifica- |
185 |
> |
tion in the --mm argument. If used, this feature allows bbmmaakkee to |
186 |
> |
easily search in the current source tree for customized sys.mk |
187 |
> |
files (e.g., by using ".../mk/sys.mk" as an argument). |
188 |
|
|
189 |
|
--nn Display the commands that would have been executed, but do not |
190 |
|
actually execute them unless the target depends on the .MAKE spe- |
211 |
|
to-date. |
212 |
|
|
213 |
|
--VV _v_a_r_i_a_b_l_e |
214 |
< |
Print bbmmaakkee's idea of the value of _v_a_r_i_a_b_l_e, in the global con- |
215 |
< |
text. Do not build any targets. Multiple instances of this |
216 |
< |
option may be specified; the variables will be printed one per |
217 |
< |
line, with a blank line for each null or undefined variable. If |
218 |
< |
_v_a_r_i_a_b_l_e contains a `$' then the value will be expanded before |
219 |
< |
printing. |
214 |
> |
Print the value of _v_a_r_i_a_b_l_e. Do not build any targets. Multiple |
215 |
> |
instances of this option may be specified; the variables will be |
216 |
> |
printed one per line, with a blank line for each null or unde- |
217 |
> |
fined variable. The value printed is extracted from the global |
218 |
> |
context after all makefiles have been read. By default, the raw |
219 |
> |
variable contents (which may include additional unexpanded vari- |
220 |
> |
able references) are shown. If _v_a_r_i_a_b_l_e contains a `$' then the |
221 |
> |
value will be recursively expanded to its complete resultant text |
222 |
> |
before printing. The expanded value will also be printed if |
223 |
> |
_._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S is set to true and the --ddVV option has not |
224 |
> |
been used to override it. Note that loop-local and target-local |
225 |
> |
variables, as well as values taken temporarily by global vari- |
226 |
> |
ables during makefile processing, are not accessible via this |
227 |
> |
option. The --ddvv debug mode can be used to see these at the cost |
228 |
> |
of generating substantial extraneous output. |
229 |
|
|
230 |
+ |
--vv _v_a_r_i_a_b_l_e |
231 |
+ |
Like --VV but the variable is always expanded to its complete |
232 |
+ |
value. |
233 |
+ |
|
234 |
|
--WW Treat any warnings during makefile parsing as errors. |
235 |
|
|
236 |
+ |
--ww Print entering and leaving directory messages, pre and post pro- |
237 |
+ |
cessing. |
238 |
+ |
|
239 |
|
--XX Don't export variables passed on the command line to the environ- |
240 |
|
ment individually. Variables passed on the command line are |
241 |
|
still exported via the _M_A_K_E_F_L_A_G_S environment variable. This |
288 |
|
done in the shell. |
289 |
|
|
290 |
|
SSHHEELLLL CCOOMMMMAANNDDSS |
291 |
< |
Each target may have associated with it a series of shell commands, nor- |
292 |
< |
mally used to create the target. Each of the commands in this script |
293 |
< |
_m_u_s_t be preceded by a tab. While any target may appear on a dependency |
294 |
< |
line, only one of these dependencies may be followed by a creation |
295 |
< |
script, unless the `::::' operator is used. |
291 |
> |
Each target may have associated with it one or more lines of shell com- |
292 |
> |
mands, normally used to create the target. Each of the lines in this |
293 |
> |
script _m_u_s_t be preceded by a tab. (For historical reasons, spaces are |
294 |
> |
not accepted.) While targets can appear in many dependency lines if |
295 |
> |
desired, by default only one of these rules may be followed by a creation |
296 |
> |
script. If the `::::' operator is used, however, all rules may include |
297 |
> |
scripts and the scripts are executed in the order found. |
298 |
|
|
299 |
< |
If the first characters of the command line are any combination of `@@', |
300 |
< |
`++', or `--', the command is treated specially. A `@@' causes the command |
301 |
< |
not to be echoed before it is executed. A `++' causes the command to be |
302 |
< |
executed even when --nn is given. This is similar to the effect of the |
303 |
< |
.MAKE special source, except that the effect can be limited to a single |
304 |
< |
line of a script. A `--' causes any non-zero exit status of the command |
305 |
< |
line to be ignored. |
299 |
> |
Each line is treated as a separate shell command, unless the end of line |
300 |
> |
is escaped with a backslash (`\') in which case that line and the next |
301 |
> |
are combined. If the first characters of the command are any combination |
302 |
> |
of `@@', `++', or `--', the command is treated specially. A `@@' causes the |
303 |
> |
command not to be echoed before it is executed. A `++' causes the command |
304 |
> |
to be executed even when --nn is given. This is similar to the effect of |
305 |
> |
the .MAKE special source, except that the effect can be limited to a sin- |
306 |
> |
gle line of a script. A `--' in compatibility mode causes any non-zero |
307 |
> |
exit status of the command line to be ignored. |
308 |
|
|
309 |
|
When bbmmaakkee is run in jobs mode with --jj _m_a_x___j_o_b_s, the entire script for |
310 |
< |
the target is fed to a single instance of the shell. |
310 |
> |
the target is fed to a single instance of the shell. In compatibility |
311 |
> |
(non-jobs) mode, each command is run in a separate process. If the com- |
312 |
> |
mand contains any shell meta characters (`#=|^(){};&<>*?[]:$`\\n') it |
313 |
> |
will be passed to the shell; otherwise bbmmaakkee will attempt direct execu- |
314 |
> |
tion. If a line starts with `--' and the shell has ErrCtl enabled then |
315 |
> |
failure of the command line will be ignored as in compatibility mode. |
316 |
> |
Otherwise `--' affects the entire job; the script will stop at the first |
317 |
> |
command line that fails, but the target will not be deemed to have |
318 |
> |
failed. |
319 |
|
|
293 |
– |
In compatibility (non-jobs) mode, each command is run in a separate |
294 |
– |
process. If the command contains any shell meta characters |
295 |
– |
(`#=|^(){};&<>*?[]:$`\\n') it will be passed to the shell, otherwise |
296 |
– |
bbmmaakkee will attempt direct execution. |
297 |
– |
|
298 |
– |
Since bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' before executing any targets, each |
299 |
– |
child process starts with that as its current working directory. |
300 |
– |
|
320 |
|
Makefiles should be written so that the mode of bbmmaakkee operation does not |
321 |
|
change their behavior. For example, any command which needs to use |
322 |
< |
``cd'' or ``chdir'', without side-effect should be put in parenthesis: |
322 |
> |
``cd'' or ``chdir'' without potentially changing the directory for subse- |
323 |
> |
quent commands should be put in parentheses so it executes in a subshell. |
324 |
> |
To force the use of one shell, escape the line breaks so as to make the |
325 |
> |
whole script one command. For example: |
326 |
|
|
305 |
– |
|
327 |
|
avoid-chdir-side-effects: |
328 |
|
@echo Building $@ in `pwd` |
329 |
< |
@(cd ${.CURDIR} && ${.MAKE} $@) |
329 |
> |
@(cd ${.CURDIR} && ${MAKE} $@) |
330 |
|
@echo Back in `pwd` |
331 |
|
|
332 |
|
ensure-one-shell-regardless-of-mode: |
333 |
|
@echo Building $@ in `pwd`; \ |
334 |
< |
(cd ${.CURDIR} && ${.MAKE} $@); \ |
334 |
> |
(cd ${.CURDIR} && ${MAKE} $@); \ |
335 |
|
echo Back in `pwd` |
336 |
|
|
337 |
+ |
Since bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' before executing any targets, each |
338 |
+ |
child process starts with that as its current working directory. |
339 |
+ |
|
340 |
|
VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS |
341 |
|
Variables in make are much like variables in the shell, and, by tradi- |
342 |
|
tion, consist of all upper-case letters. |
426 |
|
Variables defined as part of the command line. |
427 |
|
|
428 |
|
Local variables |
429 |
< |
Variables that are defined specific to a certain target. The |
406 |
< |
seven local variables are as follows: |
429 |
> |
Variables that are defined specific to a certain target. |
430 |
|
|
431 |
< |
_._A_L_L_S_R_C The list of all sources for this target; also known as |
432 |
< |
`_>'. |
431 |
> |
Local variables are all built in and their values vary magically from |
432 |
> |
target to target. It is not currently possible to define new local vari- |
433 |
> |
ables. The seven local variables are as follows: |
434 |
|
|
435 |
< |
_._A_R_C_H_I_V_E The name of the archive file. |
435 |
> |
_._A_L_L_S_R_C The list of all sources for this target; also known as |
436 |
> |
`_>'. |
437 |
|
|
438 |
< |
_._I_M_P_S_R_C In suffix-transformation rules, the name/path of the |
414 |
< |
source from which the target is to be transformed (the |
415 |
< |
``implied'' source); also known as `_<'. It is not |
416 |
< |
defined in explicit rules. |
438 |
> |
_._A_R_C_H_I_V_E The name of the archive file; also known as `_!'. |
439 |
|
|
440 |
< |
_._M_E_M_B_E_R The name of the archive member. |
440 |
> |
_._I_M_P_S_R_C In suffix-transformation rules, the name/path of the |
441 |
> |
source from which the target is to be transformed (the |
442 |
> |
``implied'' source); also known as `_<'. It is not |
443 |
> |
defined in explicit rules. |
444 |
|
|
445 |
< |
_._O_O_D_A_T_E The list of sources for this target that were deemed |
421 |
< |
out-of-date; also known as `_?'. |
445 |
> |
_._M_E_M_B_E_R The name of the archive member; also known as `_%'. |
446 |
|
|
447 |
< |
_._P_R_E_F_I_X The file prefix of the target, containing only the file |
448 |
< |
portion, no suffix or preceding directory components; |
425 |
< |
also known as `_*'. |
447 |
> |
_._O_O_D_A_T_E The list of sources for this target that were deemed out- |
448 |
> |
of-date; also known as `_?'. |
449 |
|
|
450 |
< |
_._T_A_R_G_E_T The name of the target; also known as `_@'. |
450 |
> |
_._P_R_E_F_I_X The file prefix of the target, containing only the file |
451 |
> |
portion, no suffix or preceding directory components; |
452 |
> |
also known as `_*'. The suffix must be one of the known |
453 |
> |
suffixes declared with ..SSUUFFFFIIXXEESS or it will not be recog- |
454 |
> |
nized. |
455 |
|
|
456 |
< |
The shorter forms `_@', `_?', `_<', `_>', and `_*' are permitted for |
457 |
< |
backward compatibility with historical makefiles and are not rec- |
458 |
< |
ommended. The six variables `_@_F', `_@_D', `_<_F', `_<_D', `_*_F', and |
432 |
< |
`_*_D' are permitted for compatibility with AT&T System V UNIX |
433 |
< |
makefiles and are not recommended. |
456 |
> |
_._T_A_R_G_E_T The name of the target; also known as `_@'. For compati- |
457 |
> |
bility with other makes this is an alias for ..AARRCCHHIIVVEE in |
458 |
> |
archive member rules. |
459 |
|
|
460 |
< |
Four of the local variables may be used in sources on dependency |
461 |
< |
lines because they expand to the proper value for each target on |
462 |
< |
the line. These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E', |
438 |
< |
and `_._M_E_M_B_E_R'. |
460 |
> |
The shorter forms (`_>', `_!', `_<', `_%', `_?', `_*', and `_@') are permitted |
461 |
> |
for backward compatibility with historical makefiles and legacy POSIX |
462 |
> |
make and are not recommended. |
463 |
|
|
464 |
+ |
Variants of these variables with the punctuation followed immediately by |
465 |
+ |
`D' or `F', e.g. `_$_(_@_D_)', are legacy forms equivalent to using the `:H' |
466 |
+ |
and `:T' modifiers. These forms are accepted for compatibility with AT&T |
467 |
+ |
System V UNIX makefiles and POSIX but are not recommended. |
468 |
+ |
|
469 |
+ |
Four of the local variables may be used in sources on dependency lines |
470 |
+ |
because they expand to the proper value for each target on the line. |
471 |
+ |
These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E', and `_._M_E_M_B_E_R'. |
472 |
+ |
|
473 |
|
AAddddiittiioonnaall bbuuiilltt--iinn vvaarriiaabblleess |
474 |
|
In addition, bbmmaakkee sets or knows about the following variables: |
475 |
|
|
503 |
|
|
504 |
|
_._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S |
505 |
|
A boolean that controls the default behavior of the --VV |
506 |
< |
option. |
506 |
> |
option. If true, variable values printed with --VV are |
507 |
> |
fully expanded; if false, the raw variable contents |
508 |
> |
(which may include additional unexpanded variable refer- |
509 |
> |
ences) are shown. |
510 |
|
|
511 |
|
_._M_A_K_E_._E_X_P_O_R_T_E_D The list of variables exported by bbmmaakkee. |
512 |
|
|
549 |
|
mode that bbmmaakkee runs in. It can contain a number of key- |
550 |
|
words: |
551 |
|
|
552 |
< |
_c_o_m_p_a_t Like --BB, puts bbmmaakkee into "compat" mode. |
552 |
> |
_c_o_m_p_a_t Like --BB, puts bbmmaakkee into "compat" |
553 |
> |
mode. |
554 |
|
|
555 |
< |
_m_e_t_a Puts bbmmaakkee into "meta" mode, where meta files |
556 |
< |
are created for each target to capture the |
557 |
< |
command run, the output generated and if |
558 |
< |
filemon(4) is available, the system calls |
559 |
< |
which are of interest to bbmmaakkee. The captured |
560 |
< |
output can be very useful when diagnosing |
561 |
< |
errors. |
555 |
> |
_m_e_t_a Puts bbmmaakkee into "meta" mode, where |
556 |
> |
meta files are created for each tar- |
557 |
> |
get to capture the command run, the |
558 |
> |
output generated and if filemon(4) |
559 |
> |
is available, the system calls which |
560 |
> |
are of interest to bbmmaakkee. The cap- |
561 |
> |
tured output can be very useful when |
562 |
> |
diagnosing errors. |
563 |
|
|
564 |
< |
_c_u_r_d_i_r_O_k_= _b_f Normally bbmmaakkee will not create .meta files |
565 |
< |
in `_._C_U_R_D_I_R'. This can be overridden by set- |
566 |
< |
ting _b_f to a value which represents True. |
564 |
> |
_c_u_r_d_i_r_O_k_= _b_f Normally bbmmaakkee will not create .meta |
565 |
> |
files in `_._C_U_R_D_I_R'. This can be |
566 |
> |
overridden by setting _b_f to a value |
567 |
> |
which represents True. |
568 |
|
|
569 |
< |
_e_n_v For debugging, it can be useful to inlcude |
570 |
< |
the environment in the .meta file. |
569 |
> |
_m_i_s_s_i_n_g_-_m_e_t_a_= _b_f If _b_f is True, then a missing .meta |
570 |
> |
file makes the target out-of-date. |
571 |
|
|
572 |
< |
_v_e_r_b_o_s_e If in "meta" mode, print a clue about the |
573 |
< |
target being built. This is useful if the |
535 |
< |
build is otherwise running silently. The |
536 |
< |
message printed the value of: |
537 |
< |
_._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X. |
572 |
> |
_m_i_s_s_i_n_g_-_f_i_l_e_m_o_n_= _b_f If _b_f is True, then missing filemon |
573 |
> |
data makes the target out-of-date. |
574 |
|
|
575 |
< |
_i_g_n_o_r_e_-_c_m_d Some makefiles have commands which are simply |
540 |
< |
not stable. This keyword causes them to be |
541 |
< |
ignored for determining whether a target is |
542 |
< |
out of date in "meta" mode. See also |
543 |
< |
..NNOOMMEETTAA__CCMMPP. |
575 |
> |
_n_o_f_i_l_e_m_o_n Do not use filemon(4). |
576 |
|
|
577 |
< |
_s_i_l_e_n_t_= _b_f If _b_f is True, when a .meta file is created, |
578 |
< |
mark the target ..SSIILLEENNTT. |
577 |
> |
_e_n_v For debugging, it can be useful to |
578 |
> |
include the environment in the .meta |
579 |
> |
file. |
580 |
|
|
581 |
+ |
_v_e_r_b_o_s_e If in "meta" mode, print a clue |
582 |
+ |
about the target being built. This |
583 |
+ |
is useful if the build is otherwise |
584 |
+ |
running silently. The message |
585 |
+ |
printed the value of: |
586 |
+ |
_._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X. |
587 |
+ |
|
588 |
+ |
_i_g_n_o_r_e_-_c_m_d Some makefiles have commands which |
589 |
+ |
are simply not stable. This keyword |
590 |
+ |
causes them to be ignored for deter- |
591 |
+ |
mining whether a target is out of |
592 |
+ |
date in "meta" mode. See also |
593 |
+ |
..NNOOMMEETTAA__CCMMPP. |
594 |
+ |
|
595 |
+ |
_s_i_l_e_n_t_= _b_f If _b_f is True, when a .meta file is |
596 |
+ |
created, mark the target ..SSIILLEENNTT. |
597 |
+ |
|
598 |
|
_._M_A_K_E_._M_E_T_A_._B_A_I_L_I_W_I_C_K |
599 |
|
In "meta" mode, provides a list of prefixes which match |
600 |
|
the directories controlled by bbmmaakkee. If a file that was |
618 |
|
The default list includes: `_/_d_e_v _/_e_t_c _/_p_r_o_c _/_t_m_p _/_v_a_r_/_r_u_n |
619 |
|
_/_v_a_r_/_t_m_p' |
620 |
|
|
621 |
+ |
_._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___P_A_T_T_E_R_N_S |
622 |
+ |
Provides a list of patterns to match against pathnames. |
623 |
+ |
Ignore any that match. |
624 |
+ |
|
625 |
+ |
_._M_A_K_E_._M_E_T_A_._I_G_N_O_R_E___F_I_L_T_E_R |
626 |
+ |
Provides a list of variable modifiers to apply to each |
627 |
+ |
pathname. Ignore if the expansion is an empty string. |
628 |
+ |
|
629 |
|
_._M_A_K_E_._M_E_T_A_._P_R_E_F_I_X |
630 |
|
Defines the message printed for each meta file updated in |
631 |
|
"meta verbose" mode. The default value is: |
633 |
|
|
634 |
|
_._M_A_K_E_O_V_E_R_R_I_D_E_S This variable is used to record the names of variables |
635 |
|
assigned to on the command line, so that they may be |
636 |
< |
exported as part of `MAKEFLAGS'. This behaviour can be |
636 |
> |
exported as part of `MAKEFLAGS'. This behavior can be |
637 |
|
disabled by assigning an empty value to `_._M_A_K_E_O_V_E_R_R_I_D_E_S' |
638 |
|
within a makefile. Extra variables can be exported from |
639 |
|
a makefile by appending their names to `_._M_A_K_E_O_V_E_R_R_I_D_E_S'. |
649 |
|
|
650 |
|
_._M_A_K_E_._P_P_I_D The parent process-id of bbmmaakkee. |
651 |
|
|
652 |
+ |
_._M_A_K_E_._S_A_V_E___D_O_L_L_A_R_S |
653 |
+ |
value should be a boolean that controls whether `$$' are |
654 |
+ |
preserved when doing `:=' assignments. The default is |
655 |
+ |
false, for backwards compatibility. Set to true for com- |
656 |
+ |
patability with other makes. If set to false, `$$' |
657 |
+ |
becomes `$' per normal evaluation rules. |
658 |
+ |
|
659 |
|
_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R |
660 |
< |
When bbmmaakkee stops due to an error, it prints its name and |
661 |
< |
the value of `_._C_U_R_D_I_R' as well as the value of any vari- |
662 |
< |
ables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. |
660 |
> |
When bbmmaakkee stops due to an error, it sets `_._E_R_R_O_R___T_A_R_G_E_T' |
661 |
> |
to the name of the target that failed, `_._E_R_R_O_R___C_M_D' to |
662 |
> |
the commands of the failed target, and in "meta" mode, it |
663 |
> |
also sets `_._E_R_R_O_R___C_W_D' to the getcwd(3), and |
664 |
> |
`_._E_R_R_O_R___M_E_T_A___F_I_L_E' to the path of the meta file (if any) |
665 |
> |
describing the failed target. It then prints its name |
666 |
> |
and the value of `_._C_U_R_D_I_R' as well as the value of any |
667 |
> |
variables named in `_M_A_K_E___P_R_I_N_T___V_A_R___O_N___E_R_R_O_R'. |
668 |
|
|
669 |
|
_._n_e_w_l_i_n_e This variable is simply assigned a newline character as |
670 |
|
its value. This allows expansions using the ::@@ modifier |
701 |
|
may be used. This is especially useful with |
702 |
|
`MAKEOBJDIR'. |
703 |
|
|
704 |
< |
`_._O_B_J_D_I_R' may be modified in the makefile as a global |
705 |
< |
variable. In all cases, bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' |
706 |
< |
and set `PWD' to that directory before executing any tar- |
707 |
< |
gets. |
704 |
> |
`_._O_B_J_D_I_R' may be modified in the makefile via the special |
705 |
> |
target `..OOBBJJDDIIRR'. In all cases, bbmmaakkee will chdir(2) to |
706 |
> |
the specified directory if it exists, and set `_._O_B_J_D_I_R' |
707 |
> |
and `PWD' to that directory before executing any targets. |
708 |
|
|
709 |
|
_._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 |
710 |
|
parsed. |
724 |
|
sets `_._C_U_R_D_I_R' to the canonical path given by getcwd(3). |
725 |
|
However, if the environment variable `PWD' is set and |
726 |
|
gives a path to the current directory, then bbmmaakkee sets |
727 |
< |
`_._C_U_R_D_I_R' to the value of `PWD' instead. This behaviour |
727 |
> |
`_._C_U_R_D_I_R' to the value of `PWD' instead. This behavior |
728 |
|
is disabled if `MAKEOBJDIRPREFIX' is set or `MAKEOBJDIR' |
729 |
|
contains a variable transform. `PWD' is set to the value |
730 |
|
of `_._O_B_J_D_I_R' for all programs which bbmmaakkee executes. |
771 |
|
of the way values are split into words, matched, and then joined, a |
772 |
|
construct like |
773 |
|
${VAR:M*} |
774 |
< |
will normalise the inter-word spacing, removing all leading and |
774 |
> |
will normalize the inter-word spacing, removing all leading and |
775 |
|
trailing space, and converting multiple consecutive spaces to single |
776 |
|
spaces. |
777 |
|
|
784 |
|
|
785 |
|
::OOxx Randomize words in variable. The results will be different each |
786 |
|
time you are referring to the modified variable; use the assignment |
787 |
< |
with expansion (`::==') to prevent such behaviour. For example, |
787 |
> |
with expansion (`::==') to prevent such behavior. For example, |
788 |
|
|
789 |
|
LIST= uno due tre quattro |
790 |
|
RANDOM_LIST= ${LIST:Ox} |
807 |
|
|
808 |
|
::RR Replaces each word in the variable with everything but its suffix. |
809 |
|
|
810 |
< |
::ggmmttiimmee |
811 |
< |
The value is a format string for strftime(3), using the current |
812 |
< |
gmtime(3). |
810 |
> |
::rraannggee[[==ccoouunntt]] |
811 |
> |
The value is an integer sequence representing the words of the orig- |
812 |
> |
inal value, or the supplied _c_o_u_n_t. |
813 |
|
|
814 |
+ |
::ggmmttiimmee[[==uuttcc]] |
815 |
+ |
The value is a format string for strftime(3), using gmtime(3). If a |
816 |
+ |
_u_t_c value is not provided or is 0, the current time is used. |
817 |
+ |
|
818 |
|
::hhaasshh |
819 |
< |
Compute a 32bit hash of the value and encode it as hex digits. |
819 |
> |
Compute a 32-bit hash of the value and encode it as hex digits. |
820 |
|
|
821 |
< |
::llooccaallttiimmee |
822 |
< |
The value is a format string for strftime(3), using the current |
823 |
< |
localtime(3). |
821 |
> |
::llooccaallttiimmee[[==uuttcc]] |
822 |
> |
The value is a format string for strftime(3), using localtime(3). |
823 |
> |
If a _u_t_c value is not provided or is 0, the current time is used. |
824 |
|
|
825 |
|
::ttAA Attempt to convert variable to an absolute path using realpath(3), |
826 |
|
if that fails, the value is unchanged. |
921 |
|
However a single character variable is often more readable: |
922 |
|
${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} |
923 |
|
|
924 |
+ |
::__[[==vvaarr]] |
925 |
+ |
Save the current variable value in `$_' or the named _v_a_r for later |
926 |
+ |
reference. Example usage: |
927 |
+ |
|
928 |
+ |
M_cmpv.units = 1 1000 1000000 |
929 |
+ |
M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \ |
930 |
+ |
\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh |
931 |
+ |
|
932 |
+ |
.if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} |
933 |
+ |
|
934 |
+ |
Here `$_' is used to save the result of the `:S' modifier which is |
935 |
+ |
later referenced using the index values from `:range'. |
936 |
+ |
|
937 |
|
::UU_n_e_w_v_a_l |
938 |
|
If the variable is undefined _n_e_w_v_a_l is the value. If the variable |
939 |
|
is defined, the existing value is returned. This is another ODE |
985 |
|
tions related to the way in which the value is divided into words. |
986 |
|
|
987 |
|
Ordinarily, a value is treated as a sequence of words delimited by |
988 |
< |
white space. Some modifiers suppress this behaviour, causing a |
989 |
< |
value to be treated as a single word (possibly containing embedded |
990 |
< |
white space). An empty value, or a value that consists entirely of |
991 |
< |
white-space, is treated as a single word. For the purposes of the |
992 |
< |
`::[[]]' modifier, the words are indexed both forwards using positive |
993 |
< |
integers (where index 1 represents the first word), and backwards |
994 |
< |
using negative integers (where index -1 represents the last word). |
988 |
> |
white space. Some modifiers suppress this behavior, causing a value |
989 |
> |
to be treated as a single word (possibly containing embedded white |
990 |
> |
space). An empty value, or a value that consists entirely of white- |
991 |
> |
space, is treated as a single word. For the purposes of the `::[[]]' |
992 |
> |
modifier, the words are indexed both forwards using positive inte- |
993 |
> |
gers (where index 1 represents the first word), and backwards using |
994 |
> |
negative integers (where index -1 represents the last word). |
995 |
|
|
996 |
|
The _r_a_n_g_e is subjected to variable expansion, and the expanded |
997 |
|
result is then interpreted as follows: |
1028 |
|
used, the including makefile's directory and any directories specified |
1029 |
|
using the --II option are searched before the system makefile directory. |
1030 |
|
For compatibility with other versions of bbmmaakkee `include file ...' is also |
1031 |
< |
accepted. If the include statement is written as ..--iinncclluuddee or as |
945 |
< |
..ssiinncclluuddee then errors locating and/or opening include files are ignored. |
1031 |
> |
accepted. |
1032 |
|
|
1033 |
+ |
If the include statement is written as ..--iinncclluuddee or as ..ssiinncclluuddee then |
1034 |
+ |
errors locating and/or opening include files are ignored. |
1035 |
+ |
|
1036 |
+ |
If the include statement is written as ..ddiinncclluuddee not only are errors |
1037 |
+ |
locating and/or opening include files ignored, but stale dependencies |
1038 |
+ |
within the included file will be ignored just like _._M_A_K_E_._D_E_P_E_N_D_F_I_L_E. |
1039 |
+ |
|
1040 |
|
Conditional expressions are also preceded by a single dot as the first |
1041 |
|
character of a line. The possible conditionals are as follows: |
1042 |
|
|
1059 |
|
to _._M_A_K_E_._E_X_P_O_R_T_E_D. This allows exporting a value to the environ- |
1060 |
|
ment which is different from that used by bbmmaakkee internally. |
1061 |
|
|
1062 |
+ |
..eexxppoorrtt--lliitteerraall _v_a_r_i_a_b_l_e _._._. |
1063 |
+ |
The same as `.export-env', except that variables in the value are |
1064 |
+ |
not expanded. |
1065 |
+ |
|
1066 |
|
..iinnffoo _m_e_s_s_a_g_e |
1067 |
|
The message is printed along with the name of the makefile and |
1068 |
|
line number. |
1320 |
|
target that inherits ..DDEEFFAAUULLTT's commands is set to the target's |
1321 |
|
own name. |
1322 |
|
|
1323 |
+ |
..DDEELLEETTEE__OONN__EERRRROORR |
1324 |
+ |
If this target is present in the makefile, it globally causes |
1325 |
+ |
make to delete targets whose commands fail. (By default, only |
1326 |
+ |
targets whose commands are interrupted during execution are |
1327 |
+ |
deleted. This is the historical behavior.) This setting can be |
1328 |
+ |
used to help prevent half-finished or malformed targets from |
1329 |
+ |
being left around and corrupting future rebuilds. |
1330 |
+ |
|
1331 |
|
..EENNDD Any command lines attached to this target are executed after |
1332 |
|
everything else is done. |
1333 |
|
|
1360 |
|
Synonym for ..NNOOTTPPAARRAALLLLEELL, for compatibility with other pmake |
1361 |
|
variants. |
1362 |
|
|
1363 |
+ |
..OOBBJJDDIIRR The source is a new value for `_._O_B_J_D_I_R'. If it exists, bbmmaakkee |
1364 |
+ |
will chdir(2) to it and update the value of `_._O_B_J_D_I_R'. |
1365 |
+ |
|
1366 |
|
..OORRDDEERR The named targets are made in sequence. This ordering does not |
1367 |
|
add targets to the list of targets to be made. Since the depen- |
1368 |
|
dents of a target do not get built until the target itself could |
1396 |
|
sources are a set of _f_i_e_l_d_=_v_a_l_u_e pairs. |
1397 |
|
|
1398 |
|
_n_a_m_e This is the minimal specification, used to select |
1399 |
< |
one of the builtin shell specs; _s_h, _k_s_h, and _c_s_h. |
1399 |
> |
one of the built-in shell specs; _s_h, _k_s_h, and _c_s_h. |
1400 |
|
|
1401 |
|
_p_a_t_h Specifies the path to the shell. |
1402 |
|
|
1464 |
|
/usr/share/mk system makefile directory |
1465 |
|
|
1466 |
|
CCOOMMPPAATTIIBBIILLIITTYY |
1467 |
< |
The basic make syntax is compatible between different versions of make, |
1467 |
> |
The basic make syntax is compatible between different versions of make; |
1468 |
|
however the special variables, variable modifiers and conditionals are |
1469 |
|
not. |
1470 |
|
|
1471 |
< |
The way that parallel makes are scheduled changed in NetBSD 4.0 so that |
1472 |
< |
.ORDER and .WAIT apply recursively to the dependent nodes. The algo- |
1365 |
< |
rithms used may change again in the future. |
1471 |
> |
OOllddeerr vveerrssiioonnss |
1472 |
> |
An incomplete list of changes in older versions of bbmmaakkee: |
1473 |
|
|
1474 |
|
The way that .for loop variables are substituted changed after NetBSD 5.0 |
1475 |
|
so that they still appear to be variable expansions. In particular this |
1476 |
|
stops them being treated as syntax, and removes some obscure problems |
1477 |
|
using them in .if statements. |
1478 |
|
|
1479 |
+ |
The way that parallel makes are scheduled changed in NetBSD 4.0 so that |
1480 |
+ |
.ORDER and .WAIT apply recursively to the dependent nodes. The algo- |
1481 |
+ |
rithms used may change again in the future. |
1482 |
+ |
|
1483 |
+ |
OOtthheerr mmaakkee ddiiaalleeccttss |
1484 |
+ |
Other make dialects (GNU make, SVR4 make, POSIX make, etc.) do not sup- |
1485 |
+ |
port most of the features of bbmmaakkee as described in this manual. Most |
1486 |
+ |
notably: |
1487 |
+ |
|
1488 |
+ |
++oo The ..WWAAIITT and ..OORRDDEERR declarations and most functionality per- |
1489 |
+ |
taining to parallelization. (GNU make supports parallelization |
1490 |
+ |
but lacks these features needed to control it effectively.) |
1491 |
+ |
|
1492 |
+ |
++oo Directives, including for loops and conditionals and most of |
1493 |
+ |
the forms of include files. (GNU make has its own incompatible |
1494 |
+ |
and less powerful syntax for conditionals.) |
1495 |
+ |
|
1496 |
+ |
++oo All built-in variables that begin with a dot. |
1497 |
+ |
|
1498 |
+ |
++oo Most of the special sources and targets that begin with a dot, |
1499 |
+ |
with the notable exception of ..PPHHOONNYY, ..PPRREECCIIOOUUSS, and ..SSUUFFFFIIXXEESS. |
1500 |
+ |
|
1501 |
+ |
++oo Variable modifiers, except for the |
1502 |
+ |
:old=new |
1503 |
+ |
string substitution, which does not portably support globbing |
1504 |
+ |
with `%' and historically only works on declared suffixes. |
1505 |
+ |
|
1506 |
+ |
++oo The $$>> variable even in its short form; most makes support this |
1507 |
+ |
functionality but its name varies. |
1508 |
+ |
|
1509 |
+ |
Some features are somewhat more portable, such as assignment with ++==, ??==, |
1510 |
+ |
and !!==. The ..PPAATTHH functionality is based on an older feature VVPPAATTHH found |
1511 |
+ |
in GNU make and many versions of SVR4 make; however, historically its |
1512 |
+ |
behavior is too ill-defined (and too buggy) to rely upon. |
1513 |
+ |
|
1514 |
+ |
The $$@@ and $$<< variables are more or less universally portable, as is the |
1515 |
+ |
$$((MMAAKKEE)) variable. Basic use of suffix rules (for files only in the cur- |
1516 |
+ |
rent directory, not trying to chain transformations together, etc.) is |
1517 |
+ |
also reasonably portable. |
1518 |
+ |
|
1519 |
|
SSEEEE AALLSSOO |
1520 |
|
mkdep(1) |
1521 |
|
|
1541 |
|
|
1542 |
|
There is no way of escaping a space character in a filename. |
1543 |
|
|
1544 |
< |
NetBSD 5.1 February 14, 2014 NetBSD 5.1 |
1544 |
> |
NetBSD 7.1_RC1 June 22, 2017 NetBSD 7.1_RC1 |