Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
m
make(1) make(1)
NAME
make - maintain, update, and regenerate groups of programs
SYNOPSIS
make [-f makefile ][-bBdeiknpPqrsStuw][macro_name=value ][names ]
DESCRIPTION
Makefile Structure
A makefile can contain four different kinds of lines: target lines, shell command lines, macro definitions,
and include lines.
TARGET LINES
Target lines consist of a blank-separated, non-null list of targets, followed by a colon (:) or double colon
(::), followed by a (possibly null) list of prerequisite files called dependents. Pattern Matching Notation
(see regexp(5)) is supported for the generation of file names as dependents.
SHELL COMMAND LINES
Text following a semicolon (
;) on a target line, and all following lines that begin with a tab are shell com-
mands to be executed to update the target (see the Environment section below about SHELL). The first
line that does not begin with a tab or
# begins a new target definition, macro definition, or include line.
Shell commands can be continued across lines by using a <backslash><new-line> sequence.
Target lines with their associated command lines are called rules.
MACROS
Lines of the form string1
= string2 are macro definitions. Macros can be defined anywhere in the
makefile, but are usually grouped together at the beginning. string1 is the macro name; string2 is the
macro value. string2 is defined as all characters up to a comment character or an unescaped new-line.
Spaces and tabs immediately to the left and right of the
= are ignored. Subsequent appearances of
$(string1) anywhere in the makefile (except in comments) are replaced by string2. The parentheses are
optional if a single character macro name is used and there is no substitute sequence. An optional substi-
tute sequence,
$(string1 [:subst1=[subst2 ]]) can be specified, which causes all nonoverlapping
occurrences of subst1 at the end of substrings in the value of string1 to be replaced by subst2. Substrings in
a macro value are delimited by blanks, tabs, new-line characters, and beginnings of lines. For example, if
OBJS = file1.o file2.o file3.o
then
$(OBJS:.o=.c)
evaluates to
file1.c file2.c file3.c
Macro values can contain references to other macros (see WARNINGS):
ONE =1
TWELVE = $(ONE)2
The value of $(TWELVE) is set to $(ONE)2 but when it is used in a target, command, or include line, it
is expanded to 12. If the value of ONE is subsequently changed by another definition further down in the
makefile or on the command line, any references to $(TWELVE) reflect this change.
Macro definitions can also be specified on the command line and override any definitions in the makefile.
(XPG4 only. Macros on the command line are added to the MAKEFLAGS environment variable. Macros
defined in the MAKEFLAGS environment variable, but without any command line macro, adds the macro to
the environment overwriting any existing environment variable of the same name.)
Certain macros are automatically defined for make (see Built-in Macros). See the Environment section for
a discussion of the order in which macro definitions are treated.
The value assigned to a macro can be overridden by a conditional macro definition. A conditional macro
definition takes on the form target := string1 = string2. When the target line associated with target is
being processed, the macro value specified in the conditional macro definition is in effect. If string1 is pre-
viously defined, the new value of string1 will override the previous definition. The new value of string1
takes effect when target or any dependents of target are being processed.
Section 1508 1 HP-UX Release 11i: December 2000
___
___