GNUPro Toolkit Documentation|Index|Next

# GNU Make
A Program for Directing Recompilation

    Copyright © 1988- 1997  Free Software Foundation, Inc.

    Published by the Free Software Foundation.

    Printed copies are available for $20 each.

    ISBN: 1-882114-50-7

    Free Software Foundation

    59 Temple Place / Suite 330

    Boston, MA   02111-1307    USA

    Permission is granted to make and distribute verbatim copies of this documentation
    provided the copyright notice and this permission notice are preserved on all copies.

    Permission is granted to copy and distribute modified versions of this documentation
    under the conditions for verbatim copying, provided that the entire resulting derived
    work is distributed under the terms of a permission notice identical to this one.

    Permission is granted to copy and distribute translations of this documentation into
    another language, under the above conditions for modified versions, except that
    this permission notice may be stated in a translation approved by the Free Software Foundation.

    This documentation has been prepared by Cygnus Technical Publications;
    to contact the Cygnus Solutions Technical Publications staff, e-mail: doc@cygnus.com.

    Copyright © 1992-1997   Cygnus Solutions. All rights reserved.

    GNUPro™, the GNUPro™ logo, and the Cygnus Solutions logo are trademarks of Cygnus Solutions.
    All other brand and product names are trademarks of their respective owners.

    The following documentation discusses GNU make, the utility for directing recompilation.

- Overview of make

- How to Read This Documentation
- Problems and Bugs

- An Introduction to Makefiles

- What a Rule Looks Like
- A Simple Makefile
- How make Processes a Makefile
- Variables Make Makefiles Simpler
- Letting make Deduce the Commands
- Another Style of Makefile
- Rules for Cleaning the Directory

- Writing Makefiles

- What Makefiles Contain
- What Name to Give Your Makefile
- Including Other Makefiles
- The Variable, MAKEFILES
- How Makefiles Are Remade
- Overriding Part of Another Makefile

- Writing Rules

- Rule Syntax
- Using Wildcard Characters in File Names

- Wildcard Examples
- Pitfalls of Using Wildcards
- The Function, wildcard

- Searching Directories for Dependencies

- VPATH: Search Path for All Dependencies
- The vpath Directive
- Writing Shell Commands with Directory Search
- Directory Search and Implicit Rules
- Directory Search for Link Libraries

- Phony Targets
- Rules without Commands or Dependencies
- Empty Target Files to Record Events
- Special Built-in Target Names
- Multiple Targets in a Rule
- Multiple Rules for One Target
- Static Pattern Rules

- Syntax of Static Pattern Rules
- Static Pattern Rules versus Implicit Rules

- Double-Colon Rules
- Generating Dependencies Automatically

- Writing the Commands in Rules

- Command Echoing
- Command Execution
- Parallel Execution
- Errors in Commands
- Interrupting or Killing make
- Recursive Use of make

- How the MAKE Variable Works
- Communicating Variables to a Sub-make
- Communicating Options to a Sub-make
- The ‘--print-directory’ Option

- Defining Canned Command Sequences
- Using Empty Commands

- How to Use Variables

- Basics of Variable References
- The Two Flavors of Variables
- Advanced Features for Reference to Variables

- Substitution References
- Computed Variable Names

- How Variables Get Their Values
- Setting Variables
- Appending More Text to Variables
- The override Directive
- Defining Variables Verbatim
- Variables from the Environment

- Conditional Parts of Makefiles

- Example of a Conditional
- Syntax of Conditionals
- Conditionals that Test Flags

- Functions for Transforming Text

- Function Call Syntax
- Functions for String Substitution and Analysis
- Functions for File Names
- The foreach Function
- The origin Function
- The shell Function

- How to Run make

- Arguments to Specify the Makefile
- Arguments to Specify the Goals
- Instead of Executing the Commands
- Avoiding Recompilation of Some Files
- Overriding Variables
- Testing the Compilation of a Program
- Summary of Options

- Implicit Rules

- Using Implicit Rules
- Catalogue of Implicit Rules
- Variables Used by Implicit Rules
- Chains of Implicit Rules
- Defining and Redefining Pattern Rules

- Introduction to Pattern Rules
- Pattern Rule Examples
- Automatic Variables
- How Patterns Match
- Match-Anything Pattern Rules
- Canceling Implicit Rules

- Defining Last-Resort Default Rules
- Old-Fashioned Suffix Rules
- Implicit Rule Search Algorithm

- Using make to Update Archive Files

- Archive Members as Targets
- Implicit Rule for Archive Member Targets

- Updating Archive Symbol Directories

- Dangers When Using Archives
- Suffix Rules for Archive Files

- Features of GNU make
- Incompatibilities and Missing Features
- Makefile Conventions

- General Conventions for Makefiles
- Utilities in Makefiles
- Standard Targets for Users
- Variables for Specifying Commands
- Variables for Installation Directories

- Quick Reference
- Complex Makefile Example
- Index