Annotation of src/usr.bin/make/make.1, Revision 1.85
1.85 ! sjg 1: .\" $NetBSD: make.1,v 1.84 2003/08/07 11:14:54 agc Exp $
1.15 thorpej 2: .\"
1.16 christos 3: .\" Copyright (c) 1990, 1993
4: .\" The Regents of the University of California. All rights reserved.
1.1 cgd 5: .\"
6: .\" Redistribution and use in source and binary forms, with or without
7: .\" modification, are permitted provided that the following conditions
8: .\" are met:
9: .\" 1. Redistributions of source code must retain the above copyright
10: .\" notice, this list of conditions and the following disclaimer.
11: .\" 2. Redistributions in binary form must reproduce the above copyright
12: .\" notice, this list of conditions and the following disclaimer in the
13: .\" documentation and/or other materials provided with the distribution.
1.84 agc 14: .\" 3. Neither the name of the University nor the names of its contributors
1.1 cgd 15: .\" may be used to endorse or promote products derived from this software
16: .\" without specific prior written permission.
17: .\"
18: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28: .\" SUCH DAMAGE.
29: .\"
1.16 christos 30: .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
1.1 cgd 31: .\"
1.85 ! sjg 32: .Dd September 4, 2003
1.1 cgd 33: .Dt MAKE 1
34: .Os
35: .Sh NAME
36: .Nm make
37: .Nd maintain program dependencies
38: .Sh SYNOPSIS
1.74 wiz 39: .Nm
1.75 thorpej 40: .Op Fl BeikNnqrstWX
1.30 mycroft 41: .Bk -words
1.1 cgd 42: .Op Fl D Ar variable
1.30 mycroft 43: .Ek
44: .Bk -words
1.1 cgd 45: .Op Fl d Ar flags
1.30 mycroft 46: .Ek
47: .Bk -words
1.1 cgd 48: .Op Fl f Ar makefile
1.30 mycroft 49: .Ek
50: .Bk -words
1.1 cgd 51: .Op Fl I Ar directory
1.30 mycroft 52: .Ek
1.1 cgd 53: .Bk -words
54: .Op Fl j Ar max_jobs
1.30 mycroft 55: .Ek
56: .Bk -words
1.44 sommerfe 57: .Op Fl J Ar private
58: .Ek
59: .Bk -words
1.13 christos 60: .Op Fl m Ar directory
1.1 cgd 61: .Ek
1.30 mycroft 62: .Bk -words
1.44 sommerfe 63: .Op Fl T Ar file
64: .Ek
65: .Bk -words
1.16 christos 66: .Op Fl V Ar variable
1.30 mycroft 67: .Ek
1.1 cgd 68: .Op Ar variable=value
1.30 mycroft 69: .Bk -words
1.1 cgd 70: .Op Ar target ...
1.30 mycroft 71: .Ek
1.1 cgd 72: .Sh DESCRIPTION
1.25 lukem 73: .Nm
1.1 cgd 74: is a program designed to simplify the maintenance of other programs.
75: Its input is a list of specifications as to the files upon which programs
76: and other files depend.
77: If the file
78: .Ql Pa makefile
79: exists, it is read for this list of specifications.
80: If it does not exist, the file
81: .Ql Pa Makefile
82: is read.
83: If the file
84: .Ql Pa .depend
85: exists, it is read (see
1.66 wiz 86: .Xr mkdep 1 ) .
1.1 cgd 87: .Pp
88: This manual page is intended as a reference document only.
89: For a more thorough description of
1.25 lukem 90: .Nm
1.1 cgd 91: and makefiles, please refer to
92: .%T "Make \- A Tutorial" .
93: .Pp
94: The options are as follows:
95: .Bl -tag -width Ds
1.16 christos 96: .It Fl B
1.10 christos 97: Try to be backwards compatible by executing a single shell per command and
98: by executing the commands to make the sources of a dependency line in sequence.
1.1 cgd 99: .It Fl D Ar variable
1.8 christos 100: Define
101: .Ar variable
1.1 cgd 102: to be 1, in the global context.
103: .It Fl d Ar flags
104: Turn on debugging, and specify which portions of
1.25 lukem 105: .Nm
1.1 cgd 106: are to print debugging information.
107: .Ar Flags
108: is one or more of the following:
109: .Bl -tag -width Ds
110: .It Ar A
111: Print all possible debugging information;
112: equivalent to specifying all of the debugging flags.
113: .It Ar a
114: Print debugging information about archive searching and caching.
115: .It Ar c
116: Print debugging information about conditional evaluation.
117: .It Ar d
118: Print debugging information about directory searching and caching.
119: .It Ar "g1"
120: Print the input graph before making anything.
121: .It Ar "g2"
122: Print the input graph after making everything, or before exiting
123: on error.
124: .It Ar j
125: Print debugging information about running multiple shells.
126: .It Ar m
127: Print debugging information about making targets, including modification
128: dates.
129: .It Ar s
130: Print debugging information about suffix-transformation rules.
131: .It Ar t
132: Print debugging information about target list maintenance.
133: .It Ar v
134: Print debugging information about variable assignment.
1.49 sjg 135: .It Ar x
1.57 wiz 136: Run shell commands with
137: .Fl x
138: so the actual commands are printed as they are executed.
1.1 cgd 139: .El
140: .It Fl e
1.68 perry 141: Specify that environment variables override macro assignments within
1.1 cgd 142: makefiles.
143: .It Fl f Ar makefile
144: Specify a makefile to read instead of the default
145: .Ql Pa makefile
146: and
147: If
148: .Ar makefile
149: is
150: .Ql Fl ,
151: standard input is read.
152: Multiple makefile's may be specified, and are read in the order specified.
153: .It Fl I Ar directory
154: Specify a directory in which to search for makefiles and included makefiles.
1.13 christos 155: The system makefile directory (or directories, see the
156: .Fl m
157: option) is automatically included as part of this list.
1.1 cgd 158: .It Fl i
159: Ignore non-zero exit of shell commands in the makefile.
160: Equivalent to specifying
161: .Ql Fl
162: before each command line in the makefile.
1.44 sommerfe 163: .It Fl J Ar private
164: This option should
165: .Em not
166: be specified by the user.
167: .Pp
168: When the
169: .Ar j
170: option is in use in a recursive build, this option is passed by a make
171: to child makes to allow all the make processes in the build to
172: cooperate to avoid overloading the system.
1.1 cgd 173: .It Fl j Ar max_jobs
174: Specify the maximum number of jobs that
1.25 lukem 175: .Nm
1.67 grant 176: may have running at any one time.
177: Turns compatibility mode off, unless the
1.11 christos 178: .Ar B
179: flag is also specified.
1.1 cgd 180: .It Fl k
181: Continue processing after errors are encountered, but only on those targets
182: that do not depend on the target whose creation caused the error.
1.13 christos 183: .It Fl m Ar directory
184: Specify a directory in which to search for sys.mk and makefiles included
1.67 grant 185: via the \*[Lt]...\*[Gt] style.
186: Multiple directories can be added to form a search path.
1.13 christos 187: This path will override the default system include path: /usr/share/mk.
188: Furthermore the system include path will be appended to the search path used
189: for "..."-style inclusions (see the
190: .Fl I
191: option).
1.1 cgd 192: .It Fl n
1.45 sommerfe 193: Display the commands that would have been executed, but do not
194: actually execute them unless the target depends on the .MAKE special
1.64 wiz 195: source (see below).
1.45 sommerfe 196: .It Fl N
197: Display the commands which would have been executed, but do not
198: actually execute any of them; useful for debugging top-level makefiles
199: without descending into subdirectories.
1.1 cgd 200: .It Fl q
201: Do not execute any commands, but exit 0 if the specified targets are
202: up-to-date and 1, otherwise.
203: .It Fl r
204: Do not use the built-in rules specified in the system makefile.
205: .It Fl s
206: Do not echo any commands as they are executed.
207: Equivalent to specifying
208: .Ql Ic @
209: before each command line in the makefile.
1.44 sommerfe 210: .It Fl T Ar tracefile
211: When used with the
1.48 wiz 212: .Fl j
1.44 sommerfe 213: flag,
214: append a trace record to
215: .Ar tracefile
216: for each job started and completed.
1.1 cgd 217: .It Fl t
218: Rather than re-building a target as specified in the makefile, create it
219: or update its modification time to make it appear up-to-date.
1.16 christos 220: .It Fl V Ar variable
221: Print
1.74 wiz 222: .Nm Ns 's
1.16 christos 223: idea of the value of
224: .Ar variable ,
225: in the global context.
226: Do not build any targets.
227: Multiple instances of this option may be specified;
228: the variables will be printed one per line,
229: with a blank line for each null or undefined variable.
1.85 ! sjg 230: If
! 231: .Ar variable
! 232: contains a
! 233: .Ql \&$
! 234: then the value will be expanded before printing.
1.46 christos 235: .It Fl W
236: Treat any warnings during makefile parsing as errors.
1.75 thorpej 237: .It Fl X
238: Don't export variables passed on the command line to the environment
239: individually.
240: Variables passed on the command line are still exported
241: via the
242: .Va MAKEFLAGS
243: environment variable.
244: This option may be useful on systems which have a small limit on the
245: size of command arguments.
1.1 cgd 246: .It Ar variable=value
247: Set the value of the variable
248: .Ar variable
249: to
250: .Ar value .
1.75 thorpej 251: Normally, all values passed on the command line are also exported to
252: sub-makes in the environment.
253: The
254: .Fl X
255: flag disables this behavior.
1.1 cgd 256: .El
257: .Pp
1.6 cgd 258: There are seven different types of lines in a makefile: file dependency
1.1 cgd 259: specifications, shell commands, variable assignments, include statements,
1.6 cgd 260: conditional directives, for loops, and comments.
1.1 cgd 261: .Pp
262: In general, lines may be continued from one line to the next by ending
263: them with a backslash
264: .Pq Ql \e .
265: The trailing newline character and initial whitespace on the following
266: line are compressed into a single space.
267: .Sh FILE DEPENDENCY SPECIFICATIONS
268: Dependency lines consist of one or more targets, an operator, and zero
269: or more sources.
270: This creates a relationship where the targets ``depend'' on the sources
271: and are usually created from them.
272: The exact relationship between the target and the source is determined
273: by the operator that separates them.
274: The three operators are as follows:
275: .Bl -tag -width flag
276: .It Ic \&:
277: A target is considered out-of-date if its modification time is less than
278: those of any of its sources.
279: Sources for a target accumulate over dependency lines when this operator
280: is used.
281: The target is removed if
1.25 lukem 282: .Nm
1.1 cgd 283: is interrupted.
284: .It Ic \&!
285: Targets are always re-created, but not until all sources have been
286: examined and re-created as necessary.
287: Sources for a target accumulate over dependency lines when this operator
288: is used.
289: The target is removed if
1.25 lukem 290: .Nm
1.1 cgd 291: is interrupted.
292: .It Ic \&::
293: If no sources are specified, the target is always re-created.
294: Otherwise, a target is considered out-of-date if any of its sources has
295: been modified more recently than the target.
296: Sources for a target do not accumulate over dependency lines when this
297: operator is used.
298: The target will not be removed if
1.25 lukem 299: .Nm
1.1 cgd 300: is interrupted.
301: .El
302: .Pp
303: Targets and sources may contain the shell wildcard values
1.80 wiz 304: .Ql \&? ,
1.1 cgd 305: .Ql * ,
306: .Ql []
307: and
308: .Ql {} .
309: The values
1.80 wiz 310: .Ql \&? ,
1.1 cgd 311: .Ql *
312: and
313: .Ql []
314: may only be used as part of the final
315: component of the target or source, and must be used to describe existing
316: files.
317: The value
318: .Ql {}
319: need not necessarily be used to describe existing files.
320: Expansion is in directory order, not alphabetically as done in the shell.
321: .Sh SHELL COMMANDS
322: Each target may have associated with it a series of shell commands, normally
323: used to create the target.
324: Each of the commands in this script
325: .Em must
326: be preceded by a tab.
327: While any target may appear on a dependency line, only one of these
328: dependencies may be followed by a creation script, unless the
329: .Ql Ic ::
330: operator is used.
331: .Pp
332: If the first or first two characters of the command line are
333: .Ql Ic @
334: and/or
335: .Ql Ic \- ,
336: the command is treated specially.
337: A
338: .Ql Ic @
339: causes the command not to be echoed before it is executed.
340: A
341: .Ql Ic \-
342: causes any non-zero exit status of the command line to be ignored.
343: .Sh VARIABLE ASSIGNMENTS
344: Variables in make are much like variables in the shell, and, by tradition,
345: consist of all upper-case letters.
346: The five operators that can be used to assign values to variables are as
347: follows:
348: .Bl -tag -width Ds
349: .It Ic \&=
350: Assign the value to the variable.
351: Any previous value is overridden.
352: .It Ic \&+=
353: Append the value to the current value of the variable.
354: .It Ic \&?=
355: Assign the value to the variable if it is not already defined.
356: .It Ic \&:=
357: Assign with expansion, i.e. expand the value before assigning it
358: to the variable.
359: Normally, expansion is not done until the variable is referenced.
360: .It Ic \&!=
361: Expand the value and pass it to the shell for execution and assign
362: the result to the variable.
363: Any newlines in the result are replaced with spaces.
364: .El
365: .Pp
366: Any white-space before the assigned
367: .Ar value
368: is removed; if the value is being appended, a single space is inserted
369: between the previous contents of the variable and the appended value.
370: .Pp
371: Variables are expanded by surrounding the variable name with either
372: curly braces
373: .Pq Ql {}
1.7 mycroft 374: or parentheses
1.1 cgd 375: .Pq Ql ()
376: and preceding it with
377: a dollar sign
378: .Pq Ql \&$ .
379: If the variable name contains only a single letter, the surrounding
1.7 mycroft 380: braces or parentheses are not required.
1.1 cgd 381: This shorter form is not recommended.
382: .Pp
383: Variable substitution occurs at two distinct times, depending on where
384: the variable is being used.
385: Variables in dependency lines are expanded as the line is read.
386: Variables in shell commands are expanded when the shell command is
387: executed.
388: .Pp
389: The four different classes of variables (in order of increasing precedence)
390: are:
391: .Bl -tag -width Ds
392: .It Environment variables
393: Variables defined as part of
1.74 wiz 394: .Nm Ns 's
1.1 cgd 395: environment.
396: .It Global variables
397: Variables defined in the makefile or in included makefiles.
398: .It Command line variables
399: Variables defined as part of the command line.
400: .It Local variables
401: Variables that are defined specific to a certain target.
402: The seven local variables are as follows:
403: .Bl -tag -width ".ARCHIVE"
404: .It Va .ALLSRC
405: The list of all sources for this target; also known as
1.62 ross 406: .Ql Va \&\*[Gt] .
1.1 cgd 407: .It Va .ARCHIVE
408: The name of the archive file.
409: .It Va .IMPSRC
410: The name/path of the source from which the target is to be transformed
411: (the ``implied'' source); also known as
1.62 ross 412: .Ql Va \&\*[Lt] .
1.1 cgd 413: .It Va .MEMBER
414: The name of the archive member.
415: .It Va .OODATE
416: The list of sources for this target that were deemed out-of-date; also
417: known as
418: .Ql Va \&? .
419: .It Va .PREFIX
420: The file prefix of the file, containing only the file portion, no suffix
421: or preceding directory components; also known as
422: .Ql Va * .
423: .It Va .TARGET
424: The name of the target; also known as
425: .Ql Va @ .
426: .El
427: .Pp
428: The shorter forms
429: .Ql Va @ ,
1.80 wiz 430: .Ql Va \&? ,
1.65 christos 431: .Ql Va \&\*[Lt] ,
432: .Ql Va \&\*[Gt] ,
1.1 cgd 433: and
434: .Ql Va *
435: are permitted for backward
436: compatibility with historical makefiles and are not recommended.
437: The six variables
438: .Ql Va "@F" ,
439: .Ql Va "@D" ,
1.62 ross 440: .Ql Va "\*[Lt]F" ,
441: .Ql Va "\*[Lt]D" ,
1.66 wiz 442: .Ql Va "*F" ,
1.1 cgd 443: and
444: .Ql Va "*D"
1.66 wiz 445: are permitted for compatibility with
1.1 cgd 446: .At V
447: makefiles and are not recommended.
448: .Pp
449: Four of the local variables may be used in sources on dependency lines
450: because they expand to the proper value for each target on the line.
451: These variables are
452: .Ql Va .TARGET ,
453: .Ql Va .PREFIX ,
454: .Ql Va .ARCHIVE ,
455: and
456: .Ql Va .MEMBER .
1.59 bgrayson 457: .El
1.1 cgd 458: .Pp
459: In addition,
1.25 lukem 460: .Nm
1.1 cgd 461: sets or knows about the following variables:
1.50 sjg 462: .Bl -tag -width .MAKEOVERRIDES
1.1 cgd 463: .It Va \&$
464: A single dollar sign
465: .Ql \&$ ,
466: i.e.
467: .Ql \&$$
468: expands to a single dollar
469: sign.
1.22 pk 470: .Pq Va argv[0]
1.56 tv 471: .It Va .ALLTARGETS
1.67 grant 472: The list of all targets encountered in the Makefile.
473: If evaluated during
1.56 tv 474: Makefile parsing, lists only those targets encountered thus far.
1.1 cgd 475: .It Va .CURDIR
476: A path to the directory where
1.25 lukem 477: .Nm
1.1 cgd 478: was executed.
1.78 christos 479: .It Ev MAKE
1.55 tv 480: The name that
481: .Nm
1.79 wiz 482: was executed with.
483: For compatibily
1.78 christos 484: .Nm
485: also sets
486: .Va .MAKE
487: with the same value.
488: The preferred variable to use is
489: .Ev MAKE
490: because it is more compatible with other versions of
491: .Nm
492: and cannot be confused with the special target with the same name.
1.1 cgd 493: .It Ev MAKEFLAGS
494: The environment variable
495: .Ql Ev MAKEFLAGS
496: may contain anything that
497: may be specified on
1.74 wiz 498: .Nm Ns 's
1.1 cgd 499: command line.
500: Anything specified on
1.74 wiz 501: .Nm Ns 's
1.1 cgd 502: command line is appended to the
503: .Ql Ev MAKEFLAGS
504: variable which is then
505: entered into the environment for all programs which
1.25 lukem 506: .Nm
1.1 cgd 507: executes.
1.50 sjg 508: .It Va .MAKEOVERRIDES
1.57 wiz 509: This variable is used to record the names of variables assigned to
510: on the command line, so that they may be exported as part of
1.50 sjg 511: .Ql Ev MAKEFLAGS .
1.57 wiz 512: This behaviour can be disabled by assigning an empty value to
1.50 sjg 513: .Ql Va .MAKEOVERRIDES
1.67 grant 514: within a makefile.
515: Extra variables can be exported from a makefile
1.57 wiz 516: by appending their names to
1.51 sjg 517: .Ql Va .MAKEOVERRIDES .
518: .Ql Ev MAKEFLAGS
1.57 wiz 519: is re-exported whenever
1.51 sjg 520: .Ql Va .MAKEOVERRIDES
521: is modified.
1.55 tv 522: .It Va MAKE_PRINT_VAR_ON_ERROR
1.57 wiz 523: When
1.55 tv 524: .Nm
525: stops due to an error, it prints its name and the value of
526: .Ql Va .CURDIR
1.57 wiz 527: as well as the value of any variables named in
1.55 tv 528: .Ql Va MAKE_PRINT_VAR_ON_ERROR .
529: .It Va .newline
530: This variable is simply assigned a newline character as its value.
531: This allows expansions using the :@ modifier to put a newline between
1.67 grant 532: iterations of the loop rather than a space.
533: For example, the printing of
1.55 tv 534: .Ql Va MAKE_PRINT_VAR_ON_ERROR
535: could be done as ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}.
536: .It Va .OBJDIR
537: A path to the directory where the targets are built.
538: .It Va .PARSEDIR
539: A path to the directory of the current
540: .Ql Pa Makefile
541: being parsed.
542: .It Va .PARSEFILE
543: The basename of the current
544: .Ql Pa Makefile
545: being parsed.
546: This variable and
547: .Ql Va .PARSEDIR
548: are both set only while the
549: .Ql Pa Makefiles
550: are being parsed.
1.69 sjg 551: .It Va .PATH
1.82 wiz 552: A variable that represents the list of directories that
1.69 sjg 553: .Nm
1.70 wiz 554: will search for files.
555: The search list should be updated using the target
1.69 sjg 556: .Ql Va .PATH
557: rather than the variable.
1.16 christos 558: .It Ev PWD
559: Alternate path to the current directory.
1.25 lukem 560: .Nm
1.16 christos 561: normally sets
562: .Ql Va .CURDIR
563: to the canonical path given by
1.48 wiz 564: .Xr getcwd 3 .
1.16 christos 565: However, if the environment variable
566: .Ql Ev PWD
567: is set and gives a path to the current directory, then
1.25 lukem 568: .Nm
1.16 christos 569: sets
570: .Ql Va .CURDIR
571: to the value of
572: .Ql Ev PWD
1.67 grant 573: instead.
574: This behaviour is disabled if
1.40 sjg 575: .Ql Ev MAKEOBJDIRPREFIX
576: is set.
1.16 christos 577: .Ql Ev PWD
578: is set to the value of
579: .Ql Va .OBJDIR
580: for all programs which
1.25 lukem 581: .Nm
1.16 christos 582: executes.
1.1 cgd 583: .El
584: .Pp
585: Variable expansion may be modified to select or modify each word of the
586: variable (where a ``word'' is white-space delimited sequence of characters).
587: The general format of a variable expansion is as follows:
588: .Pp
589: .Dl {variable[:modifier[:...]]}
590: .Pp
591: Each modifier begins with a colon and one of the following
592: special characters.
593: The colon may be escaped with a backslash
594: .Pq Ql \e .
1.61 ross 595: .Bl -tag -width EEE
1.1 cgd 596: .It Cm E
597: Replaces each word in the variable with its suffix.
598: .It Cm H
599: Replaces each word in the variable with everything but the last component.
600: .It Cm M Ns Ar pattern
1.72 uebayasi 601: Select only those words that match
602: .Ar pattern .
1.1 cgd 603: The standard shell wildcard characters
604: .Pf ( Ql * ,
1.80 wiz 605: .Ql \&? ,
1.1 cgd 606: and
607: .Ql Op )
608: may
609: be used.
610: The wildcard characters may be escaped with a backslash
611: .Pq Ql \e .
612: .It Cm N Ns Ar pattern
613: This is identical to
614: .Ql Cm M ,
615: but selects all words which do not match
1.72 uebayasi 616: .Ar pattern .
1.36 christos 617: .It Cm O
618: Order every word in variable alphabetically.
1.17 christos 619: .It Cm Q
620: Quotes every shell meta-character in the variable, so that it can be passed
621: safely through recursive invocations of
1.74 wiz 622: .Nm .
1.1 cgd 623: .It Cm R
624: Replaces each word in the variable with everything but its suffix.
1.60 pk 625: .It Cm tl
626: Converts variable to lower-case letters.
1.81 sjg 627: .It Cm ts Ar c
628: Words in the variable are normally separated by a space on expansion.
629: This modifier sets the separator to the character
630: .Ar c .
631: If
632: .Ar c
633: is omitted, then no separator is used.
1.82 wiz 634: .It Cm tu
635: Converts variable to upper-case letters.
1.1 cgd 636: .Sm off
1.17 christos 637: .It Cm S No \&/ Ar old_string Xo
638: .No \&/ Ar new_string
639: .No \&/ Op Cm 1g
1.1 cgd 640: .Xc
641: .Sm on
642: Modify the first occurrence of
1.17 christos 643: .Ar old_string
644: in the variable's value, replacing it with
645: .Ar new_string .
1.1 cgd 646: If a
647: .Ql g
648: is appended to the last slash of the pattern, all occurrences
649: in each word are replaced.
1.17 christos 650: If a
651: .Ql 1
652: is appended to the last slash of the pattern, only the first word
653: is affected.
1.1 cgd 654: If
1.17 christos 655: .Ar old_string
656: begins with a caret
1.1 cgd 657: .Pq Ql ^ ,
1.17 christos 658: .Ar old_string
1.1 cgd 659: is anchored at the beginning of each word.
660: If
1.17 christos 661: .Ar old_string
1.1 cgd 662: ends with a dollar sign
663: .Pq Ql \&$ ,
664: it is anchored at the end of each word.
665: Inside
666: .Ar new_string ,
667: an ampersand
1.62 ross 668: .Pq Ql \*[Am]
1.1 cgd 669: is replaced by
1.17 christos 670: .Ar old_string
671: (without any
672: .Ql ^
673: or
674: .Ql \&$ ) .
1.1 cgd 675: Any character may be used as a delimiter for the parts of the modifier
676: string.
677: The anchoring, ampersand and delimiter characters may be escaped with a
678: backslash
679: .Pq Ql \e .
680: .Pp
681: Variable expansion occurs in the normal fashion inside both
682: .Ar old_string
683: and
684: .Ar new_string
685: with the single exception that a backslash is used to prevent the expansion
686: of a dollar sign
1.17 christos 687: .Pq Ql \&$ ,
1.1 cgd 688: not a preceding dollar sign as is usual.
1.17 christos 689: .Sm off
690: .It Cm C No \&/ Ar pattern Xo
691: .No \&/ Ar replacement
692: .No \&/ Op Cm 1g
693: .Xc
694: .Sm on
695: The
696: .Cm C
697: modifier is just like the
698: .Cm S
1.37 msaitoh 699: modifier except that the old and new strings, instead of being
1.17 christos 700: simple strings, are a regular expression (see
701: .Xr regex 3 )
1.72 uebayasi 702: string
703: .Ar pattern
1.17 christos 704: and an
705: .Xr ed 1 Ns \-style
1.72 uebayasi 706: string
707: .Ar replacement .
708: Normally, the first occurrence of the pattern
709: .Ar pattern
710: in each word of the value is substituted with
711: .Ar replacement .
1.67 grant 712: The
1.17 christos 713: .Ql 1
714: modifier causes the substitution to apply to at most one word; the
715: .Ql g
716: modifier causes the substitution to apply to as many instances of the
1.72 uebayasi 717: search pattern
718: .Ar pattern
719: as occur in the word or words it is found in.
1.67 grant 720: Note that
1.17 christos 721: .Ql 1
722: and
723: .Ql g
724: are orthogonal; the former specifies whether multiple words are
725: potentially affected, the latter whether multiple substitutions can
726: potentially occur within each affected word.
1.1 cgd 727: .It Cm T
728: Replaces each word in the variable with its last component.
1.43 christos 729: .It Cm u
730: Remove adjacent duplicate words (like
1.57 wiz 731: .Xr uniq 1 ) .
1.80 wiz 732: .It Cm \&? Ar true_string Cm : Ar false_string
1.27 christos 733: If the variable evaluates to true, return as its value the
1.57 wiz 734: .Ar true_string ,
1.27 christos 735: otherwise return the
1.57 wiz 736: .Ar false_string .
1.1 cgd 737: .It Ar old_string=new_string
738: This is the
739: .At V
740: style variable substitution.
741: It must be the last modifier specified.
1.16 christos 742: If
1.6 cgd 743: .Ar old_string
744: or
745: .Ar new_string
746: do not contain the pattern matching character
747: .Ar %
1.16 christos 748: then it is assumed that they are
1.6 cgd 749: anchored at the end of each word, so only suffixes or entire
1.67 grant 750: words may be replaced.
751: Otherwise
1.6 cgd 752: .Ar %
1.16 christos 753: is the substring of
754: .Ar old_string
1.6 cgd 755: to be replaced in
1.64 wiz 756: .Ar new_string .
1.40 sjg 757: .It Cm @ Ar temp Cm @ Xo
1.80 wiz 758: .Ar string Cm @
1.40 sjg 759: .Xc
760: This is the loop expansion mechanism from the OSF Development
1.67 grant 761: Environment (ODE) make.
762: Unlike
1.48 wiz 763: .Cm \&.for
1.40 sjg 764: loops expansion occurs at the time of
1.67 grant 765: reference.
766: Assign
1.40 sjg 767: .Ar temp
768: to each word in the variable and evaluate
769: .Ar string .
1.48 wiz 770: The ODE convention is that
1.40 sjg 771: .Ar temp
1.67 grant 772: should start and end with a period.
773: For example.
1.40 sjg 774: .Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@}
775: .It Cm U Ar newval
776: If the variable is undefined
777: .Ar newval
1.63 lukem 778: is the value.
779: If the variable is defined, the existing value is returned.
1.67 grant 780: This is another ODE make feature.
781: It is handy for setting per-target CFLAGS for instance:
1.40 sjg 782: .Dl ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}}
1.63 lukem 783: If a value is only required if the variable is undefined, use:
784: .Dl ${VAR:D:Unewval}
1.40 sjg 785: .It Cm D Ar newval
786: If the variable is defined
787: .Ar newval
788: is the value.
789: .It Cm L
790: The name of the variable is the value.
791: .It Cm P
792: The path of the node which has the same name as the variable
1.67 grant 793: is the value.
794: If no such node exists or its path is null, then the
1.40 sjg 795: name of the variable is used.
1.80 wiz 796: .It Cm \&! Ar cmd Cm \&!
1.40 sjg 797: The output of running
798: .Ar cmd
799: is the value.
800: .It Cm sh
801: If the variable is non-empty it is run as a command and the output
802: becomes the new value.
1.42 sjg 803: .It Cm \&:= Ar str
1.48 wiz 804: The variable is assigned the value
1.41 sjg 805: .Ar str
1.67 grant 806: after substitution.
807: This modifier and its variations are useful in
1.48 wiz 808: obscure situations such as wanting to apply modifiers to
1.41 sjg 809: .Cm \&.for
1.48 wiz 810: loop iteration variables which won't work due to the way
1.41 sjg 811: .Cm \&.for
1.67 grant 812: loops are implemented.
813: These assignment modifiers always expand to
1.41 sjg 814: nothing, so if appearing in a rule line by themselves should be
1.48 wiz 815: preceded with something to keep
1.41 sjg 816: .Nm
1.67 grant 817: happy.
818: As in:
1.41 sjg 819: .Bd -literal
820: use_foo: \&.USE
821: \&.for i in ${\&.TARGET} ${\&.TARGET:R}\&.gz
1.42 sjg 822: @: ${t::=$i}
1.41 sjg 823: @echo t:R:T=${t:R:T}
824: \&.endfor
825:
826: .Ed
1.42 sjg 827: The double
828: .Cm \&:
829: helps avoid false matches with the
830: .At V
1.48 wiz 831: style
1.42 sjg 832: .Cm \&=
1.48 wiz 833: modifier and since substitution always occurs the
1.42 sjg 834: .Cm \&:=
835: form is vaguely appropriate.
836: .It Cm \&:?= Ar str
1.41 sjg 837: As for
1.42 sjg 838: .Cm \&:=
1.41 sjg 839: but only if the variable does not already have a value.
1.42 sjg 840: .It Cm \&:+= Ar str
1.48 wiz 841: Append
1.41 sjg 842: .Ar str
843: to the variable.
1.42 sjg 844: .It Cm \&:!= Ar cmd
1.48 wiz 845: Assign the output of
1.41 sjg 846: .Ar cmd
847: to the variable.
1.6 cgd 848: .El
849: .Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS
1.16 christos 850: Makefile inclusion, conditional structures and for loops reminiscent
1.6 cgd 851: of the C programming language are provided in
1.74 wiz 852: .Nm .
1.1 cgd 853: All such structures are identified by a line beginning with a single
854: dot
855: .Pq Ql \&.
856: character.
857: Files are included with either
1.29 ross 858: .Cm \&.include Aq Ar file
1.1 cgd 859: or
1.29 ross 860: .Cm \&.include Pf \*q Ar file Ns \*q .
1.1 cgd 861: Variables between the angle brackets or double quotes are expanded
862: to form the file name.
863: If angle brackets are used, the included makefile is expected to be in
864: the system makefile directory.
865: If double quotes are used, the including makefile's directory and any
866: directories specified using the
867: .Fl I
868: option are searched before the system
869: makefile directory.
1.28 christos 870: For compatibility with other versions of
871: .Nm
872: .Ql include file ...
1.67 grant 873: is also accepted.
874: If the include statement is written as
1.29 ross 875: .Cm .-include
876: or as
877: .Cm .sinclude
1.28 christos 878: then errors locating and/or opening include files are ignored.
1.1 cgd 879: .Pp
880: Conditional expressions are also preceded by a single dot as the first
1.5 jtc 881: character of a line.
1.1 cgd 882: The possible conditionals are as follows:
883: .Bl -tag -width Ds
884: .It Ic .undef Ar variable
885: Un-define the specified global variable.
886: Only global variables may be un-defined.
887: .It Xo
888: .Ic \&.if
889: .Oo \&! Oc Ns Ar expression
890: .Op Ar operator expression ...
891: .Xc
892: Test the value of an expression.
893: .It Xo
894: .Ic .ifdef
895: .Oo \&! Oc Ns Ar variable
896: .Op Ar operator variable ...
897: .Xc
1.7 mycroft 898: Test the value of a variable.
1.1 cgd 899: .It Xo
900: .Ic .ifndef
901: .Oo \&! Oc Ns Ar variable
902: .Op Ar operator variable ...
903: .Xc
1.7 mycroft 904: Test the value of a variable.
1.1 cgd 905: .It Xo
906: .Ic .ifmake
907: .Oo \&! Oc Ns Ar target
908: .Op Ar operator target ...
909: .Xc
1.7 mycroft 910: Test the target being built.
1.1 cgd 911: .It Xo
912: .Ic .ifnmake
1.80 wiz 913: .Oo \&! Ns Oc Ar target
1.1 cgd 914: .Op Ar operator target ...
915: .Xc
916: Test the target being built.
917: .It Ic .else
918: Reverse the sense of the last conditional.
919: .It Xo
920: .Ic .elif
1.80 wiz 921: .Oo \&! Ns Oc Ar expression
1.1 cgd 922: .Op Ar operator expression ...
923: .Xc
924: A combination of
925: .Ql Ic .else
926: followed by
927: .Ql Ic .if .
928: .It Xo
929: .Ic .elifdef
930: .Oo \&! Oc Ns Ar variable
931: .Op Ar operator variable ...
932: .Xc
933: A combination of
934: .Ql Ic .else
935: followed by
936: .Ql Ic .ifdef .
937: .It Xo
938: .Ic .elifndef
939: .Oo \&! Oc Ns Ar variable
940: .Op Ar operator variable ...
941: .Xc
942: A combination of
943: .Ql Ic .else
944: followed by
945: .Ql Ic .ifndef .
946: .It Xo
947: .Ic .elifmake
948: .Oo \&! Oc Ns Ar target
949: .Op Ar operator target ...
950: .Xc
951: A combination of
952: .Ql Ic .else
953: followed by
954: .Ql Ic .ifmake .
955: .It Xo
956: .Ic .elifnmake
957: .Oo \&! Oc Ns Ar target
958: .Op Ar operator target ...
959: .Xc
960: A combination of
961: .Ql Ic .else
962: followed by
963: .Ql Ic .ifnmake .
964: .It Ic .endif
965: End the body of the conditional.
966: .El
967: .Pp
968: The
969: .Ar operator
970: may be any one of the following:
971: .Bl -tag -width "Cm XX"
972: .It Cm \&|\&|
1.64 wiz 973: Logical OR.
1.62 ross 974: .It Cm \&\*[Am]\*[Am]
1.1 cgd 975: Logical
976: .Tn AND ;
977: of higher precedence than
1.26 hubertf 978: .Dq \&|\&| .
1.1 cgd 979: .El
980: .Pp
981: As in C,
1.25 lukem 982: .Nm
1.1 cgd 983: will only evaluate a conditional as far as is necessary to determine
984: its value.
1.16 christos 985: Parentheses may be used to change the order of evaluation.
1.1 cgd 986: The boolean operator
987: .Ql Ic \&!
988: may be used to logically negate an entire
989: conditional.
1.5 jtc 990: It is of higher precedence than
1.62 ross 991: .Ql Ic \&\*[Am]\*[Am] .
1.1 cgd 992: .Pp
993: The value of
994: .Ar expression
995: may be any of the following:
1.61 ross 996: .Bl -tag -width defined
1.1 cgd 997: .It Ic defined
998: Takes a variable name as an argument and evaluates to true if the variable
999: has been defined.
1000: .It Ic make
1001: Takes a target name as an argument and evaluates to true if the target
1002: was specified as part of
1.74 wiz 1003: .Nm Ns 's
1.1 cgd 1004: command line or was declared the default target (either implicitly or
1005: explicitly, see
1006: .Va .MAIN )
1007: before the line containing the conditional.
1008: .It Ic empty
1.5 jtc 1009: Takes a variable, with possible modifiers, and evaluates to true if
1.1 cgd 1010: the expansion of the variable would result in an empty string.
1011: .It Ic exists
1012: Takes a file name as an argument and evaluates to true if the file exists.
1013: The file is searched for on the system search path (see
1014: .Va .PATH ) .
1015: .It Ic target
1016: Takes a target name as an argument and evaluates to true if the target
1017: has been defined.
1.47 christos 1018: .It Ic commands
1019: Takes a target name as an argument and evaluates to true if the target
1020: has been defined and has commands associated with it.
1.1 cgd 1021: .El
1022: .Pp
1023: .Ar Expression
1.67 grant 1024: may also be an arithmetic or string comparison.
1025: Variable expansion is
1.6 cgd 1026: performed on both sides of the comparison, after which the integral
1.67 grant 1027: values are compared.
1028: A value is interpreted as hexadecimal if it is
1.6 cgd 1029: preceded by 0x, otherwise it is decimal; octal numbers are not supported.
1.67 grant 1030: The standard C relational operators are all supported.
1031: If after
1.6 cgd 1032: variable expansion, either the left or right hand side of a
1.1 cgd 1033: .Ql Ic ==
1034: or
1035: .Ql Ic "!="
1.6 cgd 1036: operator is not an integral value, then
1037: string comparison is performed between the expanded
1038: variables.
1.1 cgd 1039: If no relational operator is given, it is assumed that the expanded
1040: variable is being compared against 0.
1041: .Pp
1042: When
1.25 lukem 1043: .Nm
1.1 cgd 1044: is evaluating one of these conditional expression, and it encounters
1045: a word it doesn't recognize, either the ``make'' or ``defined''
1046: expression is applied to it, depending on the form of the conditional.
1047: If the form is
1048: .Ql Ic .ifdef
1049: or
1050: .Ql Ic .ifndef ,
1051: the ``defined'' expression
1052: is applied.
1053: Similarly, if the form is
1054: .Ql Ic .ifmake
1055: or
1056: .Ql Ic .ifnmake , the ``make''
1057: expression is applied.
1058: .Pp
1059: If the conditional evaluates to true the parsing of the makefile continues
1060: as before.
1061: If it evaluates to false, the following lines are skipped.
1062: In both cases this continues until a
1063: .Ql Ic .else
1064: or
1065: .Ql Ic .endif
1066: is found.
1.16 christos 1067: .Pp
1.6 cgd 1068: For loops are typically used to apply a set of rules to a list of files.
1069: The syntax of a for loop is:
1.59 bgrayson 1070: .Pp
1071: .Bl -tag -compact -width Ds
1.6 cgd 1072: .It Xo
1073: .Ic \&.for
1.48 wiz 1074: .Ar variable
1.39 christos 1075: .Op Ar variable ...
1.16 christos 1076: .Ic in
1.6 cgd 1077: .Ar expression
1078: .Xc
1.80 wiz 1079: .It Aq make-rules
1080: .It Ic \&.endfor
1.6 cgd 1081: .El
1.59 bgrayson 1082: .Pp
1.6 cgd 1083: After the for
1.16 christos 1084: .Ic expression
1.67 grant 1085: is evaluated, it is split into words.
1086: On each iteration of the loop, one word is taken and assigned to each
1.39 christos 1087: .Ic variable ,
1088: in order, and these
1089: .Ic variables
1090: are substituted into the
1.16 christos 1091: .Ic make-rules
1.6 cgd 1092: inside the body of the for loop.
1.39 christos 1093: The number of words must come out even; that is, if there are three
1094: iteration variables, the number of words provided must be a multiple
1095: of three.
1.1 cgd 1096: .Sh COMMENTS
1097: Comments begin with a hash
1098: .Pq Ql \&#
1099: character, anywhere but in a shell
1100: command line, and continue to the end of the line.
1101: .Sh SPECIAL SOURCES
1.61 ross 1102: .Bl -tag -width .IGNOREx
1.1 cgd 1103: .It Ic .IGNORE
1104: Ignore any errors from the commands associated with this target, exactly
1105: as if they all were preceded by a dash
1106: .Pq Ql \- .
1.18 christos 1107: .It Ic .MADE
1.48 wiz 1108: Mark all sources of this target as being up-to-date.
1.1 cgd 1109: .It Ic .MAKE
1110: Execute the commands associated with this target even if the
1111: .Fl n
1112: or
1113: .Fl t
1114: options were specified.
1115: Normally used to mark recursive
1.74 wiz 1116: .Nm Ns 's .
1.1 cgd 1117: .It Ic .NOTMAIN
1118: Normally
1.25 lukem 1119: .Nm
1.1 cgd 1120: selects the first target it encounters as the default target to be built
1121: if no target was specified.
1122: This source prevents this target from being selected.
1123: .It Ic .OPTIONAL
1124: If a target is marked with this attribute and
1.25 lukem 1125: .Nm
1.1 cgd 1126: can't figure out how to create it, it will ignore this fact and assume
1127: the file isn't needed or already exists.
1128: .It Ic .PRECIOUS
1129: When
1.25 lukem 1130: .Nm
1.1 cgd 1131: is interrupted, it removes any partially made targets.
1132: This source prevents the target from being removed.
1133: .It Ic .SILENT
1134: Do not echo any of the commands associated with this target, exactly
1135: as if they all were preceded by an at sign
1136: .Pq Ql @ .
1137: .It Ic .USE
1138: Turn the target into
1.74 wiz 1139: .Nm Ns 's
1.1 cgd 1140: version of a macro.
1141: When the target is used as a source for another target, the other target
1142: acquires the commands, sources, and attributes (except for
1143: .Ic .USE )
1144: of the
1145: source.
1146: If the target already has commands, the
1147: .Ic .USE
1148: target's commands are appended
1149: to them.
1.52 christos 1150: .It Ic .USEBEFORE
1151: Exactly like
1152: .Ic .USE ,
1.57 wiz 1153: but prepend the
1.52 christos 1154: .Ic .USEBEFORE
1155: target commands to the target.
1.12 christos 1156: .It Ic .WAIT
1.71 mjl 1157: If
1.12 christos 1158: .Ic .WAIT
1.71 mjl 1159: appears in a dependency line, the sources that precede it are
1.67 grant 1160: made before the sources that succeed it in the line.
1.71 mjl 1161: Loops are not
1.12 christos 1162: detected and targets that form loops will be silently ignored.
1.1 cgd 1163: .El
1.57 wiz 1164: .Sh SPECIAL TARGETS
1.1 cgd 1165: Special targets may not be included with other targets, i.e. they must be
1166: the only target specified.
1.61 ross 1167: .Bl -tag -width .BEGINx
1.1 cgd 1168: .It Ic .BEGIN
1169: Any command lines attached to this target are executed before anything
1170: else is done.
1171: .It Ic .DEFAULT
1172: This is sort of a
1173: .Ic .USE
1174: rule for any target (that was used only as a
1175: source) that
1.25 lukem 1176: .Nm
1.1 cgd 1177: can't figure out any other way to create.
1178: Only the shell script is used.
1179: The
1180: .Ic .IMPSRC
1181: variable of a target that inherits
1182: .Ic .DEFAULT Ns 's
1183: commands is set
1184: to the target's own name.
1185: .It Ic .END
1186: Any command lines attached to this target are executed after everything
1187: else is done.
1188: .It Ic .IGNORE
1189: Mark each of the sources with the
1190: .Ic .IGNORE
1191: attribute.
1192: If no sources are specified, this is the equivalent of specifying the
1193: .Fl i
1194: option.
1195: .It Ic .INTERRUPT
1196: If
1.25 lukem 1197: .Nm
1.1 cgd 1198: is interrupted, the commands for this target will be executed.
1199: .It Ic .MAIN
1200: If no target is specified when
1.25 lukem 1201: .Nm
1.1 cgd 1202: is invoked, this target will be built.
1203: .It Ic .MAKEFLAGS
1204: This target provides a way to specify flags for
1.25 lukem 1205: .Nm
1.1 cgd 1206: when the makefile is used.
1207: The flags are as if typed to the shell, though the
1208: .Fl f
1209: option will have
1210: no effect.
1.12 christos 1211: .\" XXX: NOT YET!!!!
1212: .\" .It Ic .NOTPARALLEL
1.70 wiz 1213: .\" The named targets are executed in non parallel mode.
1214: .\" If no targets are
1.12 christos 1215: .\" specified, then all targets are executed in non parallel mode.
1.20 gwr 1216: .It Ic .NOPATH
1217: Apply the
1218: .Ic .NOPATH
1.67 grant 1219: attribute to any specified sources.
1220: Targets with this attribute are not
1.21 mycroft 1221: searched for in the directories specified by
1222: .Ic .PATH .
1.12 christos 1223: .It Ic .NOTPARALLEL
1224: Disable parallel mode.
1225: .It Ic .NO_PARALLEL
1226: Same as above, for compatibility with other pmake variants.
1227: .It Ic .ORDER
1228: The named targets are made in sequence.
1229: .\" XXX: NOT YET!!!!
1230: .\" .It Ic .PARALLEL
1.70 wiz 1231: .\" The named targets are executed in parallel mode.
1232: .\" If no targets are
1.12 christos 1233: .\" specified, then all targets are executed in parallel mode.
1.1 cgd 1234: .It Ic .PATH
1235: The sources are directories which are to be searched for files not
1236: found in the current directory.
1237: If no sources are specified, any previously specified directories are
1238: deleted.
1.34 thorpej 1239: If the source is the special
1240: .Ic .DOTLAST
1241: target, then the current working
1.33 thorpej 1242: directory is searched last.
1.14 christos 1243: .It Ic .PHONY
1244: Apply the
1245: .Ic .PHONY
1.67 grant 1246: attribute to any specified sources.
1247: Targets with this attribute do not
1.19 mycroft 1248: correspond to actual files; they are always considered to be out of date,
1249: and will not be created with the
1250: .Fl t
1251: option.
1.1 cgd 1252: .It Ic .PRECIOUS
1253: Apply the
1254: .Ic .PRECIOUS
1255: attribute to any specified sources.
1256: If no sources are specified, the
1257: .Ic .PRECIOUS
1258: attribute is applied to every
1259: target in the file.
1.83 sjg 1260: .It Ic .SHELL
1261: Sets the shell that
1262: .Nm
1263: will use to execute commands.
1264: The sources are a set of
1265: .Ar field=value
1266: pairs.
1267: .Bl -tag -width hasErrCtls
1268: .It Ar name
1269: This is the minimal specification, used to select one of the builtin
1270: shell specs;
1271: .Ar sh ,
1272: .Ar ksh ,
1273: and
1274: .Ar csh .
1275: .It Ar path
1276: Specifies the path to the shell.
1277: .It Ar hasErrCtl
1278: Indicates whether the shell supports exit on error.
1279: .It Ar check
1280: The command to turn on error checking.
1281: .It Ar ignore
1282: The command to disable error checking.
1283: .It Ar echo
1284: The command to turn on echoing of commands executed.
1285: .It Ar quiet
1286: The command to turn off echoing of commands executed.
1287: .It Ar filter
1288: The output to filter after issuing the
1289: .Ar quiet
1290: command. It is typically identical to
1291: .Ar quiet .
1292: .It Ar errFlag
1293: The flag to pass the shell to enable error checking.
1294: .It Ar echoFlag
1295: The flag to pass the shell to enable command echoing.
1296: .El
1297: Example:
1298: .Bd -literal
1299: \&.SHELL: name=ksh path=/bin/ksh hasErrCtl=true \\
1300: check="set -e" ignore="set +e" \\
1301: echo="set -v" quiet="set +v" filter="set +v" \\
1302: echoFlag=v errFlag=e
1303: .Ed
1.1 cgd 1304: .It Ic .SILENT
1305: Apply the
1306: .Ic .SILENT
1307: attribute to any specified sources.
1308: If no sources are specified, the
1309: .Ic .SILENT
1310: attribute is applied to every
1311: command in the file.
1312: .It Ic .SUFFIXES
1313: Each source specifies a suffix to
1.74 wiz 1314: .Nm .
1.71 mjl 1315: If no sources are specified, any previously specified suffixes are deleted.
1.31 ross 1316: .El
1.1 cgd 1317: .Sh ENVIRONMENT
1.25 lukem 1318: .Nm
1.73 perry 1319: uses the following environment variables, if they exist:
1.16 christos 1320: .Ev MACHINE ,
1.26 hubertf 1321: .Ev MACHINE_ARCH ,
1.1 cgd 1322: .Ev MAKE ,
1.16 christos 1323: .Ev MAKEFLAGS ,
1324: .Ev MAKEOBJDIR ,
1.38 sjg 1325: .Ev MAKEOBJDIRPREFIX ,
1.76 jrf 1326: .Ev MAKESYSPATH ,
1.1 cgd 1327: and
1.16 christos 1328: .Ev PWD .
1.57 wiz 1329: .Pp
1.38 sjg 1330: If
1331: .Ev MAKEOBJDIRPREFIX
1332: is set, then
1333: .Nm
1.48 wiz 1334: will
1.38 sjg 1335: .Xr chdir 2
1336: to ${MAKEOBJDIRPREFIX}${.CURDIR} if it exists.
1337: Otherwise if
1338: .Ev MAKEOBJDIR
1339: and the named directory exists
1340: .Nm
1.48 wiz 1341: will
1.38 sjg 1342: .Xr chdir 2
1343: to it.
1.48 wiz 1344: These actions are taken before any makefiles are read which is why they
1.38 sjg 1345: need to be set in the environment.
1.1 cgd 1346: .Sh FILES
1347: .Bl -tag -width /usr/share/mk -compact
1348: .It .depend
1349: list of dependencies
1350: .It Makefile
1351: list of dependencies
1352: .It makefile
1353: list of dependencies
1354: .It sys.mk
1355: system makefile
1356: .It /usr/share/mk
1357: system makefile directory
1358: .El
1359: .Sh SEE ALSO
1360: .Xr mkdep 1
1361: .Sh HISTORY
1362: A
1.25 lukem 1363: .Nm
1.1 cgd 1364: command appeared in
1365: .At v7 .
CVSweb <webmaster@jp.NetBSD.org>