GNU make: A Program for Directing Compilation

GNU make: A Program for Directing Compilation

By Richard M. Stallman
Book Description

This best-selling manual is indispensable to free software system maintainers. The GNU Make manual, written by the program's original authors and current maintainer, is the definitive tutorial. It is carefully designed to be useful to all levels of users, and includes an introductory chapter for novices. The Make utility automates the process of compilation; it is especially useful when the source files of large programs change. GNU Make is becoming increasingly popular as it is able to meet the needs of free software system hackers in system management. It is a small program with a lot of power.

This book will show you:

  • How to write your own makefiles

  • Make's rule syntax and how to write your own rules

  • How the Make utility can be configured to automatically put binary and source files in the right places.

  • How to use make to create archive files automatically

  • Define, set and use Make's variables

  • How Make uses targets so that you can broaden or narrow Make's recompilation efforts on demand.

And much more!

This manual provides a complete explanation of Make, both the basics and extended features. There is also a convenient Quick Reference appendix for experts.

Currently at version 3.81. Buy a print copy from the Free Software Foundation
Table of Contents
  • Overview of make
    • How to Read This Manual
    • 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 Recipes
    • Another Style of Makefile
    • Rules for Cleaning the Directory
  • Writing Makefiles
    • What Makefiles Contain
      • Splitting Long Lines
    • What Name to Give Your Makefile
    • Including Other Makefiles
    • The Variable MAKEFILES
    • How Makefiles Are Remade
    • Overriding Part of Another Makefile
    • How make Reads a Makefile
    • Secondary Expansion
  • Writing Rules
    • Rule Syntax
    • Types of Prerequisites
    • Using Wildcard Characters in File Names
      • Wildcard Examples
      • Pitfalls of Using Wildcards
      • The Function wildcard
    • Searching Directories for Prerequisites
      • VPATH: Search Path for All Prerequisites
      • The vpath Directive
      • How Directory Searches are Performed
      • Writing Recipes with Directory Search
      • Directory Search and Implicit Rules
      • Directory Search for Link Libraries
    • Phony Targets
    • Rules without Recipes or Prerequisites
    • 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 Prerequisites Automatically
  • Writing Recipes in Rules
    • Recipe Syntax
      • Splitting Recipe Lines
      • Using Variables in Recipes
    • Recipe Echoing
    • Recipe Execution
      • Using One Shell
      • Choosing the Shell
    • Parallel Execution
      • Output During Parallel Execution
      • Input During Parallel Execution
    • Errors in Recipes
    • 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 Recipes
    • Using Empty Recipes
  • 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 Multi-Line Variables
    • Undefining Variables
    • Variables from the Environment
    • Target-specific Variable Values
    • Pattern-specific Variable Values
    • Suppressing Inheritance
    • Other Special Variables
  • 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
    • Functions for Conditionals
    • The foreach Function
    • The file Function
    • The call Function
    • The value Function
    • The eval Function
    • The origin Function
    • The flavor Function
    • Functions That Control Make
    • The shell Function
    • The guile Function
  • How to Run make
    • Arguments to Specify the Makefile
    • Arguments to Specify the Goals
    • Instead of Executing Recipes
    • Avoiding Recompilation of Some Files
    • Overriding Variables
    • Testing the Compilation of a Program
    • Summary of Options
  • Using Implicit Rules
    • Using Implicit Rules
    • Catalogue of Built-In 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
  • Extending GNU make
    • GNU Guile Integration
      • Conversion of Guile Types
      • Interfaces from Guile to make
      • Example Using Guile in make
    • Loading Dynamic Objects
      • The load Directive
      • How Loaded Objects Are Remade
      • Loaded Object Interface
      • Example Loaded Object
  • Features of GNU make
  • Incompatibilities and Missing Features
  • Makefile Conventions
    • General Conventions for Makefiles
    • Utilities in Makefiles
    • Variables for Specifying Commands
    • DESTDIR: Support for Staged Installs
    • Variables for Installation Directories
    • Standard Targets for Users
    • Install Command Categories
  • Quick Reference
  • Errors Generated by Make
  • Complex Makefile Example
    • GNU Free Documentation License
  • Index of Concepts
  • Index of Functions, Variables, & Directives
    No review for this book yet, be the first to review.
      No comment for this book yet, be the first to comment
      You May Also Like
      Also Available On
      App store smallGoogle play small
      Curated Lists
      • Pattern Recognition and Machine Learning (Information Science and Statistics)
        by Christopher M. Bishop
        Data mining
        by I. H. Witten
        The Elements of Statistical Learning: Data Mining, Inference, and Prediction
        by Various
        See more...
      • CK-12 Chemistry
        by Various
        Concept Development Studies in Chemistry
        by John Hutchinson
        An Introduction to Chemistry - Atoms First
        by Mark Bishop
        See more...
      • Microsoft Word - How to Use Advanced Algebra II.doc
        by Jonathan Emmons
        Advanced Algebra II: Activities and Homework
        by Kenny Felder
        See more...
      • The Sun Who Lost His Way
        Tania is a Detective
        by Kanika G
        See more...
      • Java 3D Programming
        by Daniel Selman
        The Java EE 6 Tutorial
        by Oracle Corporation
        See more...