Makefile overview
A makefile contains a sequence of entries, each of which specifies a build target, some dependencies, and the build scripts of commands to be executed.
A makefile can also contain make macro definitions, target-dependent macro definitions, and build directives (special targets.)
- Target/dependencies line. The first line of an entry is a
white-space-separated, non-null list of targets, followed by a colon (:) or a double
colon (::), and a (possibly empty) list of dependencies. Both targets and
dependencies might contain DevOps Code ClearCase® path name patterns.
(For more information, see the wildcards_ccase reference page.)
The list of dependencies might not need to include source objects, such as header files, because clearmake detects these dependencies. However, the list must include build-order dependencies, for example, object modules and libraries that must be built before executables. (For more information, see Build-order dependencies.)
- Build script. Text that follows a semicolon (;) on the same line and all
subsequent lines that begin with a <TAB> character constitute a build script:
a set of commands to be executed in a command interpreter. A command can be
continued onto the next text line with a \<NL> sequence. Any line beginning with
a number sign (#) is a comment.
A build script ends at the first nonempty line that does not begin with a <TAB> or number sign (#); this begins a new target/dependencies line or a make macro definition.
Build scripts must use standard path names only. Do not include view-extended or version-extended path names in a build script.
Executing a build script updates the target and is called a target rebuild. The commands in a build script are executed one at a time, each in its own instances of the command interpreter.
Note that clearmake always completely eliminates a \<NL> sequence, even in its compatibility modes. Some other make programs sometimes preserve such a sequence.
- Make macro. A make macro is an assignment of a character-string value to a simple name. By convention, all letters in the name are uppercase (for example, CFLAGS).
- Target-dependent macro definitions. A target-dependent macro definition takes
the form
target-list := macro_name = string
You can use macros in makefiles or in BOS files. For more information, see Target-dependent macro definitions.
- Special targets. A line that begins with a dot (.) is a special target, which acts as a directive to clearmake.
- Special characters in target names. You can use special characters in target names by immediately preceding each special character with a backslash (\).