|
GNU Autoconf, Automake and Libtool Authors: Vaughan G.V., Ellison B., Taylor I.L. Published year: 2002 Pages: 23-25/290 |
|
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
processed
by the
|
|
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
implementations
of
Comments start with a `#' and continue until the end of line. They may appear anywhere except in command sequences--if they do, they will be interpreted by the shell running the command. The following `Makefile' shows three individual targets with dependencies on each:
Target rules start at the beginning of a line and are followed by a colon. Following the
colon
is a whitespace separated list of dependencies. A series of lines follow which contain shell commands to be run by a sub-shell (the default is the Bourne shell). Each of these lines
must
be prefixed by a horizontal tab character. This is the most common mistake made by new
These commands may be prefixed by an
`@'
character to prevent
|
|
GNU Autoconf, Automake and Libtool Authors: Vaughan G.V., Ellison B., Taylor I.L. Published year: 2002 Pages: 23-25/290 |