version 1.13, 1998/09/05 17:41:47 |
version 1.14, 1998/09/26 19:55:05 |
|
|
.Op Ar variable=value |
.Op Ar variable=value |
.Op Ar target ... |
.Op Ar target ... |
.Sh DESCRIPTION |
.Sh DESCRIPTION |
.Nm Make |
.Nm make |
is a program designed to simplify the maintenance of other programs. |
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 |
Its input is a list of specifications as to the files upon which programs |
and other files depend. |
and other files depend. |
|
|
Turn on debugging, and specify which portions of |
Turn on debugging, and specify which portions of |
.Nm make |
.Nm make |
are to print debugging information. |
are to print debugging information. |
.Ar Flags |
.Ar flags |
is one or more of the following: |
is one or more of the following: |
.Bl -tag -width Ds |
.Bl -tag -width Ds |
.It Ar A |
.It Ar A |
|
|
is |
is |
.Ql Fl , |
.Ql Fl , |
standard input is read. |
standard input is read. |
Multiple makefile's may be specified, and are read in the order specified. |
Multiple makefiles may be specified, and are read in the order specified. |
.It Fl I Ar directory |
.It Fl I Ar directory |
Specify a directory in which to search for makefiles and included makefiles. |
Specify a directory in which to search for makefiles and included makefiles. |
The system makefile directory (or directories, see the |
The system makefile directory (or directories, see the |
|
|
.It Fl m Ar directory |
.It Fl m Ar directory |
Specify a directory in which to search for sys.mk and makefiles included |
Specify a directory in which to search for sys.mk and makefiles included |
via the <...> style. Multiple directories can be added to form a search path. |
via the <...> style. Multiple directories can be added to form a search path. |
This path will override the default system include path: /usr/share/mk. |
This path will override the default system include path: |
Furthermore the system include path will be appended to the search path used |
.Pa /usr/share/mk . |
|
Furthermore, the system include path will be appended to the search path used |
for "..."-style inclusions (see the |
for "..."-style inclusions (see the |
.Fl I |
.Fl I |
option). |
option). |
|
|
.Ql Ic \- |
.Ql Ic \- |
causes any non-zero exit status of the command line to be ignored. |
causes any non-zero exit status of the command line to be ignored. |
.Sh VARIABLE ASSIGNMENTS |
.Sh VARIABLE ASSIGNMENTS |
Variables in make are much like variables in the shell, and, by tradition, |
Variables in |
|
.Nm make |
|
are much like variables in the shell, and, by tradition, |
consist of all upper-case letters. |
consist of all upper-case letters. |
The five operators that can be used to assign values to variables are as |
The five operators that can be used to assign values to variables are as |
follows: |
follows: |
|
|
Any newlines in the result are replaced with spaces. |
Any newlines in the result are replaced with spaces. |
.El |
.El |
.Pp |
.Pp |
Any white-space before the assigned |
Any whitespace before the assigned |
.Ar value |
.Ar value |
is removed; if the value is being appended, a single space is inserted |
is removed; if the value is being appended, a single space is inserted |
between the previous contents of the variable and the appended value. |
between the previous contents of the variable and the appended value. |
|
|
The shorter forms |
The shorter forms |
.Ql Va @ , |
.Ql Va @ , |
.Ql Va ? , |
.Ql Va ? , |
.Ql Va \&> |
.Ql Va \&> , |
and |
and |
.Ql Va * |
.Ql Va * |
are permitted for backward |
are permitted for backward |
|
|
.Ql Va "@D" , |
.Ql Va "@D" , |
.Ql Va "<F" , |
.Ql Va "<F" , |
.Ql Va "<D" , |
.Ql Va "<D" , |
.Ql Va "*F" |
.Ql Va "*F" , |
and |
and |
.Ql Va "*D" |
.Ql Va "*D" |
are |
are |
|
|
The name that |
The name that |
.Nm make |
.Nm make |
was executed with |
was executed with |
.Pq Va argv Op 0 |
.Pq Va argv Ns Op 0 . |
.It Va .CURDIR |
.It Va .CURDIR |
A path to the directory where |
A path to the directory where |
.Nm make |
.Nm make |
|
|
will settle for and use the current directory. |
will settle for and use the current directory. |
.It Ev MAKEFLAGS |
.It Ev MAKEFLAGS |
The environment variable |
The environment variable |
.Ql Ev MAKEFLAGS |
.Ev MAKEFLAGS |
may contain anything that |
may contain anything that |
may be specified on |
may be specified on |
.Nm make Ns 's |
.Nm make Ns 's |
|
|
Anything specified on |
Anything specified on |
.Nm make Ns 's |
.Nm make Ns 's |
command line is appended to the |
command line is appended to the |
.Ql Ev MAKEFLAGS |
.Ev MAKEFLAGS |
variable which is then |
variable which is then |
entered into the environment for all programs which |
entered into the environment for all programs which |
.Nm make |
.Nm make |
|
|
to the canonical path given by |
to the canonical path given by |
.Xr getcwd 2 . |
.Xr getcwd 2 . |
However, if the environment variable |
However, if the environment variable |
.Ql Ev PWD |
.Ev PWD |
is set and gives a path to the current directory, then |
is set and gives a path to the current directory, then |
.Nm make |
.Nm make |
sets |
sets |
.Ql Va .CURDIR |
.Ql Va .CURDIR |
to the value of |
to the value of |
.Ql Ev PWD |
.Ev PWD |
instead. |
instead. |
.Ql Ev PWD |
.Ev PWD |
is set to the value of |
is set to the value of |
.Ql Va .OBJDIR |
.Ql Va .OBJDIR |
for all programs which |
for all programs which |
|
|
.El |
.El |
.Pp |
.Pp |
Variable expansion may be modified to select or modify each word of the |
Variable expansion may be modified to select or modify each word of the |
variable (where a ``word'' is white-space delimited sequence of characters). |
variable (where a ``word'' is whitespace delimited sequence of characters). |
The general format of a variable expansion is as follows: |
The general format of a variable expansion is as follows: |
.Pp |
.Pp |
.Dl {variable[:modifier[:...]]} |
.Dl {variable[:modifier[:...]]} |
|
|
.Pq Ql \e . |
.Pq Ql \e . |
.It Cm N Ns Ar pattern |
.It Cm N Ns Ar pattern |
This is identical to |
This is identical to |
.Ql Cm M , |
.Cm M , |
but selects all words which do not match |
but selects all words which do not match |
the rest of the modifier. |
the rest of the modifier. |
.It Cm Q |
.It Cm Q |
Quotes every shell meta-character in the variable, so that it can be passed |
Quotes every shell meta-character in the variable, so that it can be passed |
safely through recursive invocations of |
safely through recursive invocations of |
.Nm . |
.Nm make . |
.It Cm R |
.It Cm R |
Replaces each word in the variable with everything but its suffix. |
Replaces each word in the variable with everything but its suffix. |
.Sm off |
.Sm off |
|
|
has been defined. |
has been defined. |
.El |
.El |
.Pp |
.Pp |
.Ar Expression |
.Ar expression |
may also be an arithmetic or string comparison. Variable expansion is |
may also be an arithmetic or string comparison. Variable expansion is |
performed on both sides of the comparison, after which the integral |
performed on both sides of the comparison, after which the integral |
values are compared. A value is interpreted as hexadecimal if it is |
values are compared. A value is interpreted as hexadecimal if it is |
|
|
.Pp |
.Pp |
When |
When |
.Nm make |
.Nm make |
is evaluating one of these conditional expression, and it encounters |
is evaluating one of these conditional expressions, and it encounters |
a word it doesn't recognize, either the ``make'' or ``defined'' |
a word it doesn't recognize, either the ``make'' or ``defined'' |
expression is applied to it, depending on the form of the conditional. |
expression is applied to it, depending on the form of the conditional. |
If the form is |
If the form is |
|
|
Similarly, if the form is |
Similarly, if the form is |
.Ql Ic .ifmake |
.Ql Ic .ifmake |
or |
or |
.Ql Ic .ifnmake , the ``make'' |
.Ql Ic .ifnmake , |
|
the ``make'' |
expression is applied. |
expression is applied. |
.Pp |
.Pp |
If the conditional evaluates to true the parsing of the makefile continues |
If the conditional evaluates to true the parsing of the makefile continues |
|
|
.Xc |
.Xc |
.El |
.El |
After the for |
After the for |
.Ic expression |
.Ar expression |
is evaluated, it is split into words. The |
is evaluated, it is split into words. The |
iteration |
iteration |
.Ic variable |
.Ar variable |
is successively set to each word, and substituted in the |
is successively set to each word, and substituted in the |
.Ic make-rules |
.Ic make-rules |
inside the body of the for loop. |
inside the body of the for loop. |
|
|
.Pq Ql @ . |
.Pq Ql @ . |
.It Ic .USE |
.It Ic .USE |
Turn the target into |
Turn the target into |
.Nm make Ns 's . |
.Nm make Ns 's |
version of a macro. |
version of a macro. |
When the target is used as a source for another target, the other target |
When the target is used as a source for another target, the other target |
acquires the commands, sources, and attributes (except for |
acquires the commands, sources, and attributes (except for |
|
|
.Nm make . |
.Nm make . |
If no sources are specified, any previous specified suffices are deleted. |
If no sources are specified, any previous specified suffices are deleted. |
.Sh ENVIRONMENT |
.Sh ENVIRONMENT |
.Nm Make |
.Nm make |
utilizes the following environment variables, if they exist: |
utilizes the following environment variables, if they exist: |
.Ev MACHINE , |
.Ev MACHINE , |
.Ev MAKE , |
.Ev MAKE , |
|
|
.Ev PWD . |
.Ev PWD . |
.Sh FILES |
.Sh FILES |
.Bl -tag -width /usr/share/mk -compact |
.Bl -tag -width /usr/share/mk -compact |
.It .depend |
.It Pa .depend |
list of dependencies |
list of dependencies |
.It Makefile |
.It Pa Makefile |
list of dependencies |
list of dependencies |
.It makefile |
.It Pa makefile |
list of dependencies |
list of dependencies |
.It sys.mk |
.It Pa sys.mk |
system makefile |
system makefile |
.It /usr/share/mk |
.It Pa /usr/share/mk |
system makefile directory |
system makefile directory |
.El |
.El |
.Sh SEE ALSO |
.Sh SEE ALSO |
.Xr mkdep 1 |
.Xr mkdep 1 |
.Sh HISTORY |
.Sh HISTORY |
A |
A |
.Nm Make |
.Nm make |
command appeared in |
command appeared in |
.At v7 . |
.At v7 . |