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

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

CVSweb <webmaster@jp.NetBSD.org>