version 1.27, 2000/01/19 17:28:52 |
version 1.28, 2000/03/10 19:07:21 |
|
|
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. |
If the file |
If the file |
.Ql Pa BSDmakefile |
.Pa BSDmakefile |
exists, it is read for this list of specifications. |
exists, it is read for this list of specifications. |
If it does not exist, the files |
If it does not exist, the files |
.Ql Pa makefile |
.Pa makefile |
and |
and |
.Ql Pa Makefile |
.Pa Makefile |
are tried in order. |
are tried in order. |
If the file |
If the file |
.Ql Pa .depend |
.Pa .depend |
exists, it is read (see |
exists, it is read (see |
.Xr mkdep 1) . |
.Xr mkdep 1) . |
.Pp |
.Pp |
|
|
.It Ar d |
.It Ar d |
Print debugging information about directory searching and caching. |
Print debugging information about directory searching and caching. |
.It Ar f |
.It Ar f |
Print debugging information about the execution of for loops. Currently a |
Print debugging information about the execution of for loops. |
no-op. |
Currently a no-op. |
.It Ar "g1" |
.It Ar "g1" |
Print the input graph before making anything. |
Print the input graph before making anything. |
.It Ar "g2" |
.It Ar "g2" |
|
|
makefiles. |
makefiles. |
.It Fl f Ar makefile |
.It Fl f Ar makefile |
Specify a makefile to read instead of the default |
Specify a makefile to read instead of the default |
.Ql Pa makefile |
.Pa makefile |
and |
and |
.Ql Pa Makefile . |
.Pa Makefile . |
If |
If |
.Ar makefile |
.Ar makefile |
is |
is |
|
|
.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 |
.Nm |
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 |
|
|
that do not depend on the target whose creation caused the error. |
that do not depend on the target whose creation caused the error. |
.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: |
This path will override the default system include path: |
.Pa /usr/share/mk . |
.Pa /usr/share/mk . |
Furthermore, the system include path will be appended to the search path used |
Furthermore, the system include path will be appended to the search path used |
|
|
.It Fl r |
.It Fl r |
Do not use the built-in rules specified in the system makefile. |
Do not use the built-in rules specified in the system makefile. |
.It Fl S |
.It Fl S |
Stop processing when an error is encountered. Default |
Stop processing when an error is encountered. |
behavior. This is needed to negate the |
Default behavior. |
|
This is needed to negate the |
.Fl k |
.Fl k |
option during recursive builds. |
option during recursive builds. |
.It Fl s |
.It Fl s |
|
|
is defined, |
is defined, |
.Nm |
.Nm |
prepends its contents to the current directory name and tries for |
prepends its contents to the current directory name and tries for |
the resulting directory. If that fails, |
the resulting directory. |
|
If that fails, |
.Nm |
.Nm |
remains in the current directory. |
remains in the current directory. |
If |
If |
|
|
.Nm |
.Nm |
checks |
checks |
.Ev MAKEOBJDIR |
.Ev MAKEOBJDIR |
and tries to change into that directory. Should that fail, |
and tries to change into that directory. |
|
Should that fail, |
.Nm |
.Nm |
remains in the current directory. If |
remains in the current directory. |
|
If |
.Ev MAKEOBJDIR |
.Ev MAKEOBJDIR |
is not defined, it tries to change into the directory named |
is not defined, it tries to change into the directory named |
.Pa obj.${MACHINE} |
.Pa obj.${MACHINE} |
(see |
(see |
.Va MACHINE |
.Va MACHINE |
variable). If it still has found no special directory, |
variable). |
|
If it still has found no special directory, |
.Nm |
.Nm |
next tries the directory named |
next tries the directory named |
.Pa obj . |
.Pa obj . |
|
|
may contain anything that |
may contain anything that |
may be specified on |
may be specified on |
.Nm make Ns 's |
.Nm make Ns 's |
command line. Its contents are stored in |
command line. |
|
Its contents are stored in |
.Nm make Ns 's |
.Nm make Ns 's |
.Va .MAKEFLAGS |
.Va .MAKEFLAGS |
variable. |
variable. |
|
|
.Xr regex 3 ) |
.Xr regex 3 ) |
and an |
and an |
.Xr ed 1 Ns \-style |
.Xr ed 1 Ns \-style |
replacement string. Normally, the first occurrence of the pattern in |
replacement string. |
each word of the value is changed. The |
Normally, the first occurrence of the pattern in |
|
each word of the value is changed. |
|
The |
.Ql 1 |
.Ql 1 |
modifier causes the substitution to apply to at most one word; the |
modifier causes the substitution to apply to at most one word; the |
.Ql g |
.Ql g |
modifier causes the substitution to apply to as many instances of the |
modifier causes the substitution to apply to as many instances of the |
search pattern as occur in the word or words it is found in. Note that |
search pattern as occur in the word or words it is found in. |
|
Note that |
.Ql 1 |
.Ql 1 |
and |
and |
.Ql g |
.Ql g |
|
|
.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 |
|
|
.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 |
|
|
.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 |
preceded by 0x, otherwise it is decimal; octal numbers are not supported. |
preceded by 0x, otherwise it is decimal; octal numbers are not supported. |
The standard C relational operators are all supported. If after |
The standard C relational operators are all supported. |
|
If after |
variable expansion, either the left or right hand side of a |
variable expansion, either the left or right hand side of a |
.Ql Ic == |
.Ql Ic == |
or |
or |
|
|
.El |
.El |
After the for |
After the for |
.Ar expression |
.Ar expression |
is evaluated, it is split into words. The |
is evaluated, it is split into words. |
iteration |
The iteration |
.Ar 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 |
|
|
If special |
If special |
.Ic .WAIT |
.Ic .WAIT |
source is appears in a dependency line, the sources that precede it are |
source is appears in a dependency line, the sources that precede it are |
made before the sources that succeed it in the line. Loops are not being |
made before the sources that succeed it in the line. |
|
Loops are not being |
detected and targets that form loops will be silently ignored. |
detected and targets that form loops will be silently ignored. |
.El |
.El |
.Sh "SPECIAL TARGETS" |
.Sh "SPECIAL TARGETS" |
|
|
option. |
option. |
.It Ic .INCLUDES |
.It Ic .INCLUDES |
A list of suffixes that indicate files that can be included in a source |
A list of suffixes that indicate files that can be included in a source |
file. The suffix must have already been declared with |
file. |
|
The suffix must have already been declared with |
.Ic .SUFFIXES , |
.Ic .SUFFIXES , |
any suffix so declared will have the directories on its search path (see |
any suffix so declared will have the directories on its search path (see |
.Ic .PATH ) |
.Ic .PATH ) |
|
|
.It Ic .MAIN |
.It Ic .MAIN |
If no target is specified when |
If no target is specified when |
.Nm |
.Nm |
is invoked, this target will be built. This is always set, either |
is invoked, this target will be built. |
|
This is always set, either |
explicitly, or implicitly when |
explicitly, or implicitly when |
.Nm |
.Nm |
selects the default target, to give the user a way to refer to the default |
selects the default target, to give the user a way to refer to the default |
|
|
.It Ic .PHONY |
.It Ic .PHONY |
Apply the |
Apply the |
.Ic .PHONY |
.Ic .PHONY |
attribute to any specified sources. Targets with this attribute are always |
attribute to any specified sources. |
|
Targets with this attribute are always |
considered to be out of date. |
considered to be out of date. |
.It Ic .PRECIOUS |
.It Ic .PRECIOUS |
Apply the |
Apply the |
|
|
.Pp |
.Pp |
The evaluation of |
The evaluation of |
.Ar expression |
.Ar expression |
in a test is very simple-minded. Currently, the only form that works is |
in a test is very simple-minded. |
|
Currently, the only form that works is |
.Ql .if ${VAR} op something |
.Ql .if ${VAR} op something |
For instance, you should write tests as |
For instance, you should write tests as |
.Ql .if ${VAR} = "string" |
.Ql .if ${VAR} = "string" |
|
|
Variable handling is incredibly inefficient. |
Variable handling is incredibly inefficient. |
.Pp |
.Pp |
The handling of ; and other special characters in tests may be utterly |
The handling of ; and other special characters in tests may be utterly |
bogus. For instance, in |
bogus. |
|
For instance, in |
.Bd -literal |
.Bd -literal |
\&A=abcd;c.c |
\&A=abcd;c.c |
\&.if ${A:R} == "abcd;c" |
\&.if ${A:R} == "abcd;c" |
|
|
.Pp |
.Pp |
the test will never match, even though the value is correct. |
the test will never match, even though the value is correct. |
.Pp |
.Pp |
The conditional handler is incredibly lame. Junk such as |
The conditional handler is incredibly lame. |
|
Junk such as |
.Bd -literal |
.Bd -literal |
\&.if defined anything goes (A) |
\&.if defined anything goes (A) |
.Ed |
.Ed |
|
|
A will evaluate to a b c d after the loop, not z b c d. |
A will evaluate to a b c d after the loop, not z b c d. |
.Sh SEE ALSO |
.Sh SEE ALSO |
.Xr mkdep 1 |
.Xr mkdep 1 |
|
.Pp |
|
.%T "Make \- A Tutorial" . |
.Sh HISTORY |
.Sh HISTORY |
A |
A |
.Nm |
.Nm |