102Chapter4 • Using GNU make
This chapter contains information on how to write makefiles for software
projects and provides sufficient information for a reader to write make-
files for fairly complex projects. You can also refer to the reference at the
end of this chapter for more comprehensive information about the
make
utility.
To demonstrate the use of
make
, several examples are presented in this
chapter. These examples demonstrate how
make
can be used for different
objectives. These examples are simple and easy to understand and are
explained in the text. However you may write makefiles in many different
ways for the same object. Features of
make
that are discussed in this
chapter are those most commonly used.
Make
has many additional, less
commonly used, features that are not covered here and you may want to
use these as well while designing your makefiles.
4.1Introduction to GNU
make
The
make
utility has been used for a very long time in all types of software development
projects. There are open-source as well as commercial variants available from many vendors.
The most common and popular distribution of
make
is the GNU
make
, which is open source
and is available for almost all UNIX and Microsoft Windows platforms. All of the Linux distri-
butions have the GNU
make
as a standard package with the development system. If you have
installed development software from a distribution, you don’t need to install any additional soft-
ware for
make
to work. The version of
make
currently installed can be displayed using the fol-
lowing command.
[root@conformix make]# make -v
GNU Make version 3.79.1, by Richard Stallman and Roland
McGrath.
Built for i386-redhat-linux-gnu
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
99, 2000
Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
Report bugs to .
[root@conformix make]#