xref: /freebsd/contrib/bmake/bmake.cat1 (revision a91a246563dffa876a52f53a98de4af9fa364c52)
1is  a  program designed to simplify the maintenance of other pro-
2grams.  Its input is a list of specifications  as  to  the  files
3upon  which  programs  and  other  files depend.  If no option is
4given, tries to open then in order to  find  the  specifications.
5If  the file exists, it is read, see This manual page is intended
6as a reference document only.  For a more thorough description of
7and makefiles, please refer to (from 1993).   prepends  the  con-
8tents  of  the environment variable to the command line arguments
9before parsing them.  The options are as follows: Try to be back-
10wards compatible by executing a single shell per command  and  by
11making  the  sources of a dependency line in sequence.  Change to
12before reading the makefiles or doing anything else.  If multiple
13options are specified, each is interpreted relative to the previ-
14ous one: is equivalent to Define to be 1, in  the  global  scope.
15Turn on debugging, and specify which portions of are to print de-
16bugging  information.   Unless the flags are preceded by they are
17added to the environment variable and are passed on to any  child
18make  processes.  By default, debugging information is printed to
19standard error, but this can be changed using the debugging flag.
20The debugging output is always unbuffered; in addition, if debug-
21ging is enabled but debugging output is not directed to  standard
22output, the standard output is line buffered.  The available are:
23Print  all possible debugging information; equivalent to specify-
24ing all of the  debugging  flags.   Print  debugging  information
25about archive searching and caching.  Print debugging information
26about the current working directory.  Print debugging information
27about  conditional evaluation.  Print debugging information about
28directory searching and  caching.   Print  debugging  information
29about  failed commands and targets.  Specify where debugging out-
30put is written.  This must be the last flag, because it  consumes
31the  remainder of the argument.  If the character immediately af-
32ter the flag is the file is opened in append mode; otherwise  the
33file  is overwritten.  If the file name is or debugging output is
34written to the standard output or standard error  output  respec-
35tively  (and the option has no effect).  Otherwise, the output is
36written to the named file.  If the file name ends with the is re-
37placed by the pid.  Print debugging information about loop evalu-
38ation.  Print the input graph before making anything.  Print  the
39input  graph after making everything, or before exiting on error.
40Print the input graph before exiting on error.   Print  debugging
41information  about hash table operations.  Print debugging infor-
42mation about running multiple shells.  Turn on lint checks.  This
43throws errors for variable assignments that  do  not  parse  cor-
44rectly,  at  the  time of assignment, so the file and line number
45are available.  Print commands in Makefiles regardless of whether
46or not they are prefixed by or other flags.  Also known as behav-
47ior.  Print debugging information about mode decisions about tar-
48gets.  Print debugging information about making targets,  includ-
49ing  modification  dates.   Don't  delete  the  temporary command
50scripts created when running commands.  These  temporary  scripts
51are created in the directory referred to by the environment vari-
52able,  or  in if is unset or set to the empty string.  The tempo-
53rary scripts are created by and have names of the form  This  can
54create many files in or so use with care.  Print debugging infor-
55mation about makefile parsing.  Print debugging information about
56suffix-transformation  rules.   Print debugging information about
57target list maintenance.  Force the option to print raw values of
58variables, overriding the default behavior set via  Print  debug-
59ging  information  about  variable assignment and expansion.  Run
60shell commands with so the actual commands are  printed  as  they
61are  executed.   Let  environment variables override global vari-
62ables within makefiles.  Specify a makefile to  read  instead  of
63the  default or If is standard input is read.  Multiple makefiles
64may be specified, and are read in the order specified.  Specify a
65directory in which to search for  makefiles  and  included  make-
66files.   The  system  makefile directory (or directories, see the
67option) is automatically included as part of this  list.   Ignore
68non-zero  exit  of shell commands in the makefile.  Equivalent to
69specifying before each command line in the makefile.  This option
70should be specified by the user.  When the option is in use in  a
71recursive  build,  this option is passed by a make to child makes
72to allow all the make processes in  the  build  to  cooperate  to
73avoid overloading the system.  Specify the maximum number of jobs
74that  may  have  running at any one time.  If is a floating point
75number, or ends with then the value is multiplied by  the  number
76of CPUs reported online by The value of is saved in Turns compat-
77ibility mode off, unless the option is also specified.  When com-
78patibility mode is off, all commands associated with a target are
79executed  in  a  single shell invocation as opposed to the tradi-
80tional one shell invocation per line.  This can break traditional
81scripts which change directories on each command  invocation  and
82then  expect  to start with a fresh environment on the next line.
83It is more efficient to correct  the  scripts  rather  than  turn
84backwards compatibility on.  A job token pool with tokens is used
85to  control  the  total number of jobs running.  Each instance of
86will wait for a token from the pool before  running  a  new  job.
87Continue  processing  after  errors  are encountered, but only on
88those targets that do not depend on  the  target  whose  creation
89caused the error.  Specify a directory in which to search for and
90makefiles  included via the include statement.  The option can be
91used multiple times to form a search path.  This  path  overrides
92the  default  system include path Furthermore, the system include
93path is appended to the search path used for  include  statements
94(see  the option).  The system include path can be referenced via
95the read-only variable If a directory name in  the  argument  (or
96the environment variable) starts with the string searches for the
97specified  file  or  directory named in the remaining part of the
98argument string.  The search starts with  the  current  directory
99and  then  works  upward towards the root of the file system.  If
100the search is successful, the resulting  directory  replaces  the
101specification  in  the  argument.   This feature allows to easily
102search in the current source tree for customized files (e.g.,  by
103using as an argument).  Display the commands that would have been
104executed,  but do not actually execute them unless the target de-
105pends on the special source (see below) or the  command  is  pre-
106fixed  with  Display  the commands that would have been executed,
107but do not actually execute any of  them;  useful  for  debugging
108top-level  makefiles  without descending into subdirectories.  Do
109not execute any commands, instead exit 0 if the specified targets
110are up to date, and 1 otherwise.  Do not use the  built-in  rules
111specified in the system makefile.  Stop processing if an error is
112encountered.  This is the default behavior and the opposite of Do
113not echo any commands as they are executed.  Equivalent to speci-
114fying  before  each command line in the makefile.  When used with
115the flag, append a trace record to for each job started and  com-
116pleted.   Rather  than  re-building  a target as specified in the
117makefile, create it or update its modification time  to  make  it
118appear  up-to-date.  Print the value of Do not build any targets.
119Multiple instances of this option may be specified; the variables
120are printed one per line, with a blank line for each null or  un-
121defined variable.  The value printed is extracted from the global
122scope  after  all  makefiles have been read.  By default, the raw
123variable contents (which may include additional unexpanded  vari-
124able  references) are shown.  If contains a it is not interpreted
125as a variable name but rather as an expression.  Its value is ex-
126panded before printing.  The value is also expanded before print-
127ing if is set to true and the option has not been used  to  over-
128ride  it.   Note  that  loop-local and target-local variables, as
129well as values taken temporarily by global variables during make-
130file processing, are not accessible via this option.   The  debug
131mode  can be used to see these at the cost of generating substan-
132tial extraneous output.  Like but all printed variables  are  al-
133ways expanded to their complete value.  The last occurrence of or
134decides  whether  all  variables  are expanded or not.  Treat any
135warnings during makefile parsing as errors.  Print  entering  and
136leaving  directory  messages, pre and post processing.  Don't ex-
137port variables passed on the command line to the environment  in-
138dividually.   Variables  passed on the command line are still ex-
139ported via the environment variable.  This option may  be  useful
140on  systems which have a small limit on the size of command argu-
141ments.  Set the value of the variable  to  Normally,  all  values
142passed  on the command line are also exported to sub-makes in the
143environment.  The flag disables this behavior.  Variable  assign-
144ments should follow options for POSIX compatibility but no order-
145ing is enforced.  There are several different types of lines in a
146makefile: dependency specifications, shell commands, variable as-
147signments, include statements, conditional directives, for loops,
148other  directives, and comments.  Lines may be continued from one
149line to the next by ending them with  a  backslash  The  trailing
150newline  character  and  initial whitespace on the following line
151are compressed into a single space.  Dependency lines consist  of
152one or more targets, an operator, and zero or more sources.  This
153creates  a  relationship where the targets on the sources and are
154customarily created from them.  A target  is  considered  out  of
155date  if  it  does not exist, or if its modification time is less
156than that of any of its sources.  An out-of-date  target  is  re-
157created,  but  not until all sources have been examined and them-
158selves re-created as needed.  Three operators may be  used:  Many
159dependency  lines  may name this target but only one may have at-
160tached shell commands.  All sources named in all dependency lines
161are considered together, and if needed the  attached  shell  com-
162mands  are  run  to create or re-create the target.  If is inter-
163rupted, the target is removed.  The same, but the target  is  al-
164ways re-created whether or not it is out of date.  Any dependency
165line  may  have  attached shell commands, but each one is handled
166independently: its sources are considered and the attached  shell
167commands  are  run  if  the target is out of date with respect to
168(only) those sources.  Thus, different  groups  of  the  attached
169shell  commands  may be run depending on the circumstances.  Fur-
170thermore, unlike for dependency lines with no  sources,  the  at-
171tached  shell commands are always run.  Also unlike the target is
172not removed if is interrupted.  All dependency lines mentioning a
173particular target  must  use  the  same  operator.   Targets  and
174sources  may contain the shell wildcard values and The values and
175may only be used as part of the final component of the target  or
176source, and only match existing files.  The value need not neces-
177sarily  be  used to describe existing files.  Expansion is in di-
178rectory order, not alphabetically as done  in  the  shell.   Each
179target  may  have  associated  with it one or more lines of shell
180commands, normally used to create the target.  Each of the  lines
181in  this  script  be preceded by a tab.  (For historical reasons,
182spaces are not accepted.)  While targets can occur in many depen-
183dency lines if desired, by default only one of these rules may be
184followed by a creation script.  If the operator is used, however,
185all rules may include scripts, and the respective scripts are ex-
186ecuted in the order found.  Each line is treated  as  a  separate
187shell command, unless the end of line is escaped with a backslash
188in  which case that line and the next are combined.  If the first
189characters of the command are any combination of or  the  command
190is treated specially.  causes the command not to be echoed before
191it  is  executed.  causes the command to be executed even when is
192given.  This is similar to the effect of the special source,  ex-
193cept that the effect can be limited to a single line of a script.
194in compatibility mode causes any non-zero exit status of the com-
195mand  line  to be ignored.  When is run in jobs mode with the en-
196tire script for the target is fed to a  single  instance  of  the
197shell.   In compatibility (non-jobs) mode, each command is run in
198a separate process.  If the command contains any shell meta char-
199acters it is passed to the shell; otherwise attempts direct  exe-
200cution.   If a line starts with and the shell has ErrCtl enabled,
201failure of the command line is ignored as in compatibility  mode.
202Otherwise  affects  the entire job; the script stops at the first
203command line that fails, but the target is  not  deemed  to  have
204failed.   Makefiles  should be written so that the mode of opera-
205tion does not change their behavior.  For  example,  any  command
206which uses or without the intention of changing the directory for
207subsequent  commands  should be put in parentheses so it executes
208in a subshell.  To force the use of a single  shell,  escape  the
209line  breaks so as to make the whole script one command.  For ex-
210ample: avoid-chdir-side-effects:         @echo  "Building  $@  in
211$$(pwd)"          @(cd  ${.CURDIR}  &&  ${MAKE} $@)         @echo
212"Back in $$(pwd)"
213
214ensure-one-shell-regardless-of-mode:         @echo  "Building  $@
215in   $$(pwd)";   \          (cd  ${.CURDIR}  &&  ${MAKE}  $@);  \
216        echo "Back in $$(pwd)" Since changes the current  working
217directory  to  before  executing  any targets, each child process
218starts with that as its current working directory.  Variables  in
219make behave much like macros in the C preprocessor.  Variable as-
220signments  have  the  form where: is a single-word variable name,
221consisting, by tradition, of all upper-case letters,  is  one  of
222the  variable assignment operators described below, and is inter-
223preted according to the variable assignment operator.  Whitespace
224around and is discarded.  The five operators that  assign  values
225to variables are: Assign the value to the variable.  Any previous
226value  is  overwritten.  Append the value to the current value of
227the variable, separating them by  a  single  space.   Assign  the
228value  to  the variable if it is not already defined.  Expand the
229value, then assign it to the variable.  References  to  undefined
230variables  are  expanded.   This can cause problems when variable
231modifiers are used.  Expand the value and pass it  to  the  shell
232for  execution,  then assign the output from the child's standard
233output to the variable.  Any newlines in the result are  replaced
234with  spaces.  In most contexts where variables are expanded, ex-
235pands to a single dollar sign.  In other contexts (most  variable
236modifiers,  string  literals  in conditions), expands to a single
237dollar sign.  References to variables have the  form  or  If  the
238variable name consists of only a single character and the expres-
239sion  contains  no  modifiers,  the  surrounding  curly braces or
240parentheses are not required.  This shorter form  is  not  recom-
241mended.   If the variable name contains a dollar, the name itself
242is expanded first.  This allows almost arbitrary variable  names,
243however  names  containing  dollar, braces, parentheses or white-
244space are really best avoided.  If  the  result  of  expanding  a
245nested  variable  expression contains a dollar sign the result is
246subject to further expansion.  Variable  substitution  occurs  at
247four  distinct  times,  depending  on where the variable is being
248used.  Variables in dependency lines are expanded as the line  is
249read.   Variables  in conditionals are expanded individually, but
250only as far as necessary to determine the result  of  the  condi-
251tional.   Variables in shell commands are expanded when the shell
252command is executed.  loop index variables are expanded  on  each
253loop  iteration.  Note that other variables are not expanded when
254composing the body of a loop, so the following example code: .for
255i in 1 2 3 a+=     ${i} j=      ${i} b+=     ${j} .endfor
256
257all:         @echo ${a}         @echo ${b} prints: 1 2 3  3  3  3
258After  the  loop  is executed: contains which expands to contains
259which expands to contains which expands to  and  further  to  The
260four  different  classes  of  variables  (in  order of increasing
261precedence) are: Variables defined as part of environment.  Vari-
262ables defined in the makefile or in  included  makefiles.   Vari-
263ables  defined  as  part of the command line.  Variables that are
264defined specific to a certain target.  Local variables can be set
265on a dependency line, unless is set  to  The  rest  of  the  line
266(which already has had global variables expanded) is the variable
267value.  For example: COMPILER_WRAPPERS= ccache distcc icecc
268
269${OBJS}:  .MAKE.META.CMP_FILTER=${COMPILER_WRAPPERS:S,^,N,}  Only
270the targets are impacted by that filter (in mode) and simply  en-
271abling/disabling any of the compiler wrappers does not render all
272of  those targets out-of-date.  target-local variable assignments
273behave differently in that; Only appends to a previous local  as-
274signment for the same target and variable.  Is redundant with re-
275spect to global variables, which have already been expanded.  The
276seven  built-in  local variables are: The list of all sources for
277this target; also known as The name of  the  archive  file;  also
278known  as  In  suffix-transformation  rules, the name/path of the
279source from which the target is to be transformed  (the  source);
280also  known  as It is not defined in explicit rules.  The name of
281the archive member; also known as The list of  sources  for  this
282target  that  were  deemed out-of-date; also known as The name of
283the target with suffix (if declared in removed; also known as The
284name of the target; also known as For  compatibility  with  other
285makes  this is an alias for in archive member rules.  The shorter
286forms and are permitted for backward compatibility with  histori-
287cal  makefiles  and  legacy  POSIX  make and are not recommended.
288Variants of these variables with the punctuation followed immedi-
289ately by or e.g. are legacy forms equivalent  to  using  the  and
290modifiers.  These forms are accepted for compatibility with make-
291files and POSIX but are not recommended.  Four of the local vari-
292ables may be used in sources on dependency lines because they ex-
293pand  to  the  proper  value  for each target on the line.  These
294variables are and In addition, sets or knows about the  following
295variables:  The list of all targets encountered in the makefiles.
296If evaluated during makefile parsing, lists  only  those  targets
297encountered  thus  far.   A  path to the directory where was exe-
298cuted.  Refer to the description of for more details.  Is used in
299error handling, see Is used in error handling, see Is used in er-
300ror handling, see Is used in error handling in mode, see Is  used
301in  error  handling,  see The directory of the file this makefile
302was included from.  The filename of the file  this  makefile  was
303included  from.   The  machine  hardware  name,  see  The machine
304processor architecture name, see The name that was executed  with
305The  same as for compatibility.  The preferred variable to use is
306the environment variable because it is more compatible with other
307make variants and cannot be confused with the special target with
308the same name.  Names the makefile (default from which  generated
309dependencies  are read.  If set to do not print error information
310at the end.  A boolean that controls the default behavior of  the
311option.   If  true,  variable  values  printed with are fully ex-
312panded; if false, the raw variable contents  (which  may  include
313additional  unexpanded  variable references) are shown.  The list
314of variables exported by The top-level makefile that is currently
315read, as given in the command line.  The environment variable may
316contain anything that may be specified on command line.  Anything
317specified on command line is appended to the variable,  which  is
318then  added  to  the  environment for all programs that executes.
319The numeric group ID of the user running It is read-only.  If  is
320run  with the output for each target is prefixed with a token the
321first part of which can be controlled via If is empty,  no  token
322is  printed.   For  example, setting to would produce tokens like
323making it  easier  to  track  the  degree  of  parallelism  being
324achieved.   The argument to the option.  A read-only boolean that
325indicates whether the option supports use of The recursion  depth
326of The top-level instance of has level 0, and each child make has
327its  parent  level  plus  1.   This allows tests like: to protect
328things which should only be evaluated in the  top-level  instance
329of  The name of the environment variable that stores the level of
330nested calls to The ordered list of makefile names (default  that
331looks  for.   The  list  of makefiles read by which is useful for
332tracking dependencies.  Each makefile is recorded only once,  re-
333gardless  of  the number of times read.  In mode, provides a list
334of prefixes which match the directories controlled by If  a  file
335that  was generated outside of but within said bailiwick is miss-
336ing, the current target is considered out-of-date.  In  mode,  it
337can  (very rarely!) be useful to filter command lines before com-
338parison.  This variable can be set to a set of modifiers that are
339applied to each line of the old and new command that  differ,  if
340the filtered commands still differ, the target is considered out-
341of-date.   In mode, this variable contains a list of all the meta
342files updated.  If not empty, it can be used to trigger  process-
343ing  of  In  mode,  this variable contains a list of all the meta
344files used (updated or not).  This list can be  used  to  process
345the  meta  files  to  extract dependency information.  Provides a
346list of variable modifiers to apply to each pathname.  Ignore  if
347the  expansion  is an empty string.  Provides a list of path pre-
348fixes that should be ignored; because the contents  are  expected
349to  change over time.  The default list includes: Provides a list
350of patterns to match against pathnames.  Ignore any  that  match.
351Defines  the  message printed for each meta file updated in mode.
352The default value is: Processed after reading all makefiles.  Af-
353fects the mode that runs in.  It can contain these keywords: Like
354puts into mode.  Puts into mode, where meta files are created for
355each target to capture the command run, the output generated, and
356if is available, the system calls which are of  interest  to  The
357captured  output  can  be  useful when diagnosing errors.  By de-
358fault, does not create files in This can be overridden by setting
359to a value which represents true.  If is  true,  a  missing  file
360makes  the  target out-of-date.  If is true, missing filemon data
361makes the target out-of-date.  Do not use For debugging,  it  can
362be  useful  to  include the environment in the file.  If in mode,
363print a clue about the target being built.  This is useful if the
364build is otherwise running silently.  The message printed is  the
365expanded  value  of Some makefiles have commands which are simply
366not stable.  This keyword causes them to be ignored for determin-
367ing whether a target is out of date in  mode.   See  also  If  is
368true,  when a .meta file is created, mark the target In both com-
369pat and parallel mode, do not make the targets in the  usual  or-
370der, but instead randomize their order.  This mode can be used to
371detect  undeclared  dependencies  between  files.  Used to create
372files in a separate directory, see Used to force a  separate  di-
373rectory  for  the  created  files,  even if that directory is not
374writable, see Used to create files in a separate  directory,  see
375The  name  of  the  operating  system, see It is read-only.  This
376variable is used to record the names of variables assigned to  on
377the  command  line,  so that they may be exported as part of This
378behavior can be disabled by assigning an empty value to within  a
379makefile.  Extra variables can be exported from a makefile by ap-
380pending  their  names to is re-exported whenever is modified.  If
381was built with support, this is set to the  path  of  the  device
382node.   This  allows  makefiles  to  test  for this support.  The
383process ID of It is read-only.  The parent process ID  of  It  is
384read-only.   When  stops  due to an error, it sets to the name of
385the target that failed, to the exit status of the failed  target,
386to  the  commands of the failed target, and in mode, it also sets
387to the and to the path of the meta file (if any)  describing  the
388failed  target.  It then prints its name and the value of as well
389as the value of any variables named in  If  true,  are  preserved
390when doing assignments.  The default is false, for backwards com-
391patibility.   Set to true for compatability with other makes.  If
392set to false, becomes per normal evaluation rules.  If set to ap-
393parent variable assignments in dependency lines  are  treated  as
394normal  sources.   The numeric ID of the user running It is read-
395only.  This variable is simply assigned a  newline  character  as
396its  value.   It  is read-only.  This allows expansions using the
397modifier to put a newline between iterations of the  loop  rather
398than a space.  For example, in case of an error, prints the vari-
399able  names and their values using: A path to the directory where
400the targets are built.  Its value is determined by trying  to  to
401the  following  directories  in  order and using the first match:
402(Only if is set in the  environment  or  on  the  command  line.)
403(Only  if  is  set  in  the  environment or on the command line.)
404Variable expansion is performed on the value before it  is  used,
405so  expressions  such  as may be used.  This is especially useful
406with may be modified in the makefile via the  special  target  In
407all  cases,  changes to the specified directory if it exists, and
408sets and to that directory before executing any targets.   Except
409in  the case of an explicit target, checks that the specified di-
410rectory is writable and ignores it if not.   This  check  can  be
411skipped by setting the environment variable to The directory name
412of  the  current makefile being parsed.  The basename of the cur-
413rent makefile being parsed.  This variable and are both set  only
414while  the  makefiles  are being parsed.  To retain their current
415values, assign them to a variable using assignment with expansion
416The space-separated list of directories that searches for  files.
417To  update  this  search list, use the special target rather than
418modifying the variable directly.  Is set in POSIX mode,  see  the
419special  target.   Alternate path to the current directory.  nor-
420mally sets to the canonical path given by However, if  the  envi-
421ronment  variable  is  set and gives a path to the current direc-
422tory, sets to the value of instead.  This behavior is disabled if
423is set or contains a variable transform.  is set to the value  of
424for  all programs which executes.  The pathname of the shell used
425to run target scripts.  It is read-only.  The list of known  suf-
426fixes.  It is read-only.  The space-separated list of directories
427that  searches  for  makefiles, referred to as the system include
428path.  To update this search list, use the special target  rather
429than modifying the variable which is read-only.  The list of tar-
430gets  explicitly  specified  on  the  command  line, if any.  The
431colon-separated list of  directories  that  searches  for  files.
432This  variable  is supported for compatibility with old make pro-
433grams only, use instead.  The general format of a variable expan-
434sion is: Each modifier begins with a colon.  To escape  a  colon,
435precede  it  with a backslash A list of indirect modifiers can be
436specified via a variable, as follows:
437
438In this case, the first modifier in the does  not  start  with  a
439colon,  since  that colon already occurs in the referencing vari-
440able.  If any of the modifiers in  the  contains  a  dollar  sign
441these  must  be doubled to avoid early expansion.  Some modifiers
442interpret the expression value as a single string,  others  treat
443the  expression  value  as  a whitespace-separated list of words.
444When splitting a string into words, whitespace can be escaped us-
445ing double quotes, single quotes and  backslashes,  like  in  the
446shell.   The  quotes  and  backslashes are retained in the words.
447The supported modifiers are: Replaces each word with its  suffix.
448Replaces  each  word  with its dirname.  Selects only those words
449that match The standard shell  wildcard  characters  and  may  be
450used.  The wildcard characters may be escaped with a backslash As
451a  consequence  of  the way values are split into words, matched,
452and then joined, the construct removes all leading  and  trailing
453whitespace  and  normalizes  the  inter-word  spacing to a single
454space.  This is the opposite of  selecting  all  words  which  do
455match  Orders  the words lexicographically.  Orders the words nu-
456merically.  A number followed by one of or is multiplied  by  the
457appropriate  factor,  which is 1024 for 1048576 for or 1073741824
458for Both upper- and lower-case letters are accepted.  Orders  the
459words  in reverse lexicographical order.  Orders the words in re-
460verse numerical order.  Shuffles the words.  The results are dif-
461ferent each time you are referring to the modified variable;  use
462the  assignment with expansion to prevent such behavior.  For ex-
463ample,   LIST=                   uno   due   tre   quattro   RAN-
464DOM_LIST=            ${LIST:Ox}                       STATIC_RAN-
465DOM_LIST:=    ${LIST:Ox}
466
467all:           @echo   "${RANDOM_LIST}"           @echo   "${RAN-
468DOM_LIST}"          @echo  "${STATIC_RANDOM_LIST}"          @echo
469"${STATIC_RANDOM_LIST}" may produce output  similar  to:  quattro
470due tre uno tre due quattro uno due uno quattro tre due uno quat-
471tro  tre  Quotes every shell meta-character in the value, so that
472it can be passed safely to the shell.  Quotes every  shell  meta-
473character  in  the  value, and also doubles characters so that it
474can be passed safely through recursive  invocations  of  This  is
475equivalent  to Replaces each word with everything but its suffix.
476The value is an integer sequence representing the  words  of  the
477original  value,  or  the  supplied The value is interpreted as a
478format string for using producing the formatted timestamp.  Note:
479the format should only be used with If a value is not provided or
480is 0, the current time is used.  Computes a 32-bit  hash  of  the
481value  and  encodes it as 8 hex digits.  The value is interpreted
482as a format string for using producing the  formatted  timestamp.
483If  a  value  is  not provided or is 0, the current time is used.
484Call with each word as pathname; use as the new value.  If fails;
485use or current time.  If is set to then failure will cause an er-
486ror.  Attempts to convert the value to an absolute path using  If
487that fails, the value is unchanged.  Converts the value to lower-
488case  letters.   When  joining  the  words  after a modifier that
489treats the value as words, the words are normally separated by  a
490space.   This  modifier changes the separator to the character If
491is omitted, no separator is used.  The common escapes  (including
492octal numeric codes) work as expected.  Converts the value to up-
493per-case letters.  Causes subsequent modifiers to treat the value
494as  a single word (possibly containing embedded whitespace).  See
495also Causes the value to be treated as a list of words.  See also
496Modifies the first occurrence of in each word of the  value,  re-
497placing  it  with  If  a is appended to the last delimiter of the
498pattern, all occurrences in each word are replaced.  If a is  ap-
499pended  to  the last delimiter of the pattern, only the first oc-
500currence is affected.  If a is appended to the last delimiter  of
501the  pattern,  the  value is treated as a single word.  If begins
502with a caret is anchored at the beginning of each word.  If  ends
503with  a  dollar sign it is anchored at the end of each word.  In-
504side an ampersand is replaced by (without the  anchoring  or  Any
505character may be used as the delimiter for the parts of the modi-
506fier  string.   The anchoring, ampersand and delimiter characters
507can be escaped with a backslash Both and may contain  nested  ex-
508pressions.   To  prevent a dollar sign from starting a nested ex-
509pression, escape it with a backslash.  The  modifier  works  like
510the  modifier except that the old and new strings, instead of be-
511ing simple strings, are an extended regular expression  (see  and
512an  Normally, the first occurrence of the pattern in each word of
513the value is substituted with The modifier causes  the  substitu-
514tion  to  apply to at most one word; the modifier causes the sub-
515stitution to apply to as many instances of the search pattern  as
516occur  in  the  word or words it is found in; the modifier causes
517the value to be treated as a single word (possibly containing em-
518bedded whitespace).  As for the modifier, the and  are  subjected
519to variable expansion before being parsed as regular expressions.
520Replaces  each word with its last path component (basename).  Re-
521moves adjacent duplicate words (like If the  variable  name  (not
522its value), when parsed as a conditional expression, evaluates to
523true,  return  as  its  value  the otherwise return the Since the
524variable name is used as the expression, :?  must  be  the  first
525modifier  after  the variable name which, of course, usually con-
526tains variable expansions.  A common error is trying to  use  ex-
527pressions  like which actually tests defined(NUMBERS).  To deter-
528mine if any words match you need to use something like:  This  is
529the  style substitution.  It can only be the last modifier speci-
530fied, as a in either or is treated as a regular character, not as
531the end of the modifier.  If does not contain the pattern  match-
532ing character and the word ends with or equals it, that suffix is
533replaced  with  Otherwise,  the first in matches a possibly empty
534substring of arbitrary characters, and if the  whole  pattern  is
535found  in  the  word,  the matching part is replaced with and the
536first occurrence of in (if any) is replaced  with  the  substring
537matched  by the Both and may contain nested expressions.  To pre-
538vent a dollar sign from starting a nested expression,  escape  it
539with  a backslash.  This is the loop expansion mechanism from the
540OSF Development Environment (ODE) make.  Unlike loops,  expansion
541occurs at the time of reference.  For each word in the value, as-
542sign  the word to the variable named and evaluate The ODE conven-
543tion is that should start and end with  a  period,  for  example:
544However,  a  single-letter variable is often more readable: Saves
545the current variable value in or the named for  later  reference.
546Example  usage:  M_cmpv.units  =  1  1000  1000000  M_cmpv = S,.,
547,g:_:range:@i@+           $${_:[-$$i]}            \            \*
548$${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh
549
550
551Here  is  used  to save the result of the modifier which is later
552referenced using the index values from If the variable  is  unde-
553fined,  the  optional  (which may be empty) is the value.  If the
554variable is defined, the existing value is returned.  This is an-
555other ODE make feature.   It  is  handy  for  setting  per-target
556CFLAGS  for instance: If a value is only required if the variable
557is undefined, use: If the variable  is  defined,  (which  may  be
558empty) is the value.  The name of the variable is the value.  The
559path  of  the node which has the same name as the variable is the
560value.  If no such node exists or its path is null, the  name  of
561the  variable  is  used.  In order for this modifier to work, the
562name (node) must at least have appeared on the right-hand side of
563a dependency.  The output of running is the value.  The value  is
564run  as  a  command,  and  the output becomes the new value.  The
565variable is assigned the value after substitution.  This modifier
566and its variations are useful in obscure situations such as want-
567ing to set a variable at a point where a target's shell  commands
568are  being  parsed.   These assignment modifiers always expand to
569nothing.  The helps avoid false matches with the  style  modifier
570and  since substitution always occurs, the form is vaguely appro-
571priate.  As for but only if the variable does not already have  a
572value.   Append  to  the  variable.   Assign the output of to the
573variable.  Selects one or more words from the value, or  performs
574other  operations  related to the way in which the value is split
575into words.  An empty value, or a value that consists entirely of
576white-space, is treated as a single word.  For  the  purposes  of
577the  modifier, the words are indexed both forwards using positive
578integers (where index 1 represents the first word), and backwards
579using negative integers  (where  index  -1  represents  the  last
580word).   The is subjected to variable expansion, and the expanded
581result is then interpreted as follows: Selects a single word from
582the value.  Selects all words from to  inclusive.   For  example,
583selects  all  words from the second word to the last word.  If is
584greater than the words are output in reverse order.  For example,
585selects all the words from last to first.  If the list is already
586ordered, this effectively reverses the list, but it is more effi-
587cient to use instead of Causes subsequent modifiers to treat  the
588value as a single word (possibly containing embedded whitespace).
589Analogous  to  the  effect of in Bourne shell.  Means the same as
590Causes subsequent modifiers to treat the value as a  sequence  of
591words  delimited  by  whitespace.   Analogous to the effect of in
592Bourne shell.  Returns the number of words in the value.   offers
593directives  for  including makefiles, conditionals and for loops.
594All these directives are identified by a line  beginning  with  a
595single  dot  character, followed by the keyword of the directive,
596such as or Files are included with either  or  Variables  between
597the angle brackets or double quotes are expanded to form the file
598name.   If  angle brackets are used, the included makefile is ex-
599pected to be in the system makefile directory.  If double  quotes
600are  used, the including makefile's directory and any directories
601specified using the option are searched before the  system  make-
602file  directory.   For  compatibility  with  other make variants,
603(without leading dot) is also accepted.  If the include statement
604is written as or as errors locating and/or opening include  files
605are ignored.  If the include statement is written as not only are
606errors  locating  and/or opening include files ignored, but stale
607dependencies within the included file are ignored  just  like  in
608The  directives  for exporting and unexporting variables are: Ex-
609port the specified global variable.  If no variable list is  pro-
610vided,  all  globals  are  exported except for internal variables
611(those that start with This is  not  affected  by  the  flag,  so
612should  be  used with caution.  For compatibility with other make
613programs, (without leading dot) is also  accepted.   Appending  a
614variable name to is equivalent to exporting a variable.  The same
615as  except  that  the variable is not appended to This allows ex-
616porting a value to the environment which is different  from  that
617used  by  internally.   The  same as except that variables in the
618value are not expanded.  The opposite of The specified global  is
619removed from If no variable list is provided, all globals are un-
620exported,  and deleted.  Unexport all globals previously exported
621and clear the environment inherited from the parent.  This opera-
622tion causes a memory leak of the original environment, so  should
623be  used  sparingly.  Testing for being 0 would make sense.  Also
624note that any variables which originated in the  parent  environ-
625ment  should  be  explicitly  preserved if desired.  For example:
626PATH := ${PATH} Would result in an  environment  containing  only
627which is the minimal useful environment.  Actually is also pushed
628into  the  new environment.  The directives for printing messages
629to the output are: The message is printed along with the name  of
630the makefile and line number.  The message prefixed by is printed
631along with the name of the makefile and line number.  The message
632is  printed  along with the name of the makefile and line number,
633exits immediately.  The directives for conditionals are: Test the
634value of an expression.  Test  whether  a  variable  is  defined.
635Test  whether  a  variable is not defined.  Test the target being
636requested.  Test the target being requested.  Reverse  the  sense
637of the last conditional.  A combination of followed by A combina-
638tion of followed by A combination of followed by A combination of
639followed by A combination of followed by End the body of the con-
640ditional.  The may be any one of the following: Logical OR.  Log-
641ical  AND; of higher precedence than only evaluates a conditional
642as far as is necessary to determine its value.   Parentheses  can
643be  used to override the operator precedence.  The boolean opera-
644tor may be used to logically negate an  expression,  typically  a
645function  call.  It is of higher precedence than The value of may
646be any of the following function call expressions:  Evaluates  to
647true  if the variable has been defined.  Evaluates to true if the
648target was specified as part of command line or was declared  the
649default  target  (either implicitly or explicitly, see before the
650line containing the conditional.  Evaluates to true if the expan-
651sion of the variable, after applying the modifiers, results in an
652empty string.  Evaluates to true if the  given  pathname  exists.
653If  relative,  the  pathname is searched for on the system search
654path (see Evaluates to true  if  the  target  has  been  defined.
655Evaluates to true if the target has been defined and has commands
656associated with it.  may also be an arithmetic or string compari-
657son.   Variable  expansion is performed on both sides of the com-
658parison.  If both sides are numeric and neither  is  enclosed  in
659quotes,  the  comparison  is  done numerically, otherwise lexico-
660graphically.  A string is interpreted as a hexadecimal integer if
661it is preceded by otherwise it is interpreted as a decimal float-
662ing-point number; octal numbers are not supported.   All  compar-
663isons  may use the operators and Numeric comparisons may also use
664the operators and If the comparison has neither a comparison  op-
665erator  nor  a right side, the expression evaluates to true if it
666is nonempty and its numeric value (if any) is not zero.  When  is
667evaluating  one  of these conditional expressions, and it encoun-
668ters a (whitespace-separated) word it doesn't  recognize,  either
669the  or  function  is applied to it, depending on the form of the
670conditional.  If the form is or the function is  applied.   Simi-
671larly,  if the form is or the function is applied.  If the condi-
672tional evaluates to true, parsing of the  makefile  continues  as
673before.   If it evaluates to false, the following lines until the
674corresponding variant, or are skipped.  For loops  are  typically
675used to apply a set of rules to a list of files.  The syntax of a
676for  loop is: The is expanded and then split into words.  On each
677iteration of the loop, one word is taken and assigned to each  in
678order,  and these are substituted into the inside the body of the
679for loop.  The number of words must come out even;  that  is,  if
680there are three iteration variables, the number of words provided
681must be a multiple of three.  If is encountered within a loop, it
682causes  early  termination  of the loop, otherwise a parse error.
683Un-define the specified global variables.  Only global  variables
684can  be  un-defined.   Comments begin with a hash character, any-
685where but in a shell command line, and continue to the end of  an
686unescaped new line.  Target is never out of date, but always exe-
687cute  commands anyway.  Ignore any errors from the commands asso-
688ciated with this target, exactly as if they all were preceded  by
689a dash Mark all sources of this target as being up to date.  Exe-
690cute  the commands associated with this target even if the or op-
691tions were specified.  Normally used to mark recursive  Create  a
692meta  file  for  the target, even if it is flagged as or Usage in
693conjunction with is the most likely case.  In mode, the target is
694out-of-date if the meta file is missing.  Do not  create  a  meta
695file for the target.  Meta files are also not created for or tar-
696gets.   Ignore differences in commands when deciding if target is
697out of date.  This is useful if  the  command  contains  a  value
698which  always changes.  If the number of commands change, though,
699the target is still considered out of date.  The same effect  ap-
700plies  to  any  command  line that uses the variable which can be
701used for that purpose even when not otherwise needed or desired:
702
703skip-compare-for-some:            @echo    this    is    compared
704        @echo  this  is not ${.OODATE:M.NOMETA_CMP}         @echo
705this is also compared
706
707The pattern suppresses any expansion of  the  unwanted  variable.
708Do not search for the target in the directories specified by Nor-
709mally  selects the first target it encounters as the default tar-
710get to be built if no target was specified.  This source prevents
711this target from being selected.  If a target is marked with this
712attribute and can't figure out how to create it, it ignores  this
713fact  and  assumes  the file isn't needed or already exists.  The
714target does not correspond to an actual file; it is  always  con-
715sidered  to  be  out of date, and is not created with the option.
716Suffix-transformation rules are not applied to targets.  When  is
717interrupted,  it  normally  removes  any  partially made targets.
718This source prevents the target from being removed.  Synonym  for
719Do  not echo any of the commands associated with this target, ex-
720actly as if they all were preceded by an at sign Turn the  target
721into version of a macro.  When the target is used as a source for
722another  target, the other target acquires the commands, sources,
723and attributes (except for of the source.  If the target  already
724has  commands,  the target's commands are appended to them.  Like
725but instead of appending, prepend the target commands to the tar-
726get.  If appears in a dependency line, the sources  that  precede
727it  are  made  before  the  sources  that succeed it in the line.
728Since the dependents of files are not made until the file  itself
729could  be made, this also stops the dependents being built unless
730they are needed for another branch of the  dependency  tree.   So
731given:  x:  a  .WAIT  b          echo  x  a:         echo a b: b1
732        echo b b1:         echo b1
733
734the output is always The ordering imposed by is only relevant for
735parallel makes.  Special targets may not be included  with  other
736targets,  i.e.  they must be the only target specified.  Any com-
737mand lines attached to this target are executed  before  anything
738else  is  done.   This is sort of a rule for any target (that was
739used only as a source) that can't figure out  any  other  way  to
740create.  Only the shell script is used.  The variable of a target
741that  inherits commands is set to the target's own name.  If this
742target is present in the makefile, it  globally  causes  make  to
743delete  targets  whose  commands fail.  (By default, only targets
744whose commands are  interrupted  during  execution  are  deleted.
745This  is  the  historical behavior.)  This setting can be used to
746help prevent half-finished or malformed targets from  being  left
747around  and  corrupting  future  rebuilds.  Any command lines at-
748tached to this target are executed after everything else is  done
749successfully.  Any command lines attached to this target are exe-
750cuted when another target fails.  See for the variables that will
751be  set.   Mark  each  of  the sources with the attribute.  If no
752sources are specified, this is the equivalent of  specifying  the
753option.  If is interrupted, the commands for this target are exe-
754cuted.  If no target is specified when is invoked, this target is
755built.   This  target  provides a way to specify flags for at the
756time when the makefiles are read.  The flags are as if  typed  to
757the  shell, though the option has no effect.  Apply the attribute
758to any specified sources.  Disable parallel  mode.   Synonym  for
759for compatibility with other pmake variants.  clear the read-only
760attribute  from  the  global variables specified as sources.  The
761source is a new value for If it exists, changes the current work-
762ing directory to it and updates the value of  In  parallel  mode,
763the  named  targets are made in sequence.  This ordering does not
764add targets to the list of targets to be made.  Since the  depen-
765dents  of a target do not get built until the target itself could
766be built, unless is built  by  another  part  of  the  dependency
767graph,  the  following is a dependency loop: .ORDER: b a b: a The
768sources are directories which are to be searched  for  files  not
769found in the current directory.  If no sources are specified, any
770previously  specified  directories  are  removed  from the search
771path.  If the source is the special target, the  current  working
772directory  is searched last.  Like but applies only to files with
773a particular suffix.  The suffix must have  been  previously  de-
774clared  with  Apply  the  attribute to any specified sources.  If
775this is the first non-comment line  in  the  main  makefile,  the
776variable  is  set to the value and the makefile is included if it
777exists, to provide POSIX-compatible default  rules.   If  is  run
778with  the flag, only contributes to the default rules.  Apply the
779attribute to any specified sources.  If no sources are specified,
780the attribute is applied to every target in the  file.   set  the
781read-only attribute on the global variables specified as sources.
782Sets  the shell that uses to execute commands.  The sources are a
783set of pairs.  This is the minimal specification, used to  select
784one  of the built-in shell specs; and Specifies the absolute path
785to the shell.  Indicates whether the shell supports exit  on  er-
786ror.  The command to turn on error checking.  The command to dis-
787able  error checking.  The command to turn on echoing of commands
788executed.  The command to turn off echoing of commands  executed.
789The  output to filter after issuing the command.  It is typically
790identical to The flag to pass the shell to enable error checking.
791The flag to pass the shell to enable command echoing.  The string
792literal to pass the shell that results in a single newline  char-
793acter  when  used  outside  of  any quoting characters.  Example:
794.SHELL:     name=ksh     path=/bin/ksh      hasErrCtl=true      \
795        check="set  -e"  ignore="set  +e" \         echo="set -v"
796quiet="set +v" filter="set  +v"  \          echoFlag=v  errFlag=e
797newline="'\n'"  Apply the attribute to any specified sources.  If
798no sources are specified, the attribute is applied to every  com-
799mand  in  the  file.  This target gets run when a dependency file
800contains stale entries, having set to the name of that dependency
801file.  Each source specifies a suffix to If no sources are speci-
802fied, any previously specified suffixes are deleted.   It  allows
803the creation of suffix-transformation rules.  Example: .SUFFIXES:
804.c  .o  .c.o:          cc -o ${.TARGET} -c ${.IMPSRC} The sources
805are directories which are to be added to the system include  path
806which  searches  for makefiles.  If no sources are specified, any
807previously specified directories are removed from the system  in-
808clude  path.   uses  the following environment variables, if they
809exist: and and may only be set in the environment or on the  com-
810mand  line  to and not as makefile variables; see the description
811of for more details.  list of dependencies first default makefile
812if no makefile is specified on the command  line  second  default
813makefile  if  no makefile is specified on the command line system
814makefile system makefile directory The basic make syntax is  com-
815patible  between  different  make  variants;  however the special
816variables, variable modifiers and conditionals are not.   An  in-
817complete  list  of changes in older versions of The way that .for
818loop variables are substituted changed after NetBSD 5.0  so  that
819they  still appear to be variable expansions.  In particular this
820stops them being treated as  syntax,  and  removes  some  obscure
821problems  using  them  in  .if statements.  The way that parallel
822makes are scheduled changed in NetBSD  4.0  so  that  .ORDER  and
823.WAIT  apply  recursively to the dependent nodes.  The algorithms
824used may change again in the future.  Other  make  dialects  (GNU
825make,  SVR4  make,  POSIX  make, etc.) do not support most of the
826features of as described in this manual.  Most notably:  The  and
827declarations  and  most  functionality pertaining to paralleliza-
828tion.  (GNU make supports parallelization but lacks the  features
829needed  to  control  it  effectively.)  Directives, including for
830loops and conditionals and most of the forms  of  include  files.
831(GNU  make  has its own incompatible and less powerful syntax for
832conditionals.)  All built-in variables that  begin  with  a  dot.
833Most  of  the  special sources and targets that begin with a dot,
834with the notable exception of and Variable modifiers, except  for
835the string substitution, which does not portably support globbing
836with and historically only works on declared suffixes.  The vari-
837able  even in its short form; most makes support this functional-
838ity but  its  name  varies.   Some  features  are  somewhat  more
839portable,  such as assignment with and The functionality is based
840on an older feature found in GNU make and many versions  of  SVR4
841make;  however, historically its behavior is too ill-defined (and
842too buggy) to rely upon.  The and variables are more or less uni-
843versally portable, as is the variable.  Basic use of suffix rules
844(for files only in the current directory,  not  trying  to  chain
845transformations  together, etc.) is also reasonably portable.  is
846derived from NetBSD It uses autoconf to facilitate portability to
847other platforms.  A make command appeared in This make  implemen-
848tation  is based on Adam de Boor's pmake program, which was writ-
849ten for Sprite at Berkeley.  It was designed  to  be  a  parallel
850distributed  make running jobs on different machines using a dae-
851mon called Historically the target/dependency has  been  used  to
852FoRCe  rebuilding (since the target/dependency does not exist ...
853unless someone creates an file).  The make syntax is difficult to
854parse.  For instance, finding the end of a variable's use  should
855involve  scanning each of the modifiers, using the correct termi-
856nator for each field.  In many places make just counts {} and  ()
857in  order  to  find the end of a variable expansion.  There is no
858way of escaping a space character in a filename.  In  jobs  mode,
859when  a  target  fails; make will put an error token into the job
860token pool.  This will cause all other instances  of  make  using
861that  token  pool  to abort the build and exit with error code 6.
862Sometimes the attempt to suppress a cascade  of  unnecessary  er-
863rors, can result in a seemingly unexplained
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925