770 lines
23 KiB
Groff
770 lines
23 KiB
Groff
.\" @(#)45 1.4 src/bldenv/make/make.1, bldprocess, bos412, GOLDA411a 1/20/94 10:50:24
|
|
.\"
|
|
.\" COMPONENT_NAME: BLDPROCESS
|
|
.\"
|
|
.\" FUNCTIONS: ming
|
|
.\"
|
|
.\" ORIGINS: 27,71
|
|
.\"
|
|
.\" This module contains IBM CONFIDENTIAL code. -- (IBM
|
|
.\" Confidential Restricted when combined with the aggregated
|
|
.\" modules for this product)
|
|
.\" SOURCE MATERIALS
|
|
.\"
|
|
.\" (C) COPYRIGHT International Business Machines Corp. 1994
|
|
.\" All Rights Reserved
|
|
.\" US Government Users Restricted Rights - Use, duplication or
|
|
.\" disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
.\"
|
|
.\"
|
|
.\" @OSF_FREE_COPYRIGHT@
|
|
.\" COPYRIGHT NOTICE
|
|
.\" Copyright (c) 1992, 1991, 1990
|
|
.\" Open Software Foundation, Inc.
|
|
.\"
|
|
.\" Permission is hereby granted to use, copy, modify and freely distribute
|
|
.\" the software in this file and its documentation for any purpose without
|
|
.\" fee, provided that the above copyright notice appears in all copies and
|
|
.\" that both the copyright notice and this permission notice appear in
|
|
.\" supporting documentation. Further, provided that the name of Open
|
|
.\" Software Foundation, Inc. ("OSF") not be used in advertising or
|
|
.\" publicity pertaining to distribution of the software without prior
|
|
.\" written permission from OSF. OSF makes no representations about the
|
|
.\" suitability of this software for any purpose. It is provided "as is"
|
|
.\" without express or implied warranty.
|
|
.\"
|
|
.\"
|
|
.\" HISTORY
|
|
.\" $Log: make.1,v $
|
|
.\" Revision 1.2.2.2 1992/12/03 19:07:00 damon
|
|
.\" ODE 2.2 CR 346. Expanded copyright
|
|
.\" [1992/12/03 18:36:16 damon]
|
|
.\"
|
|
.\" Revision 1.2 1991/12/05 20:44:27 devrcs
|
|
.\" Changes for Reno make
|
|
.\" [91/03/22 16:07:45 mckeen]
|
|
.\"
|
|
.\" $EndLog$
|
|
.\"
|
|
.\" Copyright (c) 1990 The Regents of the University of California.
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms are permitted provided
|
|
.\" that: (1) source distributions retain this entire copyright notice and
|
|
.\" comment, and (2) distributions including binaries display the following
|
|
.\" acknowledgement: ``This product includes software developed by the
|
|
.\" University of California, Berkeley and its contributors'' in the
|
|
.\" documentation or other materials provided with the distribution and in
|
|
.\" all advertising materials mentioning features or use of this software.
|
|
.\" Neither the name of the University nor the names of its contributors may
|
|
.\" be used to endorse or promote products derived from this software without
|
|
.\" specific prior written permission.
|
|
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
|
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
.\"
|
|
.\" @(#)make.1 5.5 (Berkeley) 1/11/91
|
|
.\"
|
|
.Dd January 11, 1991
|
|
.Dt MAKE 1
|
|
.Os BSD 4.4
|
|
.Sh NAME
|
|
.Nm make
|
|
.Nd maintain program dependencies
|
|
.Sh SYNOPSIS
|
|
.Nm make
|
|
.Op Fl eiknqrstv
|
|
.Op Fl D Ar variable
|
|
.Op Fl d Ar flags
|
|
.Op Fl f Ar makefile
|
|
.Op Fl I Ar directory
|
|
.Op Fl j Ar max_jobs
|
|
.Op Ar variable=value
|
|
.Op Ar target ...
|
|
.Sh DESCRIPTION
|
|
.Nm Make
|
|
is a program designed to simplify the maintenance of other programs.
|
|
Its input is a list of specifications as to the files upon which programs
|
|
and other files depend.
|
|
If the file ``makefile'' exists, it is read for this list of specifications.
|
|
If it does not exist, the file ``Makefile'' is read.
|
|
If the file ``.depend'' exists, it is read (see
|
|
.Xr mkdep 1) .
|
|
.Pp
|
|
This manual page is intended as a reference document only.
|
|
For a more thorough description of
|
|
.Nm make
|
|
and makefiles, please refer to
|
|
.Em Make \-\- A Tutorial .
|
|
.Pp
|
|
The options are as follows:
|
|
.Tw Ds
|
|
.Tp Cx Fl D
|
|
.Ar variable
|
|
.Cx
|
|
Define
|
|
.Ar variable
|
|
to be 1, in the global context.
|
|
.Tp Cx Fl d
|
|
.Ar flags
|
|
.Cx
|
|
Turn on debugging, and specify which portions of
|
|
.Nm make
|
|
are to print debugging information.
|
|
.Ar Flags
|
|
is one or more of the following:
|
|
.Tw Ds
|
|
.Tp Ic A
|
|
Print all possible debugging information; equivalent to specifying
|
|
all of the debugging flags.
|
|
.Tp Ic a
|
|
Print debugging information about archive searching and caching.
|
|
.Tp Ic c
|
|
Print debugging information about conditional evaluation.
|
|
.Tp Ic d
|
|
Print debugging information about directory searching and caching.
|
|
.Tp Ic g1
|
|
Print the input graph before making anything.
|
|
.Tp Ic g2
|
|
Print the input graph after making everything, or before exiting
|
|
on error.
|
|
.Tp Ic j
|
|
Print debugging information about running multiple shells.
|
|
.Tp Ic m
|
|
Print debugging information about making targets, including modification
|
|
dates.
|
|
.Tp Ic s
|
|
Print debugging information about suffix-transformation rules.
|
|
.Tp Ic t
|
|
Print debugging information about target list maintenance.
|
|
.Tp Ic v
|
|
Print debugging information about variable assignment.
|
|
.Tp
|
|
.Tp Fl e
|
|
Specify that environmental variables override macro assignments within
|
|
makefiles.
|
|
.Tp Cx Fl f
|
|
.Ar makefile
|
|
.Cx
|
|
Specify a makefile to read instead of the default ``makefile'' and ``Makefile''.
|
|
If
|
|
.Ar makefile
|
|
is ``\-'', standard input is read.
|
|
Multiple makefile's may be specified, and are read in the order specified.
|
|
.Tp Cx Fl I
|
|
.Ar directory
|
|
.Cx
|
|
Specify a directory in which to search for makefiles and included makefiles.
|
|
The system makefile directory is automatically included as part of this
|
|
list.
|
|
.Tp Fl i
|
|
Ignore non-zero exit of shell commands in the makefile.
|
|
Equivalent to specifying ``\-'' before each command line in the makefile.
|
|
.Tp Cx Fl j
|
|
.Ar max_jobs
|
|
.Cx
|
|
Specify the maximum number of jobs that
|
|
.Nm make
|
|
may have running at any one time.
|
|
.Tp Fl k
|
|
Continue processing after errors are encountered, but only on those targets
|
|
that do not depend on the target whose creation caused the error.
|
|
.Tp Fl n
|
|
Display the commands that would have been executed, but do not actually
|
|
execute them.
|
|
.Tp Fl q
|
|
Do not execute any commands, but exit 0 if the specified targets are
|
|
up-to-date and 1, otherwise.
|
|
.Tp Fl r
|
|
Do not use the built-in rules specified in the system makefile.
|
|
.Tp Fl s
|
|
Do not echo any commands as they are executed.
|
|
Equivalent to specifying ``@'' before each command line in the makefile.
|
|
.Tp Fl t
|
|
Rather than re-building a target as specified in the makefile, create it
|
|
or update its modification time to make it appear up-to-date.
|
|
.Tp Ar variable=value
|
|
Set the value of the variable
|
|
.Ar variable
|
|
to
|
|
.Ar value .
|
|
.Tp
|
|
.Pp
|
|
There are six different types of lines in a makefile: file dependency
|
|
specifications, shell commands, variable assignments, include statements,
|
|
conditional directives, and comments.
|
|
.Pp
|
|
In general, lines may be continued from one line to the next by ending
|
|
them with a backslash (``\e'').
|
|
The trailing newline character and initial whitespace on the following
|
|
line are compressed into a single space.
|
|
.Sh FILE DEPENDENCY SPECIFICATIONS
|
|
Dependency lines consist of one or more targets, an operator, and zero
|
|
or more sources.
|
|
This creates a relationship where the targets ``depend'' on the sources
|
|
and are usually created from them.
|
|
The exact relationship between the target and the source is determined
|
|
by the operator that separates them.
|
|
The three operators are as follows:
|
|
.Tw Ds
|
|
.Tp Ic \&:
|
|
A target is considered out-of-date if its modification time is less than
|
|
those of any of its sources.
|
|
Sources for a target accumulate over dependency lines when this operator
|
|
is used.
|
|
The target is removed if
|
|
.Nm make
|
|
is interrupted.
|
|
.Tp Ic \&!
|
|
Targets are always re-created, but not until all sources have been
|
|
examined and re-created as necessary.
|
|
Sources for a target accumulate over dependency lines when this operator
|
|
is used.
|
|
The target is removed if
|
|
.Nm make
|
|
is interrupted.
|
|
.Tp Ic \&::
|
|
If no sources are specified, the target is always re-created.
|
|
Otherwise, a target is considered out-of-date if any of its sources has
|
|
been modified more recently than the target.
|
|
Sources for a target do not accumulate over dependency lines when this
|
|
operator is used.
|
|
The target will not be removed if
|
|
.Nm make
|
|
is interrupted.
|
|
.Tp
|
|
.Pp
|
|
Targets and sources may contain the shell wildcard values ``?'', ``*'',
|
|
.Dq Op
|
|
and ``{}''.
|
|
The values ``?'', ``*'' and
|
|
.Dq Op
|
|
may only be used as part of the final
|
|
component of the target or source, and must be used to describe existing
|
|
files.
|
|
The value ``{}'' need not necessarily be used to describe existing files.
|
|
Expansion is in directory order, not alphabetically as done in the shell.
|
|
.Sh SHELL COMMANDS
|
|
Each target may have associated with it a series of shell commands, normally
|
|
used to create the target.
|
|
Each of the commands in this script
|
|
.Em must
|
|
be preceded by a tab.
|
|
While any target may appear on a dependency line, only one of these
|
|
dependencies may be followed by a creation script, unless the ``::''
|
|
operator is used.
|
|
.Pp
|
|
If the first or first two characters of the command line are ``@'' and/or
|
|
``\-'', the command is treated specially.
|
|
A ``@'' causes the command not to be echoed before it is executed.
|
|
A ``\-'' causes any non-zero exit status of the command line to be ignored.
|
|
.Sh VARIABLE ASSIGNMENTS
|
|
Variables in make are much like variables in the shell, and, by tradition,
|
|
consist of all upper-case letters.
|
|
The five operators that can be used to assign values to variables are as
|
|
follows:
|
|
.Tw Ds
|
|
.Tp Ic \&=
|
|
Assign the value to the variable.
|
|
Any previous value is overridden.
|
|
.Tp Ic \&+=
|
|
Append the value to the current value of the variable.
|
|
.Tp Ic \&?=
|
|
Assign the value to the variable if it is not already defined.
|
|
.Tp Ic \&:=
|
|
Assign with expansion, i.e. expand the value before assigning it
|
|
to the variable.
|
|
Normally, expansion is not done until the variable is referenced.
|
|
.Tp Ic \&!=
|
|
Expand the value and pass it to the shell for execution and assign
|
|
the result to the variable.
|
|
Any newlines in the result are replaced with spaces.
|
|
.Tp
|
|
.Pp
|
|
Any white-space before the assigned
|
|
.Ar value
|
|
is removed; if the value is being appended, a single space is inserted
|
|
between the previous contents of the variable and the appended value.
|
|
.Pp
|
|
Variables are expanded by surrounding the variable name with either
|
|
curly braces (``{}'') or parenthesis (``()'') and preceding it with
|
|
a dollar sign (``$'').
|
|
If the variable name contains only a single letter, the surrounding
|
|
braces or parenthesis are not required.
|
|
This shorter form is not recommended.
|
|
.Pp
|
|
Variable substitution occurs at two distinct times, depending on where
|
|
the variable is being used.
|
|
Variables in dependency lines are expanded as the line is read.
|
|
Variables in shell commands are expanded when the shell command is
|
|
executed.
|
|
.Pp
|
|
The four different classes of variables (in order of increasing precedence)
|
|
are:
|
|
.Tw Ds
|
|
.Tp environment variables
|
|
Variables defined as part of
|
|
.Cx Nm make
|
|
.Cx \'s
|
|
.Cx
|
|
environment.
|
|
.Tp global variables
|
|
Variables defined in the makefile or in included makefiles.
|
|
.Tp command line variables
|
|
Variables defined as part of the command line.
|
|
.Tp local variables
|
|
Variables that are defined specific to a certain target.
|
|
The seven local variables are as follows:
|
|
.Tw Ds
|
|
.Tp Va \&.ALLSRC
|
|
The list of all sources for this target; also known as ``>''.
|
|
.Tp Va \&.ARCHIVE
|
|
The name of the archive file.
|
|
.Tp Va \&.IMPSRC
|
|
The name/path of the source from which the target is to be transformed
|
|
(the ``implied'' source); also known as ``<''.
|
|
.Tp Va \&.MEMBER
|
|
The name of the archive member.
|
|
.Tp Va \&.OODATE
|
|
The list of sources for this target that were deemed out-of-date; also
|
|
known as ``?''.
|
|
.Tp Va \&.PREFIX
|
|
The file prefix of the file, containing only the file portion, no suffix
|
|
or preceding directory components; also known as ``*'.
|
|
.Tp Va \&.TARGET
|
|
The name of the target; also known as ``@''.
|
|
.Tp
|
|
.Pp
|
|
The shorter forms ``@'', ``?'', ``>'' and ``*'' are permitted for backward
|
|
compatibility with historical makefiles and are not recommended.
|
|
The six variables ``@F'', ``@D'', ``<F'', ``<D'', ``*F'' and ``*D'' are
|
|
permitted for compatibility with System V makefiles and are not recommended.
|
|
.Pp
|
|
Four of the local variables may be used in sources on dependency lines
|
|
because they expand to the proper value for each target on the line.
|
|
These variables are ``.TARGET'', ``.PREFIX'', ``.ARCHIVE'', and ``.MEMBER''.
|
|
.Pp
|
|
In addition,
|
|
.Nm make
|
|
sets or knows about the following variables:
|
|
.Tw MAKEFLAGS
|
|
.Tp Va \&$
|
|
A single dollar sign (``$''), i.e. ``$$'' expands to a single dollar
|
|
sign.
|
|
.Tp Va \&.MAKE
|
|
The name that
|
|
.Nm make
|
|
was executed with
|
|
.Pq Cx Va argv
|
|
.Op 0
|
|
.Cx
|
|
.Tp Va \&.CURDIR
|
|
A path to the directory where
|
|
.Nm make
|
|
was executed.
|
|
.Tp Va MAKEFLAGS
|
|
The environment variable ``MAKEFLAGS'' may contain anything that
|
|
may be specified on
|
|
.Cx Nm make
|
|
.Cx \'s
|
|
.Cx
|
|
command line.
|
|
Anything specified on
|
|
.Cx Nm make
|
|
.Cx \'s
|
|
.Cx
|
|
command line is appended to the ``MAKEFLAGS'' variable which is then
|
|
entered into the environment for all programs which
|
|
.Nm make
|
|
executes.
|
|
.Tp
|
|
.Pp
|
|
Variable expansion may be modified to select or modify each word of the
|
|
variable (where a ``word'' is white-space delimited sequence of characters).
|
|
The general format of a variable expansion is as follows:
|
|
.Pp
|
|
.Dl {variable[:modifier[:...]]}
|
|
.Pp
|
|
Each modifier begins with a colon and one of the following
|
|
special characters.
|
|
The colon may be escaped with a backslash (``\e'').
|
|
.Tp Cm E\&
|
|
Replaces each word in the variable with its suffix.
|
|
.Tp Cm \&H
|
|
Replaces each word in the variable with everything but the last component.
|
|
.Tp Cx Ic M
|
|
.Ar pattern
|
|
.Cx
|
|
Select only those words that match the rest of the modifier.
|
|
The standard shell wildcard characters (``*'', ``?'', and
|
|
.Dq Op )
|
|
may
|
|
be used.
|
|
The wildcard characters may be escaped with a backslash (``\e'').
|
|
.Tp Cx Ic N
|
|
.Ar pattern
|
|
.Cx
|
|
This is identical to ``M'', but selects all words which do not match
|
|
the rest of the modifier.
|
|
.Tp Cm R
|
|
Replaces each word in the variable with everything but its suffix.
|
|
.Tp Cx Cm S
|
|
.Cx \&/
|
|
.Ar old_pattern
|
|
.Cx \&/
|
|
.Ar new_pattern
|
|
.Cx \&/
|
|
.Op Cm g
|
|
.Cx
|
|
Modify the first occurrence of
|
|
.Ar old_pattern
|
|
in each word to be replaced with
|
|
.Ar new_pattern .
|
|
If a ``g'' is appended to the last slash of the pattern, all occurrences
|
|
in each word are replaced.
|
|
If
|
|
.Ar old_pattern
|
|
begins with a carat (``^''),
|
|
.Ar old_pattern
|
|
is anchored at the beginning of each word.
|
|
If
|
|
.Ar old_pattern
|
|
ends with a dollar sign (``$''), it is anchored at the end of each word.
|
|
Inside
|
|
.Ar new_string ,
|
|
an ampersand (``&'') is replaced by
|
|
.Ar old_pattern .
|
|
Any character may be used as a delimiter for the parts of the modifier
|
|
string.
|
|
The anchoring, ampersand and delimiter characters may be escaped with a
|
|
backslash (``\e'').
|
|
.Pp
|
|
Variable expansion occurs in the normal fashion inside both
|
|
.Ar old_string
|
|
and
|
|
.Ar new_string
|
|
with the single exception that a backslash is used to prevent the expansion
|
|
of a dollar sign (``$''), not a preceding dollar sign as is usual.
|
|
.Tp Cm T
|
|
Replaces each word in the variable with its last component.
|
|
.Tp Ar old_string=new_string
|
|
This is the System V style variable substitution.
|
|
It must be the last modifier specified.
|
|
.Ar Old_string
|
|
is anchored at the end of each word, so only suffixes or entire
|
|
words may be replaced.
|
|
.Tp
|
|
.Sh INCLUDE STATEMENTS AND CONDITIONALS
|
|
Makefile inclusion and conditional structures reminiscent of the C
|
|
programming language are provided in
|
|
.Nm make .
|
|
All such structures are identified by a line beginning with a single
|
|
dot (``.'') character.
|
|
Files are included with either ``.include <file>'' or ``.include "file"''.
|
|
Variables between the angle brackets or double quotes are expanded
|
|
to form the file name.
|
|
If angle brackets are used, the included makefile is expected to be in
|
|
the system makefile directory.
|
|
If double quotes are used, the including makefile's directory and any
|
|
directories specified using the
|
|
.Fl I
|
|
option are searched before the system
|
|
makefile directory.
|
|
.Pp
|
|
Conditional expressions are also preceded by a single dot as the first
|
|
chraracter of a line.
|
|
The possible conditionals are as follows:
|
|
.Tw Ds
|
|
.Tp Cx Ic \&.undef
|
|
.Cx \&\ \&
|
|
.Ar variable
|
|
.Cx
|
|
Un-define the specified global variable.
|
|
Only global variables may be un-defined.
|
|
.Tp Cx Ic \&.if
|
|
.Cx \&\ \&
|
|
.Op \&!
|
|
.Cx \&\ \&
|
|
.Ar expression
|
|
.Cx \&\ \&
|
|
.Op Ar operator expression ...
|
|
.Cx
|
|
Test the value of an expression.
|
|
.Tp Cx Ic \&.ifdef
|
|
.Cx \&\ \&
|
|
.Op \&!
|
|
.Ar variable
|
|
.Cx \&\ \&
|
|
.Op Ar operator variable ...
|
|
.Cx
|
|
Test the value of an variable.
|
|
.Tp Cx Ic \&.ifndef
|
|
.Cx \&\ \&
|
|
.Op \&!
|
|
.Cx \&\ \&
|
|
.Ar variable
|
|
.Cx \&\ \&
|
|
.Op Ar operator variable ...
|
|
.Cx
|
|
Test the value of an variable.
|
|
.Tp Cx Ic \&.ifmake
|
|
.Cx \&\ \&
|
|
.Op \&!
|
|
.Cx \&\ \&
|
|
.Ar target
|
|
.Cx \&\ \&
|
|
.Op Ar operator target ...
|
|
.Cx
|
|
Test the the target being built.
|
|
.Tp Cx Ic \&.ifnmake
|
|
.Cx \&\ \&
|
|
.Op \&!
|
|
.Ar target
|
|
.Cx \&\ \&
|
|
.Op Ar operator target ...
|
|
.Cx
|
|
Test the target being built.
|
|
.Tp Ic \&.else
|
|
Reverse the sense of the last conditional.
|
|
.Tp Cx Ic \&.elif
|
|
.Cx \&\ \&
|
|
.Op \&!
|
|
.Cx \&\ \&
|
|
.Ar expression
|
|
.Cx \&\ \&
|
|
.Op Ar operator expression ...
|
|
.Cx
|
|
A combination of ``.else'' followed by ``.if''.
|
|
.Tp Cx Ic \&.elifdef
|
|
.Cx \&\ \&
|
|
.Op \&!
|
|
.Cx \&\ \&
|
|
.Ar variable
|
|
.Cx \&\ \&
|
|
.Op Ar operator variable ...
|
|
.Cx
|
|
A combination of ``.else'' followed by ``.ifdef''.
|
|
.Tp Cx Ic \&.elifndef
|
|
.Cx \&\ \&
|
|
.Op \&!
|
|
.Cx \&\ \&
|
|
.Ar variable
|
|
.Cx \&\ \&
|
|
.Op Ar operator variable ...
|
|
.Cx
|
|
A combination of ``.else'' followed by ``.ifndef''.
|
|
.Tp Cx Ic \&.elifmake
|
|
.Cx \&\ \&
|
|
.Op \&!
|
|
.Cx \&\ \&
|
|
.Ar target
|
|
.Cx \&\ \&
|
|
.Op Ar operator target ...
|
|
.Cx
|
|
A combination of ``.else'' followed by ``.ifmake''.
|
|
.Tp Cx Ic \&.elifnmake
|
|
.Cx \&\ \&
|
|
.Op \&!
|
|
.Cx \&\ \&
|
|
.Ar target
|
|
.Cx \&\ \&
|
|
.Op Ar operator target ...
|
|
.Cx
|
|
A combination of ``.else'' followed by ``.ifnmake''.
|
|
.Tp Ic \&.endif
|
|
End the body of the conditional.
|
|
.Tp
|
|
.Pp
|
|
The
|
|
.Ar operator
|
|
may be any one of the following:
|
|
.Tp Cm \&|\&|
|
|
logical OR
|
|
.Tp Cm \&&&
|
|
Logical AND; of higher precedence than ``''.
|
|
.Tp
|
|
.Pp
|
|
As in C,
|
|
.Nm make
|
|
will only evaluate a conditional as far as is necessary to determine
|
|
its value.
|
|
Parenthesis may be used to change the order of evaluation.
|
|
The boolean operator ``!'' may be used to logically negate an entire
|
|
conditional.
|
|
It is of higher precendence than ``&&''.
|
|
.Pp
|
|
The value of
|
|
.Ar expression
|
|
may be any of the following:
|
|
.Tp Ic defined
|
|
Takes a variable name as an argument and evaluates to true if the variable
|
|
has been defined.
|
|
.Tp Ic make
|
|
Takes a target name as an argument and evaluates to true if the target
|
|
was specified as part of
|
|
.Cx Nm make
|
|
.Cx \'s
|
|
.Cx
|
|
command line or was declared the default target (either implicitly or
|
|
explicitly, see .MAIN) before the line containing the conditional.
|
|
.Tp Ic empty
|
|
Takes a variable, with possible modifiers, and evalutes to true if
|
|
the expansion of the variable would result in an empty string.
|
|
.Tp Ic exists
|
|
Takes a file name as an argument and evaluates to true if the file exists.
|
|
The file is searched for on the system search path (see .PATH).
|
|
.Tp Ic target
|
|
Takes a target name as an argument and evaluates to true if the target
|
|
has been defined.
|
|
.Tp
|
|
.Pp
|
|
.Ar Expression
|
|
may also be an arithmetic or string comparison, with the left-hand side
|
|
being a variable expansion.
|
|
The standard C relational operators are all supported, and the usual
|
|
number/base conversion is performed.
|
|
Note, octal numbers are not supported.
|
|
If the righthand value of a ``=='' or ``!='' operator begins with a
|
|
quotation mark (``"'') a string comparison is done between the expanded
|
|
variable and the text between the quotation marks.
|
|
If no relational operator is given, it is assumed that the expanded
|
|
variable is being compared against 0.
|
|
.Pp
|
|
When
|
|
.Nm make
|
|
is evaluating one of these conditional expression, and it encounters
|
|
a word it doesn't recognize, either the ``make'' or ``defined''
|
|
expression is applied to it, depending on the form of the conditional.
|
|
If the form is ``.ifdef'' or ``.ifndef'', the ``defined'' expression
|
|
is applied.
|
|
Similarly, if the form is ``.ifmake'' or ``.ifnmake'', the ``make''
|
|
expression is applied.
|
|
.Pp
|
|
If the conditional evaluates to true the parsing of the makefile continues
|
|
as before.
|
|
If it evaluates to false, the following lines are skipped.
|
|
In both cases this continues until a ``.else'' or ``.endif'' is found.
|
|
.Sh COMMENTS
|
|
Comments begin with a hash (``#'') character, anywhere but in a shell
|
|
command line, and continue to the end of the line.
|
|
.Sh SPECIAL SOURCES
|
|
.Tp Ic \&.IGNORE
|
|
Ignore any errors from the commands associated with this target, exactly
|
|
as if they all were preceded by a dash (``\-'').
|
|
.Tp Ic \&.MAKE
|
|
Execute the commands associated with this target even if the -n or -t
|
|
options were specified.
|
|
Normally used to mark recursive
|
|
.Cx Nm make
|
|
.Cx \'s .
|
|
.Cx
|
|
.Tp Ic \&.NOTMAIN
|
|
Normally
|
|
.Nm make
|
|
selects the first target it encounters as the default target to be built
|
|
if no target was specified.
|
|
This source prevents this target from being selected.
|
|
.Tp Ic \&.OPTIONAL
|
|
If a target is marked with this attribute and
|
|
.Nm make
|
|
can't figure out how to create it, it will ignore this fact and assume
|
|
the file isn't needed or already exists.
|
|
.Tp Ic \&.PRECIOUS
|
|
When
|
|
.Nm make
|
|
is interrupted, it removes any partially made targets.
|
|
This source prevents the target from being removed.
|
|
.Tp Ic \&.SILENT
|
|
Do not echo any of the commands associated with this target, exactly
|
|
as if they all were preceded by an at sign (``@'').
|
|
.Tp Ic \&.USE
|
|
Turn the target into
|
|
.Cx Nm make
|
|
.Cx \'s .
|
|
.Cx
|
|
version of a macro.
|
|
When the target is used as a source for another target, the other target
|
|
acquires the commands, sources, and attributes (except for .USE) of the
|
|
source.
|
|
If the target already has commands, the .USE target's commands are appended
|
|
to them.
|
|
.Tp
|
|
.Sh "SPECIAL TARGETS"
|
|
Special targets may not be included with other targets, i.e. they must be
|
|
the only target specified.
|
|
.Tp Ic \&.BEGIN
|
|
Any command lines attached to this target are executed before anything
|
|
else is done.
|
|
.Tp Ic \&.DEFAULT
|
|
This is sort of a .USE rule for any target (that was used only as a
|
|
source) that
|
|
.Nm make
|
|
can't figure out any other way to create.
|
|
Only the shell script is used.
|
|
The .IMPSRC variable of a target that inherits .DEFAULT's commands is set
|
|
to the target's own name.
|
|
.Tp Ic \&.END
|
|
Any command lines attached to this target are executed after everything
|
|
else is done.
|
|
.Tp Ic \&.IGNORE
|
|
Mark each of the sources with the .IGNORE attribute.
|
|
If no sources are specified, this is the equivalent of specifying the -i
|
|
option.
|
|
.Tp Ic \&.INTERRUPT
|
|
If
|
|
.Nm make
|
|
is interrupted, the commands for this target will be executed.
|
|
.Tp Ic \&.MAIN
|
|
If no target is specified when
|
|
.Nm make
|
|
is invoked, this target will be built.
|
|
.Tp Ic \&.MAKEFLAGS
|
|
This target provides a way to specify flags for
|
|
.Nm make
|
|
when the makefile is used.
|
|
The flags are as if typed to the shell, though the -f option will have
|
|
no effect.
|
|
.Tp Ic \&.PATH
|
|
The sources are directories which are to be searched for files not
|
|
found in the current directory.
|
|
If no sources are specified, any previously specified directories are
|
|
deleted.
|
|
.Tp Ic \&.PRECIOUS
|
|
Apply the .PRECIOUS attribute to any specified sources.
|
|
If no sources are specified, the .PRECIOUS attribute is applied to every
|
|
target in the file.
|
|
.Tp Ic \&.SILENT
|
|
Apply the .SILENT attribute to any specified sources.
|
|
If no sources are specified, the .SILENT attribute is applied to every
|
|
command in the file.
|
|
.Tp Ic \&.SUFFIXES
|
|
Each source specifies a suffix to
|
|
.Nm make .
|
|
If no sources are specified, any previous specifies suffices are deleted.
|
|
.Sh ENVIRONMENT
|
|
.Nm Make
|
|
utilizes the following environment variables, if they exist:
|
|
.Ev MAKE ,
|
|
.Ev MAKEFLAGS
|
|
and
|
|
.Ev MAKEOBJDIR .
|
|
.Sh FILES
|
|
.Dw /usr/share/mk
|
|
.Di L
|
|
.Dp /usr/share/mk
|
|
system makefile directory
|
|
.Dp .depend
|
|
list of dependencies
|
|
.Dp Makefile
|
|
list of dependencies
|
|
.Dp makefile
|
|
list of dependencies
|
|
.Dp sys.mk
|
|
system makefile
|
|
.Dp
|
|
.Sh SEE ALSO
|
|
.Xr mkdep 1
|
|
.Sh HISTORY
|
|
.Nm Make
|
|
appeared in Version 7 AT&T UNIX.
|