
m
make(1) | make(1) |
NAME
make - maintain, update, and regenerate groups of programs
SYNOPSIS
make
DESCRIPTION
Make®le Structure
A make®le can contain four different kinds of lines: target lines, shell command lines, macro de®nitions, and include lines.
TARGET LINES
Target lines consist of a
(::), followed by a (possibly null) list of prerequisite ®les called dependents. Pattern Matching Notation (see regexp(5)) is supported for the generation of ®le 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 commands to be executed to update the target (see the Environment section below about SHELL). The ®rst line that does not begin with a tab or # begins a new target de®nition, macro de®nition, or include line. Shell commands can be continued across lines by using a
Target lines with their associated command lines are called rules.
MACROS
Lines of the form string1 = string2 are macro de®nitions. Macros can be de®ned anywhere in the make®le, but are usually grouped together at the beginning. string1 is the macro name; string2 is the macro value. string2 is de®ned as all characters up to a comment character or an unescaped
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 de®nition further down in the make®le or on the command line, any references to $(TWELVE) re¯ect this change.
Macro de®nitions can also be speci®ed on the command line and override any de®nitions in the make®le.
(XPG4 only. Macros on the command line are added to the MAKEFLAGS environment variable. Macros de®ned 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 de®ned for make (see
The value assigned to a macro can be overridden by a conditional macro de®nition. A conditional macro de®nition takes on the form target := string1 = string2. When the target line associated with target is being processed, the macro value speci®ed in the conditional macro de®nition is in effect. If string1 is previously de®ned, the new value of string1 will override the previous de®nition. The new value of string1 takes effect when target or any dependents of target are being processed.
Section 1−508 | − 1 − |