📄 make.html
字号:
<li><a href="#Archive-Pitfalls">11.3 Dangers When Using Archives</a><li><a href="#Archive-Suffix-Rules">11.4 Suffix Rules for Archive Files</a></li></ul><li><a name="toc_Features" href="#Features">12 Features of GNU <code>make</code></a><li><a name="toc_Missing" href="#Missing">13 Incompatibilities and Missing Features</a><li><a name="toc_Makefile-Conventions" href="#Makefile-Conventions">14 Makefile Conventions</a><ul><li><a href="#Makefile-Basics">14.1 General Conventions for Makefiles</a><li><a href="#Utilities-in-Makefiles">14.2 Utilities in Makefiles</a><li><a href="#Command-Variables">14.3 Variables for Specifying Commands</a><li><a href="#Directory-Variables">14.4 Variables for Installation Directories</a><li><a href="#Standard-Targets">14.5 Standard Targets for Users</a><li><a href="#Install-Command-Categories">14.6 Install Command Categories</a></li></ul><li><a name="toc_Quick-Reference" href="#Quick-Reference">Appendix A Quick Reference</a><li><a name="toc_Error-Messages" href="#Error-Messages">Appendix B Errors Generated by Make</a><li><a name="toc_Complex-Makefile" href="#Complex-Makefile">Appendix C Complex Makefile Example</a><li><a name="toc_GNU-Free-Documentation-License" href="#GNU-Free-Documentation-License">Appendix D GNU Free Documentation License</a><ul><li><a href="#GNU-Free-Documentation-License">D.1 ADDENDUM: How to use this License for your documents</a></li></ul><li><a name="toc_Concept-Index" href="#Concept-Index">Index of Concepts</a><li><a name="toc_Name-Index" href="#Name-Index">Index of Functions, Variables, & Directives</a></li></ul></div><div class="node"><p><hr><a name="Top"></a>Next: <a rel="next" accesskey="n" href="#Overview">Overview</a>,Previous: <a rel="previous" accesskey="p" href="#dir">(dir)</a>,Up: <a rel="up" accesskey="u" href="#dir">(dir)</a></div><h2 class="unnumbered">GNU <code>make</code></h2><p>This file documents the GNU <code>make</code> utility, which determinesautomatically which pieces of a large program need to be recompiled,and issues the commands to recompile them. <p>This is Edition 0.70, last updated 1 April 2006,of <cite>The GNU Make Manual</cite>, for GNU <code>make</code> version 3.81. <p>Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006Free Software Foundation, Inc. <blockquote>Permission is granted to copy, distribute and/or modify this documentunder the terms of the GNU Free Documentation License, Version 1.2 orany later version published by the Free Software Foundation; with noInvariant Sections, with the Front-Cover Texts being “A GNU Manual,”and with the Back-Cover Texts as in (a) below. A copy of thelicense is included in the section entitled “GNU Free DocumentationLicense.” <p>(a) The FSF's Back-Cover Text is: “You have freedom to copy and modifythis GNU Manual, like GNU software. Copies published by the FreeSoftware Foundation raise funds for GNU development.”</blockquote><ul class="menu"><li><a accesskey="1" href="#Overview">Overview</a>: Overview of <code>make</code>. <li><a accesskey="2" href="#Introduction">Introduction</a>: An introduction to <code>make</code>. <li><a accesskey="3" href="#Makefiles">Makefiles</a>: Makefiles tell <code>make</code> what to do. <li><a accesskey="4" href="#Rules">Rules</a>: Rules describe when a file must be remade. <li><a accesskey="5" href="#Commands">Commands</a>: Commands say how to remake a file. <li><a accesskey="6" href="#Using-Variables">Using Variables</a>: You can use variables to avoid repetition. <li><a accesskey="7" href="#Conditionals">Conditionals</a>: Use or ignore parts of the makefile based on the values of variables. <li><a accesskey="8" href="#Functions">Functions</a>: Many powerful ways to manipulate text. <li><a accesskey="9" href="#Running">Invoking make</a>: How to invoke <code>make</code> on the command line. <li><a href="#Implicit-Rules">Implicit Rules</a>: Use implicit rules to treat many files alike, based on their file names. <li><a href="#Archives">Archives</a>: How <code>make</code> can update library archives. <li><a href="#Features">Features</a>: Features GNU <code>make</code> has over other <code>make</code>s. <li><a href="#Missing">Missing</a>: What GNU <code>make</code> lacks from other <code>make</code>s. <li><a href="#Makefile-Conventions">Makefile Conventions</a>: Conventions for writing makefiles for GNU programs. <li><a href="#Quick-Reference">Quick Reference</a>: A quick reference for experienced users. <li><a href="#Error-Messages">Error Messages</a>: A list of common errors generated by <code>make</code>. <li><a href="#Complex-Makefile">Complex Makefile</a>: A real example of a straightforward, but nontrivial, makefile.<li><a href="#GNU-Free-Documentation-License">GNU Free Documentation License</a>: License for copying this manual<li><a href="#Concept-Index">Concept Index</a>: Index of Concepts<li><a href="#Name-Index">Name Index</a>: Index of Functions, Variables, & Directives</li></ul><p>--- The Detailed Node Listing ---<p>Overview of <code>make</code></p><ul class="menu"><li><a href="#Preparing">Preparing</a>: Preparing and Running Make<li><a href="#Reading">Reading</a>: On Reading this Text<li><a href="#Bugs">Bugs</a>: Problems and Bugs</li></ul><p>An Introduction to Makefiles</p><ul class="menu"><li><a href="#Rule-Introduction">Rule Introduction</a>: What a rule looks like. <li><a href="#Simple-Makefile">Simple Makefile</a>: A Simple Makefile<li><a href="#How-Make-Works">How Make Works</a>: How <code>make</code> Processes This Makefile<li><a href="#Variables-Simplify">Variables Simplify</a>: Variables Make Makefiles Simpler<li><a href="#make-Deduces">make Deduces</a>: Letting <code>make</code> Deduce the Commands<li><a href="#Combine-By-Prerequisite">Combine By Prerequisite</a>: Another Style of Makefile<li><a href="#Cleanup">Cleanup</a>: Rules for Cleaning the Directory</li></ul><p>Writing Makefiles</p><ul class="menu"><li><a href="#Makefile-Contents">Makefile Contents</a>: What makefiles contain. <li><a href="#Makefile-Names">Makefile Names</a>: How to name your makefile. <li><a href="#Include">Include</a>: How one makefile can use another makefile. <li><a href="#MAKEFILES-Variable">MAKEFILES Variable</a>: The environment can specify extra makefiles. <li><a href="#MAKEFILE_005fLIST-Variable">MAKEFILE_LIST Variable</a>: Discover which makefiles have been read. <li><a href="#Special-Variables">Special Variables</a>: Other special variables. <li><a href="#Remaking-Makefiles">Remaking Makefiles</a>: How makefiles get remade. <li><a href="#Overriding-Makefiles">Overriding Makefiles</a>: How to override part of one makefile with another makefile. <li><a href="#Reading-Makefiles">Reading Makefiles</a>: How makefiles are parsed. <li><a href="#Secondary-Expansion">Secondary Expansion</a>: How and when secondary expansion is performed.</li></ul><p>Writing Rules</p><ul class="menu"><li><a href="#Rule-Example">Rule Example</a>: An example explained. <li><a href="#Rule-Syntax">Rule Syntax</a>: General syntax explained. <li><a href="#Prerequisite-Types">Prerequisite Types</a>: There are two types of prerequisites. <li><a href="#Wildcards">Wildcards</a>: Using wildcard characters such as `*'. <li><a href="#Directory-Search">Directory Search</a>: Searching other directories for source files. <li><a href="#Phony-Targets">Phony Targets</a>: Using a target that is not a real file's name. <li><a href="#Force-Targets">Force Targets</a>: You can use a target without commands or prerequisites to mark other targets as phony. <li><a href="#Empty-Targets">Empty Targets</a>: When only the date matters and the files are empty. <li><a href="#Special-Targets">Special Targets</a>: Targets with special built-in meanings. <li><a href="#Multiple-Targets">Multiple Targets</a>: When to make use of several targets in a rule. <li><a href="#Multiple-Rules">Multiple Rules</a>: How to use several rules with the same target. <li><a href="#Static-Pattern">Static Pattern</a>: Static pattern rules apply to multiple targets and can vary the prerequisites according to the target name. <li><a href="#Double_002dColon">Double-Colon</a>: How to use a special kind of rule to allow several independent rules for one target. <li><a href="#Automatic-Prerequisites">Automatic Prerequisites</a>: How to automatically generate rules giving prerequisites from source files themselves.</li></ul><p>Using Wildcard Characters in File Names</p><ul class="menu"><li><a href="#Wildcard-Examples">Wildcard Examples</a>: Several examples<li><a href="#Wildcard-Pitfall">Wildcard Pitfall</a>: Problems to avoid. <li><a href="#Wildcard-Function">Wildcard Function</a>: How to cause wildcard expansion where it does not normally take place.</li></ul><p>Searching Directories for Prerequisites</p><ul class="menu"><li><a href="#General-Search">General Search</a>: Specifying a search path that applies to every prerequisite. <li><a href="#Selective-Search">Selective Search</a>: Specifying a search path for a specified class of names. <li><a href="#Search-Algorithm">Search Algorithm</a>: When and how search paths are applied. <li><a href="#Commands_002fSearch">Commands/Search</a>: How to write shell commands that work together with search paths. <li><a href="#Implicit_002fSearch">Implicit/Search</a>: How search paths affect implicit rules. <li><a href="#Libraries_002fSearch">Libraries/Search</a>: Directory search for link libraries.</li></ul><p>Static Pattern Rules</p><ul class="menu"><li><a href="#Static-Usage">Static Usage</a>: The syntax of static pattern rules. <li><a href="#Static-versus-Implicit">Static versus Implicit</a>: When are they better than implicit rules?</li></ul><p>Writing the Commands in Rules</p><ul class="menu"><li><a href="#Command-Syntax">Command Syntax</a>: Command syntax features and pitfalls. <li><a href="#Echoing">Echoing</a>: How to control when commands are echoed. <li><a href="#Execution">Execution</a>: How commands are executed. <li><a href="#Parallel">Parallel</a>: How commands can be executed in parallel. <li><a href="#Errors">Errors</a>: What happens after a command execution error. <li><a href="#Interrupts">Interrupts</a>: What happens when a command is interrupted. <li><a href="#Recursion">Recursion</a>: Invoking <code>make</code> from makefiles. <li><a href="#Sequences">Sequences</a>: Defining canned sequences of commands. <li><a href="#Empty-Commands">Empty Commands</a>: Defining useful, do-nothing commands.</li></ul><p>Command Syntax</p><ul class="menu"><li><a href="#Splitting-Lines">Splitting Lines</a>: Breaking long command lines for readability. <li><a href="#Variables-in-Commands">Variables in Commands</a>: Using <code>make</code> variables in commands.</li></ul><p>Command Execution</p><ul class="menu"><li><a href="#Choosing-the-Shell">Choosing the Shell</a>: How <code>make</code> chooses the shell used to run commands.</li></ul><p>Recursive Use of <code>make</code></p><ul class="menu"><li><a href="#MAKE-Variable">MAKE Variable</a>: The special effects of using `<samp><span class="samp">$(MAKE)</span></samp>'. <li><a href="#Variables_002fRecursion">Variables/Recursion</a>: How to communicate variables to a sub-<code>make</code>. <li><a href="#Options_002fRecursion">Options/Recursion</a>: How to communicate options to a sub-<code>make</code>. <li><a href="#g_t_002dw-Option">-w Option</a>: How the `<samp><span class="samp">-w</span></samp>' or `<samp><span class="samp">--print-directory</span></samp>' option helps debug use of recursive <code>make</code> commands.</li></ul><p>How to Use Variables</p><ul class="menu"><li><a href="#Reference">Reference</a>: How to use the value of a variable. <li><a href="#Flavors">Flavors</a>: Variables come in two flavors. <li><a href="#Advanced">Advanced</a>: Advanced features for referencing a variable. <li><a href="#Values">Values</a>: All the ways variables get their values. <li><a href="#Setting">Setting</a>: How to set a variable in the makefile.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -