Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)

User Commands (m - o) make(1)
DESCRIPTION
The make program is designed to simplify the maintenance of other programs. Its input is a list
of specications of the les that programs and other les depend upon. By default, the following
les are tried in sequence to provide this list of specications: ./makefile and ./Makefile.
There are four different types of lines in a makele: le dependency specications, shell com-
mands, variable assignments, and comments.
In general, command lines in a makele can be continued from one line to the next by ending
them with a \ (backslash). The trailing newline character and initial white space on the following
line are compressed into a single space.
File Dependency Specifications
Dependency lines consist of one or more targets, an operator, and zero or more sources (prere-
quisites). Dependency lines create a relationship where the targets depend on the sources and are
usually created from them.
The exact relationship between the target and the source is determined by the operator that
separates them. The operators are as follows:
: A target is considered out-of-date if its modication time is less than those of any of its
sources. Sources for a target accumulate over dependency lines when this operator is
used. The target is removed if make is interrupted unless the target has the .PRE-
CIOUS attribute.
:: If no sources are specied, the target is always re-created. Otherwise, a target is con-
sidered out-of-date if any of its sources were modied more recently than the target.
Sources for a target do not accumulate over dependency lines when this operator is
used. The target will not be removed if make is interrupted.
File dependency specications have two types of rules, inference and target, as follows:
inference rules Have one target with no / (slash) and a minimum of one . (period).
These rules specify how a target is to be made up-to-date.
target rules Can have more than one target. These rules specify how to build the tar-
get.
Makefile Execution
The make command executes the commands in the makele line by line. As make executes
each command, it writes the command to the standard output le (unless otherwise directed; for
example, by the -s option). A makele must have a tab in front of the commands on each line.
When a command is executed through make, it uses the make programs execution environment.
This includes any macros from the command line to make, and any environment variables
specied in the MAKEFLAGS variable (refer to Variable Assignments, later in this reference
page). The make utilitys environment variables overwrite any variables of the same name in the
existing environment.
Target Rules
Target rules have the following format:
target [target...] : [prerequisite...][;command]
<Tab>command
...
Multiple targets and prerequisites are separated by spaces (note that the list of prerequisites can
be empty). Any text that follows the ; (semicolon) and all of the subsequent lines that begin with
a tab character are considered commands to be used to update the target. A new target entry is
started when a new line does not begin with a tab character or # (number sign). The following
527188-003 Hewlett-Packard Company 63