version 1.8, 1996/09/21 10:53:48 |
version 1.9, 1996/11/30 21:08:59 |
|
|
.\" $OpenBSD$ |
.\" $OpenBSD$ |
.\" $NetBSD: make.1,v 1.15 1996/08/30 17:59:40 thorpej Exp $ |
.\" $NetBSD: make.1,v 1.16 1996/11/06 17:59:13 christos Exp $ |
.\" |
.\" |
.\" Copyright (c) 1990 The Regents of the University of California. |
.\" Copyright (c) 1990, 1993 |
.\" All rights reserved. |
.\" The Regents of the University of California. All rights reserved. |
.\" |
.\" |
.\" Redistribution and use in source and binary forms, with or without |
.\" Redistribution and use in source and binary forms, with or without |
.\" modification, are permitted provided that the following conditions |
.\" modification, are permitted provided that the following conditions |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
.\" SUCH DAMAGE. |
.\" SUCH DAMAGE. |
.\" |
.\" |
.\" from: @(#)make.1 5.7 (Berkeley) 7/24/91 |
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 |
.\" |
.\" |
.Dd July 24, 1991 |
.Dd March 19, 1994 |
.Dt MAKE 1 |
.Dt MAKE 1 |
.Os |
.Os |
.Sh NAME |
.Sh NAME |
|
|
.Nd maintain program dependencies |
.Nd maintain program dependencies |
.Sh SYNOPSIS |
.Sh SYNOPSIS |
.Nm make |
.Nm make |
.Op Fl Beiknqrstv |
.Op Fl Beiknqrst |
.Op Fl D Ar variable |
.Op Fl D Ar variable |
.Op Fl d Ar flags |
.Op Fl d Ar flags |
.Op Fl f Ar makefile |
.Op Fl f Ar makefile |
|
|
.Op Fl j Ar max_jobs |
.Op Fl j Ar max_jobs |
.Op Fl m Ar directory |
.Op Fl m Ar directory |
.Ek |
.Ek |
|
.Op Fl V Ar variable |
.Op Ar variable=value |
.Op Ar variable=value |
.Op Ar target ... |
.Op Ar target ... |
.Sh DESCRIPTION |
.Sh DESCRIPTION |
|
|
.Pp |
.Pp |
The options are as follows: |
The options are as follows: |
.Bl -tag -width Ds |
.Bl -tag -width Ds |
.It Fl B |
.It Fl B |
Try to be backwards compatible by executing a single shell per command and |
Try to be backwards compatible by executing a single shell per command and |
by executing the commands to make the sources of a dependency line in sequence. |
by executing the commands to make the sources of a dependency line in sequence. |
.It Fl D Ar variable |
.It Fl D Ar variable |
|
|
.It Fl j Ar max_jobs |
.It Fl j Ar max_jobs |
Specify the maximum number of jobs that |
Specify the maximum number of jobs that |
.Nm make |
.Nm make |
may have running at any one time. Turns compatibility mode off, unless the |
may have running at any one time. Turns compatibility mode off, unless the |
.Ar B |
.Ar B |
flag is also specified. |
flag is also specified. |
.It Fl k |
.It Fl k |
|
|
.It Fl t |
.It Fl t |
Rather than re-building a target as specified in the makefile, create it |
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. |
or update its modification time to make it appear up-to-date. |
|
.It Fl V Ar variable |
|
Print |
|
.Nm make Ns 's |
|
idea of the value of |
|
.Ar variable , |
|
in the global context. |
|
Do not build any targets. |
|
Multiple instances of this option may be specified; |
|
the variables will be printed one per line, |
|
with a blank line for each null or undefined variable. |
.It Ar variable=value |
.It Ar variable=value |
Set the value of the variable |
Set the value of the variable |
.Ar variable |
.Ar variable |
|
|
entered into the environment for all programs which |
entered into the environment for all programs which |
.Nm make |
.Nm make |
executes. |
executes. |
|
.It Ev PWD |
|
Alternate path to the current directory. |
|
.Nm make |
|
normally sets |
|
.Ql Va .CURDIR |
|
to the canonical path given by |
|
.Xr getcwd 2 . |
|
However, if the environment variable |
|
.Ql Ev PWD |
|
is set and gives a path to the current directory, then |
|
.Nm make |
|
sets |
|
.Ql Va .CURDIR |
|
to the value of |
|
.Ql Ev PWD |
|
instead. |
|
.Ql Ev PWD |
|
is set to the value of |
|
.Ql Va .OBJDIR |
|
for all programs which |
|
.Nm make |
|
executes. |
.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 |
|
|
.At V |
.At V |
style variable substitution. |
style variable substitution. |
It must be the last modifier specified. |
It must be the last modifier specified. |
If |
If |
.Ar old_string |
.Ar old_string |
or |
or |
.Ar new_string |
.Ar new_string |
do not contain the pattern matching character |
do not contain the pattern matching character |
.Ar % |
.Ar % |
then it is assumed that they are |
then it is assumed that they are |
anchored at the end of each word, so only suffixes or entire |
anchored at the end of each word, so only suffixes or entire |
words may be replaced. Otherwise |
words may be replaced. Otherwise |
.Ar % |
.Ar % |
is the substring of |
is the substring of |
.Ar old_string |
.Ar old_string |
to be replaced in |
to be replaced in |
.Ar new_string |
.Ar new_string |
.El |
.El |
.Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS |
.Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS |
Makefile inclusion, conditional structures and for loops reminiscent |
Makefile inclusion, conditional structures and for loops reminiscent |
of the C programming language are provided in |
of the C programming language are provided in |
.Nm make . |
.Nm make . |
All such structures are identified by a line beginning with a single |
All such structures are identified by a line beginning with a single |
|
|
.Nm make |
.Nm make |
will only evaluate a conditional as far as is necessary to determine |
will only evaluate a conditional as far as is necessary to determine |
its value. |
its value. |
Parenthesis may be used to change the order of evaluation. |
Parentheses may be used to change the order of evaluation. |
The boolean operator |
The boolean operator |
.Ql Ic \&! |
.Ql Ic \&! |
may be used to logically negate an entire |
may be used to logically negate an entire |
|
|
or |
or |
.Ql Ic .endif |
.Ql Ic .endif |
is found. |
is found. |
.Pp |
.Pp |
For loops are typically used to apply a set of rules to a list of files. |
For loops are typically used to apply a set of rules to a list of files. |
The syntax of a for loop is: |
The syntax of a for loop is: |
.Bl -tag -width Ds |
.Bl -tag -width Ds |
.It Xo |
.It Xo |
.Ic \&.for |
.Ic \&.for |
.Ar variable |
.Ar variable |
.Ic in |
.Ic in |
.Ar expression |
.Ar expression |
.Xc |
.Xc |
.It Xo |
.It Xo |
|
|
.Xc |
.Xc |
.El |
.El |
After the for |
After the for |
.Ic expression |
.Ic expression |
is evaluated, it is split into words. The |
is evaluated, it is split into words. The |
iteration |
iteration |
.Ic variable |
.Ic 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. |
.Sh COMMENTS |
.Sh COMMENTS |
Comments begin with a hash |
Comments begin with a hash |
|
|
.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 MAKE , |
.Ev MAKE , |
.Ev MAKEFLAGS |
.Ev MAKEFLAGS , |
|
.Ev MAKEOBJDIR , |
and |
and |
.Ev MAKEOBJDIR . |
.Ev PWD . |
.Sh FILES |
.Sh FILES |
.Bl -tag -width /usr/share/mk -compact |
.Bl -tag -width /usr/share/mk -compact |
.It .depend |
.It .depend |