|
4. Introducing `Makefile' s
A
`Makefile'
is a specification of dependencies between files and how to resolve those dependencies such that an overall goal, known as a
target
, can be reached.
`Makefile'
s are
|
|
4.1 Targets and dependencies
The
We can draw a dependency graph that looks like this:
Unless the
`Makefile'
contains a directive to
When leaf nodes are found in the dependency graph, the
`Makefile'
must include a set of shell commands to bring the dependent up to date with the dependency. Much to the chagrin of many
Target rules can be written which are executed unconditionally. This is achieved by specifying that the target has no dependents. A simple rule which should be familiar to most users is:
|
|
4.2 Makefile syntax
`Makefile'
s have a rather particular syntax that can trouble new users. There are many
Comments start with a
`#'
and continue until the end of line. They may appear
Target rules start at the beginning of a line and are followed by a colon. Following the
These commands may be prefixed by an
`@'
character to prevent
|