\&.endfor
After the for
expression
is evaluated, it is split into words.
On each iteration of the loop, one word is assigned to each
variable,
in order,
and these
variables
are substituted in the
make-rules
inside the body of the for loop.
The number of words must match the number of iteration variables;
that is, if there are three iteration variables, the number of words
must be a multiple of three.
Loops and conditional expressions may nest arbitrarily, but
they may not cross include file boundaries.
COMMENTS
Comments begin with a hash
("\")
character, anywhere but in a shell
command line, and continue to the end of the line.
SPECIAL SOURCES
- .IGNORE
-
Ignore any errors from the commands associated with this target, exactly
as if they all were preceded by a dash
("\-").
- .MADE
-
Mark all sources of this target as being up-to-date.
- .MAKE
-
Execute the commands associated with this target even if the
-n
or
-t
options were specified.
Normally used to mark recursive
make.
- .NOTMAIN
-
Normally
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.
- .OPTIONAL
-
If a target is marked with this attribute and
make
can't figure out how to create it, it will ignore this fact and assume
the file isn't needed or already exists.
- .PRECIOUS
-
When
make
is interrupted, it removes any partially made targets.
This source prevents the target from being removed.
- .SILENT
-
Do not echo any of the commands associated with this target, exactly
as if they all were preceded by an at sign
("@").
- .USE
-
Turn the target into
make
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.
- .WAIT
-
If
.WAIT
appears in a dependency line, the sources that precede it are
made before the sources that succeed it in the line.
Loops are not
detected and targets that form loops will be silently ignored.
SPECIAL TARGETS
Special targets may not be included with other targets, i.e., they must be
the only target specified.
- .BEGIN
-
Any command lines attached to this target are executed before anything
else is done.
- .DEFAULT
-
This is sort of a
.USE
rule for any target (that was used only as a
source) that
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
commands is set
to the target's own name.
- .END
-
Any command lines attached to this target are executed after everything
else is done.
- .IGNORE
-
Mark each of the sources with the
.IGNORE
attribute.
If no sources are specified, this is the equivalent of specifying the
-i
option.
- .INCLUDES
-
A list of suffixes that indicate files that can be included in a source
file.
The suffix must have already been declared with
.SUFFIXES,
any suffix so declared will have the directories in its search path (see
.PATH)
placed in the
.INCLUDES
special variable, each preceded by a
-I
flag.
- .INTERRUPT
-
If
make
is interrupted, the commands for this target will be executed.
- .LIBS
-
This does for libraries what
.INCLUDES
does for include files, except that the flag used is
-L.
- .MAIN
-
If no target is specified when
make
is invoked, this target will be built.
This is always set, either
explicitly, or implicitly when
make
selects the default target, to give the user a way to refer to the default
target on the command line.
- .MAKEFLAGS
-
This target provides a way to specify flags for
make
when the makefile is used.
The flags are as if typed to the shell, though the
-f
option will have
no effect.
- .NOTPARALLEL
-
Disable parallel mode.
- .NO_PARALLEL
-
Same as above, for compatibility with other pmake variants.
- .ORDER
-
The named targets are made in sequence.
- .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.
- .PATH\fIsuffix\fR
-
The sources are directories which are to be searched for suffixed files
not found in the current directory.
make
first searches the suffixed search path, before reverting to the default
path if the file is not found there.
- .PHONY
-
Apply the
.PHONY
attribute to any specified sources.
Targets with this attribute are always
considered to be out of date.
- .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.
- .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.
- .SUFFIXES
-
Each source specifies a suffix to
make.
If no sources are specified, any previously specified suffixes are deleted.
ENVIRONMENT
make
uses the following environment variables, if they exist:
MACHINE,
MACHINE_ARCH,
MACHINE_CPU,
MAKEFLAGS,
MAKEOBJDIR,
MAKEOBJDIRPREFIX,
and
PWD.
make
also ignores and unsets
CDPATH.
FILES
- .depend
-
list of dependencies
- BSDmakefile
-
default makefile
- makefile
-
default makefile if
BSDmakefile
does not exist
- Makefile
-
default makefile if
makefile
does not exist
- sys.mk
-
system makefile
- /usr/share/mk
-
system makefile directory
- /usr/obj
-
default
MAKEOBJDIRPREFIX
directory
EXIT STATUS
If
-q
was specified, the
make
utility exits with one of the following values:
- 0
-
Normal behavior.
- 1
-
The target was not up-to date.
- \*(Gt1
-
An error occurred.
Otherwise, the
make
utility exits with a value of 0 on success, and \*(Gt0 if an error occurred.
SEE ALSO
ed(1),
mkdep(1),
sh(1),
getcwd(3),
regex(3),
uname(3)
"Make \(em A Tutorial",
/usr/share/doc/psd/12.make/.
STANDARDS
The
make
utility is compliant with the
specification,
though its presence is optional.
The flags
[-BDdIjmPV]
are extensions to that specification.
Older versions of
make
used
MAKE
instead of
MAKEFLAGS.
This was removed for POSIX compatibility.
The internal variable
MAKE
is set to the same value as
.MAKE.
Support for this may be removed in the future.
Most of the more esoteric features of
make
should probably be avoided for greater compatibility.
HISTORY
A
make
command appeared in
Version 7 AT&T UNIX.
BUGS
The determination of
.OBJDIR
is contorted to the point of absurdity.
If the same target is specified several times in normal dependency rules,
make
silently ignores all commands after the first non empty set of commands,
e.g., in
a:
@echo "Executed"
a:
@echo "Bad luck"
@echo "Bad luck" will be silently ignored.
.TARGETS
is not set to the default target when
make
is invoked without a target name and no
MAIN
special target exists.
The evaluation of
expression
in a test is very simple-minded.
Currently, the only form that works is
".if"${VAR} op something \.
For instance, tests should be written as
".if"${VAR} == "string",
not the other way around, which doesn't work.
For loops are expanded before tests, so a fragment such as:
\&.for TMACHINE in ${SHARED_ARCHS}
\&.if ${TMACHINE} == ${MACHINE}
...
\&.endif
\&.endfor
won't work, and should be rewritten the other way around.
When handling pre-BSD 4.4 archives,
make
may erroneously mark archive members as out of date if the archive name
was truncated.
The handling of
\&
and other special characters in tests may be utterly bogus.
For instance, in
\&A=abcd;c.c
\&.if ${A:R} == "abcd;c"
the test will never match, even though the value is correct.
The conditional handler is incredibly lame.
Junk such as
\&.if defined anything goes (A)
will be accepted silently.
In a .for loop, only the variable value is used; assignments will be
evaluated later, e.g., in
\&.for I in a b c d
I:=${I:S/a/z}
A+=$I
\&.endfor
A
will evaluate to a b c d after the loop, not z b c d.
ORDER
is only used in parallel mode, so
keep dependency ordered for sequential mode!
Distinct target names are treated separately, even though they might
correspond to the same file in the file system.
This can cause excessive rebuilds of some targets, and bogus
races in parallel mode.
This can also prevent
make
from finding a rule to solve a dependency if the target name is not
exactly the same as the dependency.
In parallel mode,
-j n
only limits the number of concurrent makes it knows about.
During recursive invocations, each level will multiply the number
of processes by
n.
The
MAKEFILE
variable cannot be used reliably.
It is a compatibility feature and may get set to the last makefile
specified, as it is set by System V make.
| AerieBSD 1.0 Reference Manual |
October 13 2010 |
MAKE(1) |