maketo Update Archive Files
maketo Update Archive Files
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.75, last updated 17 January 2020,
of The GNU Make Manual, for GNU
make version 4.3.
Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 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.3 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.”
An introduction to
make what to do.
Rules describe when a file must be remade.
Recipes say how to remake a file.
You can use variables to avoid repetition.
Use or ignore parts of the makefile based on the values of variables.
Many powerful ways to manipulate text.
How to invoke
make on the command line.
Use implicit rules to treat many files alike, based on their file names.
make can update library archives.
Using extensions to
make with other tools.
make has over other
make lacks from other
Conventions for writing makefiles for GNU programs.
A quick reference for experienced users.
A list of common errors generated by
A real example of a straightforward, but nontrivial, makefile.
License for copying this manual.
Index of Concepts.
Index of Functions, Variables, & Directives.
— The Detailed Node Listing — Overview of make
Preparing and running
On reading this text.
Problems and bugs.
An Introduction to Makefiles
What a rule looks like.
A simple makefile.
make processes this makefile.
Variables make makefiles simpler.
make deduce the recipes.
Another style of makefile.
Rules for cleaning the directory.
What makefiles contain.
How to name your makefile.
How one makefile can use another makefile.
The environment can specify extra makefiles.
How makefiles get remade.
How to override part of one makefile with another makefile.
How makefiles are read in.
How makefiles are parsed.
How and when secondary expansion is performed.
What Makefiles Contain
Splitting long lines in makefiles
An example explained.
General syntax explained.
There are two types of prerequisites.
Using wildcard characters such as ‘*’.
Searching other directories for source files.
Using a target that is not a real file’s name.
You can use a target without a recipe or prerequisites to mark other targets as phony.
When only the date matters and the files are empty.
Targets with special built-in meanings.
When to make use of several targets in a rule.
How to use several rules with the same target.
Static pattern rules apply to multiple targets and can vary the prerequisites according to the target name.
How to use a special kind of rule to allow several independent rules for one target.
How to automatically generate rules giving prerequisites from source files themselves.
Using Wildcard Characters in File Names
Problems to avoid.
How to cause wildcard expansion where it does not normally take place.
Searching Directories for Prerequisites
Specifying a search path that applies to every prerequisite.
Specifying a search path for a specified class of names.
When and how search paths are applied.
How to write recipes that work together with search paths.
How search paths affect implicit rules.
Directory search for link libraries.
Static Pattern Rules
The syntax of static pattern rules.
When are they better than implicit rules?
Writing Recipes in Rules
Recipe syntax features and pitfalls.
How to control when recipes are echoed.
How recipes are executed.
How recipes can be executed in parallel.
What happens after a recipe execution error.
What happens when a recipe is interrupted.
make from makefiles.
Defining canned recipes.
Defining useful, do-nothing recipes.
Breaking long recipe lines for readability.
make variables in recipes.
One shell for all lines in a recipe.
make chooses the shell used
to run recipes.
Handling output during parallel execution
Handling input during parallel execution
Recursive Use of make
The special effects of using ‘
How to communicate variables to a sub-
How to communicate options to a sub-
How the ‘
-w’ or ‘
helps debug use of recursive
How to Use Variables
How to use the value of a variable.
Variables come in two flavors.
Advanced features for referencing a variable.
All the ways variables get their values.
How to set a variable in the makefile.
How to append more text to the old value of a variable.
How to set a variable in the makefile even if the user has set it with a command argument.
An alternate way to set a variable to a multi-line string.
How to undefine a variable so that it appears as if it was never set.
Variable values can come from the environment.
Variable values can be defined on a per-target basis.
Target-specific variable values can be applied to a group of targets that match a pattern.
Suppress inheritance of variables.
Variables with special meaning or behavior.
Advanced Features for Reference to Variables
Referencing a variable with substitutions on the value.
Computing the name of the variable to refer to.
Conditional Parts of Makefiles
Example of a conditional
The syntax of conditionals.
Conditionals that test flags.
Functions for Transforming Text
How to write a function call.
General-purpose text manipulation functions.
Functions for manipulating file names.
Functions that implement conditions.
Repeat some text with controlled variation.
Write text to a file.
Expand a user-defined function.
Return the un-expanded value of a variable.
Evaluate the arguments as makefile syntax.
Find where a variable got its value.
Find out the flavor of a variable.
Functions that control how make runs.
Substitute the output of a shell command.
Use GNU Guile embedded scripting language.
How to Run make
How to specify which makefile to use.
How to use goal arguments to specify which parts of the makefile to use.
How to use mode flags to specify what kind of thing to do with the recipes in the makefile other than simply execute them.
How to avoid recompiling certain files.
How to override a variable to specify an alternate compiler and other things.
How to proceed past some errors, to test compilation.
Summary of Options
Using Implicit Rules
How to use an existing implicit rule to get the recipes for updating a file.
A list of built-in rules.
How to change what predefined rules do.
How to use a chain of implicit rules.
How to define new implicit rules.
How to define a recipe for rules which cannot find any.
The old-fashioned style of implicit rule.
The precise algorithm for applying implicit rules.
Defining and Redefining Pattern Rules
An introduction to pattern rules.
Examples of pattern rules.
How to use automatic variables in the recipe of implicit rules.
How patterns match.
Precautions you should take prior to defining rules that can match any target file whatever.
How to override or cancel built-in rules.
Using make to Update Archive Files
Archive members as targets.
The implicit rule for archive member targets.
Dangers to watch out for when using archives.
You can write a special kind of suffix rule for updating archives.
Implicit Rule for Archive Member Targets
How to update archive symbol directories.
Extending GNU make
Using Guile as an embedded scripting language.
Loading dynamic objects as extensions.
GNU Guile Integration
Converting Guile types to
make functions from Guile.
Example using Guile in
Loading Dynamic Objects
Loading dynamic objects as extensions.
How loaded objects get remade.
Programmatic interface for loaded objects.
Example of a loaded object
Integrating GNU make
Share job slots with GNU
Control output to terminals.
Sharing Job Slots with GNU make
Using the jobserver on POSIX systems.
Using the jobserver on Windows systems.