[Top] | [Contents] | [Index] | [ ? ] |
make
This file documents the GNU make
utility, which determines
automatically which pieces of a large program need to be recompiled,
and issues the commands to recompile them.
This is Edition 0.71, last updated 19 July 2010,
of The GNU Make Manual, for GNU make
version 3.82.
Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License.”
(a) The FSF’s Back-Cover Text is: “You have the freedom to copy and modify this GNU manual. Buying copies from the FSF supports it in developing GNU and promoting software freedom.”
1. Overview of make | ||
2. An Introduction to Makefiles | An introduction to make .
| |
3. Writing Makefiles | Makefiles tell make what to do.
| |
4. Writing Rules | Rules describe when a file must be remade. | |
5. Writing Recipes in Rules | Recipes say how to remake a file. | |
6. How to Use Variables | You can use variables to avoid repetition. | |
7. Conditional Parts of Makefiles | Use or ignore parts of the makefile based on the values of variables. | |
8. Functions for Transforming Text | Many powerful ways to manipulate text. | |
9. How to Run make | How to invoke make on the command line.
| |
10. Using Implicit Rules | Use implicit rules to treat many files alike, based on their file names. | |
11. Using make to Update Archive Files | How make can update library archives.
| |
12. Features of GNU make | Features GNU make has over other make s.
| |
13. Incompatibilities and Missing Features | What GNU make lacks from other make s.
| |
14. Makefile Conventions | Conventions for writing makefiles for GNU programs. | |
A. Quick Reference | A quick reference for experienced users. | |
B. Errors Generated by Make | A list of common errors generated by make .
| |
C. Complex Makefile Example | A real example of a straightforward, but nontrivial, makefile. | |
C.1 GNU Free Documentation License | License for copying this manual | |
Index of Concepts | ||
Index of Functions, Variables, & Directives | ||
— The Detailed Node Listing —
Overview of | ||
---|---|---|
• Preparing | Preparing and running make | |
1.1 How to Read This Manual | On reading this text | |
1.2 Problems and Bugs | Problems and bugs | |
An Introduction to Makefiles | ||
2.1 What a Rule Looks Like | What a rule looks like. | |
2.2 A Simple Makefile | A simple makefile | |
2.3 How make Processes a Makefile | How make processes this makefile
| |
2.4 Variables Make Makefiles Simpler | Variables make makefiles simpler | |
2.5 Letting make Deduce the Recipes | Letting make deduce the recipe
| |
2.6 Another Style of Makefile | Another style of makefile | |
2.7 Rules for Cleaning the Directory | Rules for cleaning the directory | |
Writing Makefiles | ||
3.1 What Makefiles Contain | What makefiles contain. | |
3.2 What Name to Give Your Makefile | How to name your makefile. | |
3.3 Including Other Makefiles | How one makefile can use another makefile. | |
3.4 The Variable MAKEFILES | The environment can specify extra makefiles. | |
3.5 How Makefiles Are Remade | How makefiles get remade. | |
3.6 Overriding Part of Another Makefile | How to override part of one makefile with another makefile. | |
3.7 How make Reads a Makefile | How makefiles are parsed. | |
3.8 Secondary Expansion | How and when secondary expansion is performed. | |
Writing Rules | ||
4.1 Rule Example | An example explained. | |
4.2 Rule Syntax | General syntax explained. | |
4.3 Types of Prerequisites | There are two types of prerequisites. | |
4.4 Using Wildcard Characters in File Names | Using wildcard characters such as ‘*’. | |
4.5 Searching Directories for Prerequisites | Searching other directories for source files. | |
4.6 Phony Targets | Using a target that is not a real file’s name. | |
4.7 Rules without Recipes or Prerequisites | You can use a target without a recipe or prerequisites to mark other targets as phony. | |
4.8 Empty Target Files to Record Events | When only the date matters and the files are empty. | |
4.9 Special Built-in Target Names | Targets with special built-in meanings. | |
4.10 Multiple Targets in a Rule | When to make use of several targets in a rule. | |
4.11 Multiple Rules for One Target | How to use several rules with the same target. | |
4.12 Static Pattern Rules | Static pattern rules apply to multiple targets and can vary the prerequisites according to the target name. | |
4.13 Double-Colon Rules | How to use a special kind of rule to allow several independent rules for one target. | |
4.14 Generating Prerequisites Automatically | How to automatically generate rules giving prerequisites from source files themselves. | |
Using Wildcard Characters in File Names | ||
4.4.1 Wildcard Examples | Several examples | |
4.4.2 Pitfalls of Using Wildcards | Problems to avoid. | |
4.4.3 The Function wildcard | How to cause wildcard expansion where it does not normally take place. | |
Searching Directories for Prerequisites | ||
4.5.1 VPATH : Search Path for All Prerequisites | Specifying a search path that applies to every prerequisite. | |
4.5.2 The vpath Directive | Specifying a search path for a specified class of names. | |
4.5.3 How Directory Searches are Performed | When and how search paths are applied. | |
4.5.4 Writing Recipes with Directory Search | How to write recipes that work together with search paths. | |
4.5.5 Directory Search and Implicit Rules | How search paths affect implicit rules. | |
4.5.6 Directory Search for Link Libraries | Directory search for link libraries. | |
Static Pattern Rules | ||
4.12.1 Syntax of Static Pattern Rules | The syntax of static pattern rules. | |
4.12.2 Static Pattern Rules versus Implicit Rules | When are they better than implicit rules? | |
Writing Recipes in Rules | ||
5.1 Recipe Syntax | Recipe syntax features and pitfalls. | |
5.2 Recipe Echoing | How to control when recipes are echoed. | |
5.3 Recipe Execution | How recipes are executed. | |
5.4 Parallel Execution | How recipes can be executed in parallel. | |
5.5 Errors in Recipes | What happens after a recipe execution error. | |
5.6 Interrupting or Killing make | What happens when a recipe is interrupted. | |
5.7 Recursive Use of make | Invoking make from makefiles.
| |
5.8 Defining Canned Recipes | Defining canned recipes. | |
5.9 Using Empty Recipes | Defining useful, do-nothing recipes. | |
Recipe Syntax | ||
5.1.1 Splitting Recipe Lines | Breaking long recipe lines for readability. | |
5.1.2 Using Variables in Recipes | Using make variables in recipes.
| |
Recipe Execution | ||
5.3.2 Choosing the Shell | How make chooses the shell used
to run recipes.
| |
Recursive Use of | ||
5.7.1 How the MAKE Variable Works | The special effects of using ‘$(MAKE)’. | |
5.7.2 Communicating Variables to a Sub-make | How to communicate variables to a sub-make .
| |
5.7.3 Communicating Options to a Sub-make | How to communicate options to a sub-make .
| |
5.7.4 The ‘--print-directory’ Option | How the ‘-w’ or ‘--print-directory’ option
helps debug use of recursive make commands.
| |
How to Use Variables | ||
6.1 Basics of Variable References | How to use the value of a variable. | |
6.2 The Two Flavors of Variables | Variables come in two flavors. | |
6.3 Advanced Features for Reference to Variables | Advanced features for referencing a variable. | |
6.4 How Variables Get Their Values | All the ways variables get their values. | |
6.5 Setting Variables | How to set a variable in the makefile. | |
6.6 Appending More Text to Variables | How to append more text to the old value of a variable. | |
6.7 The override Directive | How to set a variable in the makefile even if the user has set it with a command argument. | |
6.8 Defining Multi-Line Variables | An alternate way to set a variable to a multi-line string. | |
6.10 Variables from the Environment | Variable values can come from the environment. | |
6.11 Target-specific Variable Values | Variable values can be defined on a per-target basis. | |
6.12 Pattern-specific Variable Values | Target-specific variable values can be applied to a group of targets that match a pattern. | |
6.13 Suppressing Inheritance | Suppress inheritance of variables. | |
6.14 Other Special Variables | Variables with special meaning or behavior. | |
Advanced Features for Reference to Variables | ||
6.3.1 Substitution References | Referencing a variable with substitutions on the value. | |
6.3.2 Computed Variable Names | Computing the name of the variable to refer to. | |
Conditional Parts of Makefiles | ||
7.1 Example of a Conditional | Example of a conditional | |
7.2 Syntax of Conditionals | The syntax of conditionals. | |
7.3 Conditionals that Test Flags | Conditionals that test flags. | |
Functions for Transforming Text | ||
8.1 Function Call Syntax | How to write a function call. | |
8.2 Functions for String Substitution and Analysis | General-purpose text manipulation functions. | |
8.3 Functions for File Names | Functions for manipulating file names. | |
8.4 Functions for Conditionals | Functions that implement conditions. | |
8.5 The foreach Function | Repeat some text with controlled variation. | |
8.6 The call Function | Expand a user-defined function. | |
8.7 The value Function | Return the un-expanded value of a variable. | |
8.8 The eval Function | Evaluate the arguments as makefile syntax. | |
8.9 The origin Function | Find where a variable got its value. | |
8.10 The flavor Function | Find out the flavor of a variable. | |
8.11 The shell Function | Substitute the output of a shell command. | |
8.12 Functions That Control Make | Functions that control how make runs. | |
How to Run | ||
9.1 Arguments to Specify the Makefile | How to specify which makefile to use. | |
9.2 Arguments to Specify the Goals | How to use goal arguments to specify which parts of the makefile to use. | |
9.3 Instead of Executing Recipes | How to use mode flags to specify what kind of thing to do with the recipes in the makefile other than simply execute them. | |
9.4 Avoiding Recompilation of Some Files | How to avoid recompiling certain files. | |
9.5 Overriding Variables | How to override a variable to specify an alternate compiler and other things. | |
9.6 Testing the Compilation of a Program | How to proceed past some errors, to test compilation. | |
9.7 Summary of Options | ||
Using Implicit Rules | ||
10.1 Using Implicit Rules | How to use an existing implicit rule to get the recipe for updating a file. | |
10.2 Catalogue of Implicit Rules | A list of built-in implicit rules. | |
10.3 Variables Used by Implicit Rules | How to change what predefined rules do. | |
10.4 Chains of Implicit Rules | How to use a chain of implicit rules. | |
10.5 Defining and Redefining Pattern Rules | How to define new implicit rules. | |
10.6 Defining Last-Resort Default Rules | How to define a recipe for rules which cannot find any. | |
10.7 Old-Fashioned Suffix Rules | The old-fashioned style of implicit rule. | |
10.8 Implicit Rule Search Algorithm | The precise algorithm for applying implicit rules. | |
Defining and Redefining Pattern Rules | ||
10.5.1 Introduction to Pattern Rules | An introduction to pattern rules. | |
10.5.2 Pattern Rule Examples | Examples of pattern rules. | |
10.5.3 Automatic Variables | How to use automatic variables in the recipe of implicit rules. | |
10.5.4 How Patterns Match | How patterns match. | |
10.5.5 Match-Anything Pattern Rules | Precautions you should take prior to defining rules that can match any target file whatever. | |
10.5.6 Canceling Implicit Rules | How to override or cancel built-in rules. | |
Using | ||
11.1 Archive Members as Targets | Archive members as targets. | |
11.2 Implicit Rule for Archive Member Targets | The implicit rule for archive member targets. | |
11.3 Dangers When Using Archives | Dangers to watch out for when using archives. | |
11.4 Suffix Rules for Archive Files | You can write a special kind of suffix rule for updating archives. | |
Implicit Rule for Archive Member Targets | ||
11.2.1 Updating Archive Symbol Directories | How to update archive symbol directories. | |
[Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Davide Tacchella on November 3, 2010 using texi2html 1.82.