version 1.53, 2003/06/27 22:01:42 |
version 1.54, 2003/07/14 12:29:22 |
|
|
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 |
.Sq 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 |
.Sq Pa makefile |
and |
and |
.Ql Pa Makefile |
.Sq Pa Makefile |
are tried in order. |
are tried in order. |
If the file |
If the file |
.Ql Pa .depend |
.Sq Pa .depend |
exists, it is read in addition to the makefile (see |
exists, it is read in addition to the makefile (see |
.Xr mkdep 1 ) . |
.Xr mkdep 1 ) . |
.Pp |
.Pp |
The handling of |
The handling of |
.Ql Pa BSDmakefile |
.Sq Pa BSDmakefile |
and |
and |
.Ql Pa .depend |
.Sq Pa .depend |
are BSD extensions. |
are BSD extensions. |
.Pp |
.Pp |
Standard options are as follows: |
Standard options are as follows: |
|
|
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 |
.Sq Pa makefile |
and |
and |
.Ql Pa Makefile . |
.Sq Pa Makefile . |
If |
If |
.Ar makefile |
.Ar makefile |
is |
is |
|
|
.It Fl s |
.It Fl s |
Do not echo commands as they are executed. |
Do not echo commands as they are executed. |
Equivalent to specifying |
Equivalent to specifying |
.Ql Ic @ |
.Sq Ic @ |
before each command line in the makefile. |
before each command line in the makefile. |
.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 |
|
|
be preceded by a tab. |
be preceded by a tab. |
While any target may appear on a dependency line, only one of these |
While any target may appear on a dependency line, only one of these |
dependencies may be followed by a creation script, unless the |
dependencies may be followed by a creation script, unless the |
.Ql Ic :: |
.Sq Ic :: |
operator is used. |
operator is used. |
.Pp |
.Pp |
If a command line begins with a combination of the characters, |
If a command line begins with a combination of the characters, |
.Ql Ic @ , |
.Sq Ic @ , |
.Ql Ic \- |
.Sq Ic \- |
and/or |
and/or |
.Ql Ic + , |
.Sq Ic + , |
the command is treated specially. |
the command is treated specially. |
.Bl -tag -width `@' |
.Bl -tag -width `@' |
.It Ql Ic @ |
.It Sq Ic @ |
causes the command not to be echoed before it is executed. |
causes the command not to be echoed before it is executed. |
.It Ql Ic \- |
.It Sq 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. |
.It Ql Ic + |
.It Sq Ic + |
causes the command to be executed even if |
causes the command to be executed even if |
.Fl n |
.Fl n |
has been specified (This can be useful to debug recursive Makefiles). |
has been specified (This can be useful to debug recursive Makefiles). |
|
|
.El |
.El |
.Pp |
.Pp |
The six variables |
The six variables |
.Ql Va "@F" , |
.Sq Va "@F" , |
.Ql Va "@D" , |
.Sq Va "@D" , |
.Ql Va "<F" , |
.Sq Va "<F" , |
.Ql Va "<D" , |
.Sq Va "<D" , |
.Ql Va "*F" , |
.Sq Va "*F" , |
and |
and |
.Ql Va "*D" |
.Sq Va "*D" |
yield the |
yield the |
.Qq filename |
.Qq filename |
and |
and |
|
|
parts of the corresponding macros. |
parts of the corresponding macros. |
.Pp |
.Pp |
For maximum compatibility, |
For maximum compatibility, |
.Ql Va \&< |
.Sq Va \&< |
should only be used for actual implied rules. |
should only be used for actual implied rules. |
It is also set when there is an implied rule that matches the current |
It is also set when there is an implied rule that matches the current |
dependency in scope. That is, in |
dependency in scope. |
|
That is, in |
.Bd -literal |
.Bd -literal |
\&.SUFFIXES: .c.o |
\&.SUFFIXES: .c.o |
file.o: file.c |
file.o: file.c |
|
|
The list of all sources for this target. |
The list of all sources for this target. |
.It Va .ALLSRC |
.It Va .ALLSRC |
Synonym for |
Synonym for |
.Ql Va \&> . |
.Sq Va \&> . |
.It Va .ARCHIVE |
.It Va .ARCHIVE |
Synonym for |
Synonym for |
.Ql Va \&! . |
.Sq Va \&! . |
.It Va .IMPSRC |
.It Va .IMPSRC |
Synonym for |
Synonym for |
.Ql Va \&< . |
.Sq Va \&< . |
.It Va .MEMBER |
.It Va .MEMBER |
Synonym for |
Synonym for |
.Ql Va \&% . |
.Sq Va \&% . |
.It Va .OODATE |
.It Va .OODATE |
Synonym for |
Synonym for |
.Ql Va \&? . |
.Sq Va \&? . |
.It Va .PREFIX |
.It Va .PREFIX |
Synonym for |
Synonym for |
.Ql Va * . |
.Sq Va * . |
.It Va .TARGET |
.It Va .TARGET |
Synonym for |
Synonym for |
.Ql Va @ . |
.Sq Va @ . |
.El |
.El |
.Pp |
.Pp |
These variables may be used on the dependency half of dependency |
These variables may be used on the dependency half of dependency |
|
|
Alternate path to the current directory. |
Alternate path to the current directory. |
.Nm |
.Nm |
normally sets |
normally sets |
.Ql Va .CURDIR |
.Sq Va .CURDIR |
to the canonical path given by |
to the canonical path given by |
.Xr getcwd 3 . |
.Xr getcwd 3 . |
However, if the environment variable |
However, if the environment variable |
|
|
is set and gives a path to the current directory, then |
is set and gives a path to the current directory, then |
.Nm |
.Nm |
sets |
sets |
.Ql Va .CURDIR |
.Sq Va .CURDIR |
to the value of |
to the value of |
.Ev PWD |
.Ev PWD |
instead. |
instead. |
.Ev PWD |
.Ev PWD |
is always set to the value of |
is always set to the value of |
.Ql Va .OBJDIR |
.Sq Va .OBJDIR |
for all programs which |
for all programs which |
.Nm |
.Nm |
executes. |
executes. |
|
|
special characters. |
special characters. |
The colon may be escaped with a backslash |
The colon may be escaped with a backslash |
.Pq Ql \e . |
.Pq Ql \e . |
.Bl -tag -width Cm E\& |
.Bl -tag -width Ds |
.It Cm E |
.It Cm E |
Replaces each word in the variable with its suffix. |
Replaces each word in the variable with its suffix. |
.It Cm H |
.It Cm H |
|
|
.Pf ( Ql * , |
.Pf ( Ql * , |
.Ql ? , |
.Ql ? , |
and |
and |
.Ql Op ) |
.Ql [] ) |
may |
may |
be used. |
be used. |
The wildcard characters may be escaped with a backslash |
The wildcard characters may be escaped with a backslash |
|
|
.Op Ar operator expression ... |
.Op Ar operator expression ... |
.Xc |
.Xc |
A combination of |
A combination of |
.Ql Ic .else |
.Sq Ic .else |
followed by |
followed by |
.Ql Ic .if . |
.Sq Ic .if . |
.It Xo |
.It Xo |
.Ic .elifdef |
.Ic .elifdef |
.Oo \&! Oc Ns Ar variable |
.Oo \&! Oc Ns Ar variable |
.Op Ar operator variable ... |
.Op Ar operator variable ... |
.Xc |
.Xc |
A combination of |
A combination of |
.Ql Ic .else |
.Sq Ic .else |
followed by |
followed by |
.Ql Ic .ifdef . |
.Sq Ic .ifdef . |
.It Xo |
.It Xo |
.Ic .elifndef |
.Ic .elifndef |
.Oo \&! Oc Ns Ar variable |
.Oo \&! Oc Ns Ar variable |
.Op Ar operator variable ... |
.Op Ar operator variable ... |
.Xc |
.Xc |
A combination of |
A combination of |
.Ql Ic .else |
.Sq Ic .else |
followed by |
followed by |
.Ql Ic .ifndef . |
.Sq Ic .ifndef . |
.It Xo |
.It Xo |
.Ic .elifmake |
.Ic .elifmake |
.Oo \&! Oc Ns Ar target |
.Oo \&! Oc Ns Ar target |
.Op Ar operator target ... |
.Op Ar operator target ... |
.Xc |
.Xc |
A combination of |
A combination of |
.Ql Ic .else |
.Sq Ic .else |
followed by |
followed by |
.Ql Ic .ifmake . |
.Sq Ic .ifmake . |
.It Xo |
.It Xo |
.Ic .elifnmake |
.Ic .elifnmake |
.Oo \&! Oc Ns Ar target |
.Oo \&! Oc Ns Ar target |
.Op Ar operator target ... |
.Op Ar operator target ... |
.Xc |
.Xc |
A combination of |
A combination of |
.Ql Ic .else |
.Sq Ic .else |
followed by |
followed by |
.Ql Ic .ifnmake . |
.Sq Ic .ifnmake . |
.It Ic .endif |
.It Ic .endif |
End the body of the conditional. |
End the body of the conditional. |
.El |
.El |
|
|
its value. |
its value. |
Parentheses 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 \&! |
.Sq Ic \&! |
may be used to logically negate an entire |
may be used to logically negate an entire |
conditional. |
conditional. |
It is of higher precedence than |
It is of higher precedence than |
.Ql Ic \&&& . |
.Sq Ic \&&& . |
.Pp |
.Pp |
The value of |
The value of |
.Ar expression |
.Ar expression |
may be any of the following: |
may be any of the following: |
.Bl -tag -width Ic defined |
.Bl -tag -width defined |
.It Ic defined |
.It Ic defined |
Takes a variable name as an argument and evaluates to true if the variable |
Takes a variable name as an argument and evaluates to true if the variable |
has been defined. |
has been defined. |
|
|
The standard C relational operators are all supported. |
The standard C relational operators are all supported. |
If after |
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 == |
.Sq Ic == |
or |
or |
.Ql Ic "!=" |
.Sq Ic "!=" |
operator is not an integral value, then |
operator is not an integral value, then |
string comparison is performed between the expanded |
string comparison is performed between the expanded |
variables. |
variables. |
|
|
.Dq defined |
.Dq 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 |
.Ql Ic .ifdef |
.Sq Ic .ifdef |
or |
or |
.Ql Ic .ifndef , |
.Sq Ic .ifndef , |
the |
the |
.Dq defined |
.Dq defined |
expression is applied. |
expression is applied. |
Similarly, if the form is |
Similarly, if the form is |
.Ql Ic .ifmake |
.Sq Ic .ifmake |
or |
or |
.Ql Ic .ifnmake , |
.Sq Ic .ifnmake , |
the |
the |
.Dq make |
.Dq make |
expression is applied. |
expression is applied. |
|
|
as before. |
as before. |
If it evaluates to false, the following lines are skipped. |
If it evaluates to false, the following lines are skipped. |
In both cases this continues until a |
In both cases this continues until a |
.Ql Ic .else |
.Sq Ic .else |
or |
or |
.Ql Ic .endif |
.Sq 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 |
.Bd -unfilled -offset indent |
.It Xo |
.Xo |
.Ic \&.for |
.Ic .for Ar variable Op Ar variable ... |
.Ar variable |
|
.Op Ar variable ... |
|
.Ic in |
.Ic in |
.Ar expression |
.Ar expression |
.Xc |
.Xc |
.It Xo |
<make-rules> |
<make-rules> |
|
.Xc |
|
.It Xo |
|
.Ic \&.endfor |
.Ic \&.endfor |
.Xc |
.Ed |
.El |
.Pp |
After the for |
After the for |
.Ar expression |
.Ar expression |
is evaluated, it is split into words. |
is evaluated, it is split into words. |
|
|
character, anywhere but in a shell |
character, anywhere but in a shell |
command line, and continue to the end of the line. |
command line, and continue to the end of the line. |
.Sh SPECIAL SOURCES |
.Sh SPECIAL SOURCES |
.Bl -tag -width Ic .IGNORE |
.Bl -tag -width ".PRECIOUS" |
.It Ic .IGNORE |
.It Ic .IGNORE |
Ignore any errors from the commands associated with this target, exactly |
Ignore any errors from the commands associated with this target, exactly |
as if they all were preceded by a dash |
as if they all were preceded by a dash |
|
|
.Sh "SPECIAL TARGETS" |
.Sh "SPECIAL TARGETS" |
Special targets may not be included with other targets, i.e., they must be |
Special targets may not be included with other targets, i.e., they must be |
the only target specified. |
the only target specified. |
.Bl -tag -width Ic .BEGIN |
.Bl -tag -width ".NOTPARALLEL" |
.It Ic .BEGIN |
.It Ic .BEGIN |
Any command lines attached to this target are executed before anything |
Any command lines attached to this target are executed before anything |
else is done. |
else is done. |