Book HomeBook TitleSearch this book

Chapter 20. The make Utility

Contents:

Conceptual Overview
Command-Line Syntax
Description File Lines
Macros
Special Target Names
Writing Command Lines
Sample Default Macros, Suffixes, and Rules

This chapter presents the following topics:

For more information, see Managing Projects with make, listed in the Bibliography.

20.1. Conceptual Overview

The make program generates a sequence of commands for execution by the Unix shell. It uses a table of file dependencies provided by the programmer, and, with this information, can perform updating tasks automatically for the user. It can keep track of the sequence of commands that create certain files, and the list of files or programs that require other files to be current before they can operate efficiently. When a program is changed, make can create the proper files with a minimum of effort.

Each statement of a dependency is called a rule. Rules define one or more targets, which are the files to be generated, and the files they depend upon, the prerequisites or dependencies. For example, prog.o would be a target that depends upon prog.c; each time you update prog.c, prog.o must be regenerated. It is this task that make automates, and it is a critical one for large programs that have many pieces.

This chapter covers the SVR4 make. Many Unix vendors have enhanced make in different, and often incompatible, ways. Check your local documentation for the final word.

On Solaris, /usr/lib/svr4.make is the generic SVR4 version of make. If you set USE_SVR4_MAKE in the environment, /usr/ccs/bin/make or /usr/xpg4/bin/make runs this version.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.