HP-UX Reference (11i v2 03/08) - 1 User Commands A-M (vol 1)
m
make(1) make(1)
INCLUDE LINES
If the string include appears as the first seven letters of a line in a makefile, and is followed by one or
more space or tab characters, the rest of the line is assumed to be a file name and is read and processed
by the current invocation of make as another makefile after any macros in the filename have been
expanded.
The default behaviour of
make is to use
.DEFAULT built-in target, if target does not have explicit com-
mands associated with it and
.DEFAULT target is defined. See the Built-In Targets Section.
General Description
make executes commands previously placed in a makefile to update one or more target names. Target
names are typically names of programs. If no
-f option is specified, the filenames makefile,
Makefile, s.makefile, SCCS/s.makefile
, s.Makefile and SCCS/s.Makefile
are tried in
that order. If
-f - is specified, the standard input is used. More than one
-f option can be specified.
The makefile arguments are processed in the order specified. A space between the
-f and the filename
must be present, and multiple makefile names must each have their own
-f option preceding them. The
contents of a makefile override the built-in rules and macros if they are present.
If no target names are specified on the command line,
make updates the first target in the (first) makefile
that is not an inference rule. A target is updated in two cases: firstly, if it depends on files that are newer
than the target; secondly, if it depends on files that have same modification time as that of the target.
Missing files are deemed to be out-of-date. All dependents of a target are recursively updated, if neces-
sary, before the target is updated. This effects a depth-first update of the dependency tree for the target.
If a target does not have any dependents specified after the separator on the target line (explicit depen-
dents), any shell commands associated with that target are executed if the target is out-of-date.
A target line can have either a single or double colon between the target name or names and any explicit
dependent names. A target name can appear on more than one target line, but all of those lines must be
of the same (single- or double-colon) type. For the usual single-colon case, at most one of these target
lines can have explicit commands associated with it. If the target is out-of-date with any of its depen-
dents on any of the lines, the explicit commands are executed, if they are specified, or else a default rule
can be executed. For the double-colon case, explicit commands can be associated with more than one of
the target lines containing the target name; if the target is out-of-date with any of the dependents on a
particular line, the commands for that line are executed. A built-in rule may also be executed.
Target lines and their associated shell command lines are also referred to as rules. Hash marks (
#) and
new-line characters surround comments anywhere in the makefile except in rules. Comments in the rules
depend on the setting of the
SHELL macro.
The following makefile says that
pgm depends on two files: a.o and b.o, and that they in turn depend
on their corresponding source files (
a.c and b.c) and a common file incl.h:
OBJS = a.o b.o
pgm: $(OBJS)
cc $(OBJS) -o pgm
a.o: incl.h a.c
cc -c a.c
b.o: incl.h b.c
cc -c b.c
Command lines are executed one at a time, each by its own shell. Each command line can have one or
more of the following prefixes: -, @,or+. These prefixes are explained below.
Commands returning non-zero status normally terminate
make. The -i option or the presence of the
special target .IGNORE in the makefile cause make to continue executing the makefile regardless of how
many command lines cause errors, although the error messages are still printed on standard output. If -
is present at the beginning of a command line, any error returned by that line is printed to standard out-
put but make does not terminate. The prefix - can be used to selectively ignore errors in a makefile. If
the -k option is specified and a command line returns an error status, work is abandoned on the current
target, but continues on other branches that do not depend on that target. If the -k option is present in
the MAKEFLAGS environment variable, processing can be returned to the default by specifying the -S
option.
The
-n option specifies printing of a command line without execution. However, if the command line has
the string $(MAKE) or ${MAKE} in it or + as a prefix, the line is always executed (see discussion of the
HP-UX 11i Version 2: August 2003 − 2 − Hewlett-Packard Company Section 1−−519