[BACK]Return to make.1 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.bin / make

Annotation of src/usr.bin/make/make.1, Revision 1.82

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

CVSweb <webmaster@jp.NetBSD.org>