[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.79

1.79    ! wiz         1: .\"    $NetBSD: make.1,v 1.78 2003/05/23 17:25:10 christos 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.79    ! wiz        36: .Dd May 23, 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
                    303: .Ql ? ,
                    304: .Ql * ,
                    305: .Ql []
                    306: and
                    307: .Ql {} .
                    308: The values
                    309: .Ql ? ,
                    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 @ ,
                    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.70      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 * ,
                    604: .Ql ? ,
                    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.
                    626: .It Cm tu
                    627: Converts variable to upper-case letters.
1.1       cgd       628: .Sm off
1.17      christos  629: .It Cm S No \&/ Ar old_string Xo
                    630: .No \&/ Ar new_string
                    631: .No \&/ Op Cm 1g
1.1       cgd       632: .Xc
                    633: .Sm on
                    634: Modify the first occurrence of
1.17      christos  635: .Ar old_string
                    636: in the variable's value, replacing it with
                    637: .Ar new_string .
1.1       cgd       638: If a
                    639: .Ql g
                    640: is appended to the last slash of the pattern, all occurrences
                    641: in each word are replaced.
1.17      christos  642: If a
                    643: .Ql 1
                    644: is appended to the last slash of the pattern, only the first word
                    645: is affected.
1.1       cgd       646: If
1.17      christos  647: .Ar old_string
                    648: begins with a caret
1.1       cgd       649: .Pq Ql ^ ,
1.17      christos  650: .Ar old_string
1.1       cgd       651: is anchored at the beginning of each word.
                    652: If
1.17      christos  653: .Ar old_string
1.1       cgd       654: ends with a dollar sign
                    655: .Pq Ql \&$ ,
                    656: it is anchored at the end of each word.
                    657: Inside
                    658: .Ar new_string ,
                    659: an ampersand
1.62      ross      660: .Pq Ql \*[Am]
1.1       cgd       661: is replaced by
1.17      christos  662: .Ar old_string
                    663: (without any
                    664: .Ql ^
                    665: or
                    666: .Ql \&$ ) .
1.1       cgd       667: Any character may be used as a delimiter for the parts of the modifier
                    668: string.
                    669: The anchoring, ampersand and delimiter characters may be escaped with a
                    670: backslash
                    671: .Pq Ql \e .
                    672: .Pp
                    673: Variable expansion occurs in the normal fashion inside both
                    674: .Ar old_string
                    675: and
                    676: .Ar new_string
                    677: with the single exception that a backslash is used to prevent the expansion
                    678: of a dollar sign
1.17      christos  679: .Pq Ql \&$ ,
1.1       cgd       680: not a preceding dollar sign as is usual.
1.17      christos  681: .Sm off
                    682: .It Cm C No \&/ Ar pattern Xo
                    683: .No \&/ Ar replacement
                    684: .No \&/ Op Cm 1g
                    685: .Xc
                    686: .Sm on
                    687: The
                    688: .Cm C
                    689: modifier is just like the
                    690: .Cm S
1.37      msaitoh   691: modifier except that the old and new strings, instead of being
1.17      christos  692: simple strings, are a regular expression (see
                    693: .Xr regex 3 )
1.72      uebayasi  694: string
                    695: .Ar pattern
1.17      christos  696: and an
                    697: .Xr ed 1 Ns \-style
1.72      uebayasi  698: string
                    699: .Ar replacement .
                    700: Normally, the first occurrence of the pattern
                    701: .Ar pattern
                    702: in each word of the value is substituted with
                    703: .Ar replacement .
1.67      grant     704: The
1.17      christos  705: .Ql 1
                    706: modifier causes the substitution to apply to at most one word; the
                    707: .Ql g
                    708: modifier causes the substitution to apply to as many instances of the
1.72      uebayasi  709: search pattern
                    710: .Ar pattern
                    711: as occur in the word or words it is found in.
1.67      grant     712: Note that
1.17      christos  713: .Ql 1
                    714: and
                    715: .Ql g
                    716: are orthogonal; the former specifies whether multiple words are
                    717: potentially affected, the latter whether multiple substitutions can
                    718: potentially occur within each affected word.
1.1       cgd       719: .It Cm T
                    720: Replaces each word in the variable with its last component.
1.43      christos  721: .It Cm u
                    722: Remove adjacent duplicate words (like
1.57      wiz       723: .Xr uniq 1 ) .
1.40      sjg       724: .It Cm ? Ar true_string Cm : Ar false_string
1.27      christos  725: If the variable evaluates to true, return as its value the
1.57      wiz       726: .Ar true_string ,
1.27      christos  727: otherwise return the
1.57      wiz       728: .Ar false_string .
1.1       cgd       729: .It Ar old_string=new_string
                    730: This is the
                    731: .At V
                    732: style variable substitution.
                    733: It must be the last modifier specified.
1.16      christos  734: If
1.6       cgd       735: .Ar old_string
                    736: or
                    737: .Ar new_string
                    738: do not contain the pattern matching character
                    739: .Ar %
1.16      christos  740: then it is assumed that they are
1.6       cgd       741: anchored at the end of each word, so only suffixes or entire
1.67      grant     742: words may be replaced.
                    743: Otherwise
1.6       cgd       744: .Ar %
1.16      christos  745: is the substring of
                    746: .Ar old_string
1.6       cgd       747: to be replaced in
1.64      wiz       748: .Ar new_string .
1.40      sjg       749: .It Cm @ Ar temp Cm @ Xo
1.48      wiz       750: .No Ar string Cm @
1.40      sjg       751: .Xc
                    752: This is the loop expansion mechanism from the OSF Development
1.67      grant     753: Environment (ODE) make.
                    754: Unlike
1.48      wiz       755: .Cm \&.for
1.40      sjg       756: loops expansion occurs at the time of
1.67      grant     757: reference.
                    758: Assign
1.40      sjg       759: .Ar temp
                    760: to each word in the variable and evaluate
                    761: .Ar string .
1.48      wiz       762: The ODE convention is that
1.40      sjg       763: .Ar temp
1.67      grant     764: should start and end with a period.
                    765: For example.
1.40      sjg       766: .Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@}
                    767: .It Cm U Ar newval
                    768: If the variable is undefined
                    769: .Ar newval
1.63      lukem     770: is the value.
                    771: If the variable is defined, the existing value is returned.
1.67      grant     772: This is another ODE make feature.
                    773: It is handy for setting per-target CFLAGS for instance:
1.40      sjg       774: .Dl ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}}
1.63      lukem     775: If a value is only required if the variable is undefined, use:
                    776: .Dl ${VAR:D:Unewval}
1.40      sjg       777: .It Cm D Ar newval
                    778: If the variable is defined
                    779: .Ar newval
                    780: is the value.
                    781: .It Cm L
                    782: The name of the variable is the value.
                    783: .It Cm P
                    784: The path of the node which has the same name as the variable
1.67      grant     785: is the value.
                    786: If no such node exists or its path is null, then the
1.40      sjg       787: name of the variable is used.
                    788: .It Cm ! Ar cmd Cm !
                    789: The output of running
                    790: .Ar cmd
                    791: is the value.
                    792: .It Cm sh
                    793: If the variable is non-empty it is run as a command and the output
                    794: becomes the new value.
1.42      sjg       795: .It Cm \&:= Ar str
1.48      wiz       796: The variable is assigned the value
1.41      sjg       797: .Ar str
1.67      grant     798: after substitution.
                    799: This modifier and its variations are useful in
1.48      wiz       800: obscure situations such as wanting to apply modifiers to
1.41      sjg       801: .Cm \&.for
1.48      wiz       802: loop iteration variables which won't work due to the way
1.41      sjg       803: .Cm \&.for
1.67      grant     804: loops are implemented.
                    805: These assignment modifiers always expand to
1.41      sjg       806: nothing, so if appearing in a rule line by themselves should be
1.48      wiz       807: preceded with something to keep
1.41      sjg       808: .Nm
1.67      grant     809: happy.
                    810: As in:
1.41      sjg       811: .Bd -literal
                    812: use_foo: \&.USE
                    813: \&.for i in ${\&.TARGET} ${\&.TARGET:R}\&.gz
1.42      sjg       814:        @: ${t::=$i}
1.41      sjg       815:        @echo t:R:T=${t:R:T}
                    816: \&.endfor
                    817:
                    818: .Ed
1.42      sjg       819: The double
                    820: .Cm \&:
                    821: helps avoid false matches with the
                    822: .At V
1.48      wiz       823: style
1.42      sjg       824: .Cm \&=
1.48      wiz       825: modifier and since substitution always occurs the
1.42      sjg       826: .Cm \&:=
                    827: form is vaguely appropriate.
                    828: .It Cm \&:?= Ar str
1.41      sjg       829: As for
1.42      sjg       830: .Cm \&:=
1.41      sjg       831: but only if the variable does not already have a value.
1.42      sjg       832: .It Cm \&:+= Ar str
1.48      wiz       833: Append
1.41      sjg       834: .Ar str
                    835: to the variable.
1.42      sjg       836: .It Cm \&:!= Ar cmd
1.48      wiz       837: Assign the output of
1.41      sjg       838: .Ar cmd
                    839: to the variable.
1.6       cgd       840: .El
                    841: .Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS
1.16      christos  842: Makefile inclusion, conditional structures and for loops  reminiscent
1.6       cgd       843: of the C programming language are provided in
1.74      wiz       844: .Nm .
1.1       cgd       845: All such structures are identified by a line beginning with a single
                    846: dot
                    847: .Pq Ql \&.
                    848: character.
                    849: Files are included with either
1.29      ross      850: .Cm \&.include Aq Ar file
1.1       cgd       851: or
1.29      ross      852: .Cm \&.include Pf \*q Ar file Ns \*q .
1.1       cgd       853: Variables between the angle brackets or double quotes are expanded
                    854: to form the file name.
                    855: If angle brackets are used, the included makefile is expected to be in
                    856: the system makefile directory.
                    857: If double quotes are used, the including makefile's directory and any
                    858: directories specified using the
                    859: .Fl I
                    860: option are searched before the system
                    861: makefile directory.
1.28      christos  862: For compatibility with other versions of
                    863: .Nm
                    864: .Ql include file ...
1.67      grant     865: is also accepted.
                    866: If the include statement is written as
1.29      ross      867: .Cm .-include
                    868: or as
                    869: .Cm .sinclude
1.28      christos  870: then errors locating and/or opening include files are ignored.
1.1       cgd       871: .Pp
                    872: Conditional expressions are also preceded by a single dot as the first
1.5       jtc       873: character of a line.
1.1       cgd       874: The possible conditionals are as follows:
                    875: .Bl -tag -width Ds
                    876: .It Ic .undef Ar variable
                    877: Un-define the specified global variable.
                    878: Only global variables may be un-defined.
                    879: .It Xo
                    880: .Ic \&.if
                    881: .Oo \&! Oc Ns Ar expression
                    882: .Op Ar operator expression ...
                    883: .Xc
                    884: Test the value of an expression.
                    885: .It Xo
                    886: .Ic .ifdef
                    887: .Oo \&! Oc Ns Ar variable
                    888: .Op Ar operator variable ...
                    889: .Xc
1.7       mycroft   890: Test the value of a variable.
1.1       cgd       891: .It Xo
                    892: .Ic .ifndef
                    893: .Oo \&! Oc Ns Ar variable
                    894: .Op Ar operator variable ...
                    895: .Xc
1.7       mycroft   896: Test the value of a variable.
1.1       cgd       897: .It Xo
                    898: .Ic .ifmake
                    899: .Oo \&! Oc Ns Ar target
                    900: .Op Ar operator target ...
                    901: .Xc
1.7       mycroft   902: Test the target being built.
1.1       cgd       903: .It Xo
                    904: .Ic .ifnmake
                    905: .Oo \&! Oc Ar target
                    906: .Op Ar operator target ...
                    907: .Xc
                    908: Test the target being built.
                    909: .It Ic .else
                    910: Reverse the sense of the last conditional.
                    911: .It Xo
                    912: .Ic .elif
                    913: .Oo \&! Oc Ar expression
                    914: .Op Ar operator expression ...
                    915: .Xc
                    916: A combination of
                    917: .Ql Ic .else
                    918: followed by
                    919: .Ql Ic .if .
                    920: .It Xo
                    921: .Ic .elifdef
                    922: .Oo \&! Oc Ns Ar variable
                    923: .Op Ar operator variable ...
                    924: .Xc
                    925: A combination of
                    926: .Ql Ic .else
                    927: followed by
                    928: .Ql Ic .ifdef .
                    929: .It Xo
                    930: .Ic .elifndef
                    931: .Oo \&! Oc Ns Ar variable
                    932: .Op Ar operator variable ...
                    933: .Xc
                    934: A combination of
                    935: .Ql Ic .else
                    936: followed by
                    937: .Ql Ic .ifndef .
                    938: .It Xo
                    939: .Ic .elifmake
                    940: .Oo \&! Oc Ns Ar target
                    941: .Op Ar operator target ...
                    942: .Xc
                    943: A combination of
                    944: .Ql Ic .else
                    945: followed by
                    946: .Ql Ic .ifmake .
                    947: .It Xo
                    948: .Ic .elifnmake
                    949: .Oo \&! Oc Ns Ar target
                    950: .Op Ar operator target ...
                    951: .Xc
                    952: A combination of
                    953: .Ql Ic .else
                    954: followed by
                    955: .Ql Ic .ifnmake .
                    956: .It Ic .endif
                    957: End the body of the conditional.
                    958: .El
                    959: .Pp
                    960: The
                    961: .Ar operator
                    962: may be any one of the following:
                    963: .Bl -tag -width "Cm XX"
                    964: .It Cm \&|\&|
1.64      wiz       965: Logical OR.
1.62      ross      966: .It Cm \&\*[Am]\*[Am]
1.1       cgd       967: Logical
                    968: .Tn AND ;
                    969: of higher precedence than
1.26      hubertf   970: .Dq \&|\&| .
1.1       cgd       971: .El
                    972: .Pp
                    973: As in C,
1.25      lukem     974: .Nm
1.1       cgd       975: will only evaluate a conditional as far as is necessary to determine
                    976: its value.
1.16      christos  977: Parentheses may be used to change the order of evaluation.
1.1       cgd       978: The boolean operator
                    979: .Ql Ic \&!
                    980: may be used to logically negate an entire
                    981: conditional.
1.5       jtc       982: It is of higher precedence than
1.62      ross      983: .Ql Ic \&\*[Am]\*[Am] .
1.1       cgd       984: .Pp
                    985: The value of
                    986: .Ar expression
                    987: may be any of the following:
1.61      ross      988: .Bl -tag -width defined
1.1       cgd       989: .It Ic defined
                    990: Takes a variable name as an argument and evaluates to true if the variable
                    991: has been defined.
                    992: .It Ic make
                    993: Takes a target name as an argument and evaluates to true if the target
                    994: was specified as part of
1.74      wiz       995: .Nm Ns 's
1.1       cgd       996: command line or was declared the default target (either implicitly or
                    997: explicitly, see
                    998: .Va .MAIN )
                    999: before the line containing the conditional.
                   1000: .It Ic empty
1.5       jtc      1001: Takes a variable, with possible modifiers, and evaluates to true if
1.1       cgd      1002: the expansion of the variable would result in an empty string.
                   1003: .It Ic exists
                   1004: Takes a file name as an argument and evaluates to true if the file exists.
                   1005: The file is searched for on the system search path (see
                   1006: .Va .PATH ) .
                   1007: .It Ic target
                   1008: Takes a target name as an argument and evaluates to true if the target
                   1009: has been defined.
1.47      christos 1010: .It Ic commands
                   1011: Takes a target name as an argument and evaluates to true if the target
                   1012: has been defined and has commands associated with it.
1.1       cgd      1013: .El
                   1014: .Pp
                   1015: .Ar Expression
1.67      grant    1016: may also be an arithmetic or string comparison.
                   1017: Variable expansion is
1.6       cgd      1018: performed on both sides of the comparison, after which the integral
1.67      grant    1019: values are compared.
                   1020: A value is interpreted as hexadecimal if it is
1.6       cgd      1021: preceded by 0x, otherwise it is decimal; octal numbers are not supported.
1.67      grant    1022: The standard C relational operators are all supported.
                   1023: If after
1.6       cgd      1024: variable expansion, either the left or right hand side of a
1.1       cgd      1025: .Ql Ic ==
                   1026: or
                   1027: .Ql Ic "!="
1.6       cgd      1028: operator is not an integral value, then
                   1029: string comparison is performed between the expanded
                   1030: variables.
1.1       cgd      1031: If no relational operator is given, it is assumed that the expanded
                   1032: variable is being compared against 0.
                   1033: .Pp
                   1034: When
1.25      lukem    1035: .Nm
1.1       cgd      1036: is evaluating one of these conditional expression, and it encounters
                   1037: a word it doesn't recognize, either the ``make'' or ``defined''
                   1038: expression is applied to it, depending on the form of the conditional.
                   1039: If the form is
                   1040: .Ql Ic .ifdef
                   1041: or
                   1042: .Ql Ic .ifndef ,
                   1043: the ``defined'' expression
                   1044: is applied.
                   1045: Similarly, if the form is
                   1046: .Ql Ic .ifmake
                   1047: or
                   1048: .Ql Ic .ifnmake , the ``make''
                   1049: expression is applied.
                   1050: .Pp
                   1051: If the conditional evaluates to true the parsing of the makefile continues
                   1052: as before.
                   1053: If it evaluates to false, the following lines are skipped.
                   1054: In both cases this continues until a
                   1055: .Ql Ic .else
                   1056: or
                   1057: .Ql Ic .endif
                   1058: is found.
1.16      christos 1059: .Pp
1.6       cgd      1060: For loops are typically used to apply a set of rules to a list of files.
                   1061: The syntax of a for loop is:
1.59      bgrayson 1062: .Pp
                   1063: .Bl -tag -compact -width Ds
1.6       cgd      1064: .It Xo
                   1065: .Ic \&.for
1.48      wiz      1066: .Ar variable
1.39      christos 1067: .Op Ar variable ...
1.16      christos 1068: .Ic in
1.6       cgd      1069: .Ar expression
                   1070: .Xc
                   1071: .It Xo
1.62      ross     1072: \*[Lt]make-rules\*[Gt]
1.6       cgd      1073: .Ic \&.endfor
                   1074: .Xc
                   1075: .El
1.59      bgrayson 1076: .Pp
1.6       cgd      1077: After the for
1.16      christos 1078: .Ic expression
1.67      grant    1079: is evaluated, it is split into words.
                   1080: On each iteration of the loop, one word is taken and assigned to each
1.39      christos 1081: .Ic variable ,
                   1082: in order, and these
                   1083: .Ic variables
                   1084: are substituted into the
1.16      christos 1085: .Ic make-rules
1.6       cgd      1086: inside the body of the for loop.
1.39      christos 1087: The number of words must come out even; that is, if there are three
                   1088: iteration variables, the number of words provided must be a multiple
                   1089: of three.
1.1       cgd      1090: .Sh COMMENTS
                   1091: Comments begin with a hash
                   1092: .Pq Ql \&#
                   1093: character, anywhere but in a shell
                   1094: command line, and continue to the end of the line.
                   1095: .Sh SPECIAL SOURCES
1.61      ross     1096: .Bl -tag -width .IGNOREx
1.1       cgd      1097: .It Ic .IGNORE
                   1098: Ignore any errors from the commands associated with this target, exactly
                   1099: as if they all were preceded by a dash
                   1100: .Pq Ql \- .
1.18      christos 1101: .It Ic .MADE
1.48      wiz      1102: Mark all sources of this target as being up-to-date.
1.1       cgd      1103: .It Ic .MAKE
                   1104: Execute the commands associated with this target even if the
                   1105: .Fl n
                   1106: or
                   1107: .Fl t
                   1108: options were specified.
                   1109: Normally used to mark recursive
1.74      wiz      1110: .Nm Ns 's .
1.1       cgd      1111: .It Ic .NOTMAIN
                   1112: Normally
1.25      lukem    1113: .Nm
1.1       cgd      1114: selects the first target it encounters as the default target to be built
                   1115: if no target was specified.
                   1116: This source prevents this target from being selected.
                   1117: .It Ic .OPTIONAL
                   1118: If a target is marked with this attribute and
1.25      lukem    1119: .Nm
1.1       cgd      1120: can't figure out how to create it, it will ignore this fact and assume
                   1121: the file isn't needed or already exists.
                   1122: .It Ic .PRECIOUS
                   1123: When
1.25      lukem    1124: .Nm
1.1       cgd      1125: is interrupted, it removes any partially made targets.
                   1126: This source prevents the target from being removed.
                   1127: .It Ic .SILENT
                   1128: Do not echo any of the commands associated with this target, exactly
                   1129: as if they all were preceded by an at sign
                   1130: .Pq Ql @ .
                   1131: .It Ic .USE
                   1132: Turn the target into
1.74      wiz      1133: .Nm Ns 's
1.1       cgd      1134: version of a macro.
                   1135: When the target is used as a source for another target, the other target
                   1136: acquires the commands, sources, and attributes (except for
                   1137: .Ic .USE )
                   1138: of the
                   1139: source.
                   1140: If the target already has commands, the
                   1141: .Ic .USE
                   1142: target's commands are appended
                   1143: to them.
1.52      christos 1144: .It Ic .USEBEFORE
                   1145: Exactly like
                   1146: .Ic .USE ,
1.57      wiz      1147: but prepend the
1.52      christos 1148: .Ic .USEBEFORE
                   1149: target commands to the target.
1.12      christos 1150: .It Ic .WAIT
1.71      mjl      1151: If
1.12      christos 1152: .Ic .WAIT
1.71      mjl      1153: appears in a dependency line, the sources that precede it are
1.67      grant    1154: made before the sources that succeed it in the line.
1.71      mjl      1155: Loops are not
1.12      christos 1156: detected and targets that form loops will be silently ignored.
1.1       cgd      1157: .El
1.57      wiz      1158: .Sh SPECIAL TARGETS
1.1       cgd      1159: Special targets may not be included with other targets, i.e. they must be
                   1160: the only target specified.
1.61      ross     1161: .Bl -tag -width .BEGINx
1.1       cgd      1162: .It Ic .BEGIN
                   1163: Any command lines attached to this target are executed before anything
                   1164: else is done.
                   1165: .It Ic .DEFAULT
                   1166: This is sort of a
                   1167: .Ic .USE
                   1168: rule for any target (that was used only as a
                   1169: source) that
1.25      lukem    1170: .Nm
1.1       cgd      1171: can't figure out any other way to create.
                   1172: Only the shell script is used.
                   1173: The
                   1174: .Ic .IMPSRC
                   1175: variable of a target that inherits
                   1176: .Ic .DEFAULT Ns 's
                   1177: commands is set
                   1178: to the target's own name.
                   1179: .It Ic .END
                   1180: Any command lines attached to this target are executed after everything
                   1181: else is done.
                   1182: .It Ic .IGNORE
                   1183: Mark each of the sources with the
                   1184: .Ic .IGNORE
                   1185: attribute.
                   1186: If no sources are specified, this is the equivalent of specifying the
                   1187: .Fl i
                   1188: option.
                   1189: .It Ic .INTERRUPT
                   1190: If
1.25      lukem    1191: .Nm
1.1       cgd      1192: is interrupted, the commands for this target will be executed.
                   1193: .It Ic .MAIN
                   1194: If no target is specified when
1.25      lukem    1195: .Nm
1.1       cgd      1196: is invoked, this target will be built.
                   1197: .It Ic .MAKEFLAGS
                   1198: This target provides a way to specify flags for
1.25      lukem    1199: .Nm
1.1       cgd      1200: when the makefile is used.
                   1201: The flags are as if typed to the shell, though the
                   1202: .Fl f
                   1203: option will have
                   1204: no effect.
1.12      christos 1205: .\" XXX: NOT YET!!!!
                   1206: .\" .It Ic .NOTPARALLEL
1.70      wiz      1207: .\" The named targets are executed in non parallel mode.
                   1208: .\" If no targets are
1.12      christos 1209: .\" specified, then all targets are executed in non parallel mode.
1.20      gwr      1210: .It Ic .NOPATH
                   1211: Apply the
                   1212: .Ic .NOPATH
1.67      grant    1213: attribute to any specified sources.
                   1214: Targets with this attribute are not
1.21      mycroft  1215: searched for in the directories specified by
                   1216: .Ic .PATH .
1.12      christos 1217: .It Ic .NOTPARALLEL
                   1218: Disable parallel mode.
                   1219: .It Ic .NO_PARALLEL
                   1220: Same as above, for compatibility with other pmake variants.
                   1221: .It Ic .ORDER
                   1222: The named targets are made in sequence.
                   1223: .\" XXX: NOT YET!!!!
                   1224: .\" .It Ic .PARALLEL
1.70      wiz      1225: .\" The named targets are executed in parallel mode.
                   1226: .\" If no targets are
1.12      christos 1227: .\" specified, then all targets are executed in parallel mode.
1.1       cgd      1228: .It Ic .PATH
                   1229: The sources are directories which are to be searched for files not
                   1230: found in the current directory.
                   1231: If no sources are specified, any previously specified directories are
                   1232: deleted.
1.34      thorpej  1233: If the source is the special
                   1234: .Ic .DOTLAST
                   1235: target, then the current working
1.33      thorpej  1236: directory is searched last.
1.14      christos 1237: .It Ic .PHONY
                   1238: Apply the
                   1239: .Ic .PHONY
1.67      grant    1240: attribute to any specified sources.
                   1241: Targets with this attribute do not
1.19      mycroft  1242: correspond to actual files; they are always considered to be out of date,
                   1243: and will not be created with the
                   1244: .Fl t
                   1245: option.
1.1       cgd      1246: .It Ic .PRECIOUS
                   1247: Apply the
                   1248: .Ic .PRECIOUS
                   1249: attribute to any specified sources.
                   1250: If no sources are specified, the
                   1251: .Ic .PRECIOUS
                   1252: attribute is applied to every
                   1253: target in the file.
                   1254: .It Ic .SILENT
                   1255: Apply the
                   1256: .Ic .SILENT
                   1257: attribute to any specified sources.
                   1258: If no sources are specified, the
                   1259: .Ic .SILENT
                   1260: attribute is applied to every
                   1261: command in the file.
                   1262: .It Ic .SUFFIXES
                   1263: Each source specifies a suffix to
1.74      wiz      1264: .Nm .
1.71      mjl      1265: If no sources are specified, any previously specified suffixes are deleted.
1.31      ross     1266: .El
1.1       cgd      1267: .Sh ENVIRONMENT
1.25      lukem    1268: .Nm
1.73      perry    1269: uses the following environment variables, if they exist:
1.16      christos 1270: .Ev MACHINE ,
1.26      hubertf  1271: .Ev MACHINE_ARCH ,
1.1       cgd      1272: .Ev MAKE ,
1.16      christos 1273: .Ev MAKEFLAGS ,
                   1274: .Ev MAKEOBJDIR ,
1.38      sjg      1275: .Ev MAKEOBJDIRPREFIX ,
1.76      jrf      1276: .Ev MAKESYSPATH ,
1.1       cgd      1277: and
1.16      christos 1278: .Ev PWD .
1.57      wiz      1279: .Pp
1.38      sjg      1280: If
                   1281: .Ev MAKEOBJDIRPREFIX
                   1282: is set, then
                   1283: .Nm
1.48      wiz      1284: will
1.38      sjg      1285: .Xr chdir 2
                   1286: to ${MAKEOBJDIRPREFIX}${.CURDIR} if it exists.
                   1287: Otherwise if
                   1288: .Ev MAKEOBJDIR
                   1289: and the named directory exists
                   1290: .Nm
1.48      wiz      1291: will
1.38      sjg      1292: .Xr chdir 2
                   1293: to it.
1.48      wiz      1294: These actions are taken before any makefiles are read which is why they
1.38      sjg      1295: need to be set in the environment.
1.1       cgd      1296: .Sh FILES
                   1297: .Bl -tag -width /usr/share/mk -compact
                   1298: .It .depend
                   1299: list of dependencies
                   1300: .It Makefile
                   1301: list of dependencies
                   1302: .It makefile
                   1303: list of dependencies
                   1304: .It sys.mk
                   1305: system makefile
                   1306: .It /usr/share/mk
                   1307: system makefile directory
                   1308: .El
                   1309: .Sh SEE ALSO
                   1310: .Xr mkdep 1
                   1311: .Sh HISTORY
                   1312: A
1.25      lukem    1313: .Nm
1.1       cgd      1314: command appeared in
                   1315: .At v7 .

CVSweb <webmaster@jp.NetBSD.org>