GNU Make - The GNU Operating System And The Free

2y ago
24 Views
2 Downloads
898.33 KB
224 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Adalynn Cowell
Transcription

GNU Make

GNU MakeA Program for Directing RecompilationGNU make Version 4.3January 2020Richard M. Stallman, Roland McGrath, Paul D. Smith

This file documents the GNU make utility, which determines automatically which pieces ofa 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 GNUmake version 4.3.Copyright c 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 underthe terms of the GNU Free Documentation License, Version 1.3 or any laterversion published by the Free Software Foundation; with no Invariant Sections,with the Front-Cover Texts being “A GNU Manual,” and with the Back-CoverTexts 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 modifythis GNU manual. Buying copies from the FSF supports it in developing GNUand promoting software freedom.”Published by the Free Software Foundation51 Franklin St. – Fifth FloorBoston, MA 02110-1301 USAISBN 1-882114-83-3Cover art by Etienne Suvasa.

iShort Contents1Overview of make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12An Introduction to Makefiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Writing Makefiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1145Writing Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23Writing Recipes in Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436How to Use Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617Conditional Parts of Makefiles . . . . . . . . . . . . . . . . . . . . . . . . . . 8189Functions for Transforming Text . . . . . . . . . . . . . . . . . . . . . . . . 87How to Run make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10310 Using Implicit Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11511 Using make to Update Archive Files . . . . . . . . . . . . . . . . . . . . . 13312 Extending GNU make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13713 Integrating GNU make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14714 Features of GNU make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15115 Incompatibilities and Missing Features . . . . . . . . . . . . . . . . . . 15516 Makefile Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157A Quick Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173BErrors Generated by Make . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181CComplex Makefile Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185D GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . 191Index of Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199Index of Functions, Variables, & Directives . . . . . . . . . . . . . . . . . . . 209

iiiTable of Contents1Overview of make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.11.22An Introduction to Makefiles . . . . . . . . . . . . . . . . . . . 32.12.22.32.42.52.62.73How to Read This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Problems and Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1What 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3456789Writing Makefiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.1What Makefiles Contain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.1.1 Splitting Long Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2 What Name to Give Your Makefile . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.3 Including Other Makefiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.4 The Variable MAKEFILES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.5 How Makefiles Are Remade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.6 Overriding Part of Another Makefile . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.7 How make Reads a Makefile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.8 How Makefiles Are Parsed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.9 Secondary Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194Writing Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.14.24.3Rule Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23Types of Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Using Wildcard Characters in File Names . . . . . . . . . . . . . . . . . . . . . . 254.3.1 Wildcard Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254.3.2 Pitfalls of Using Wildcards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.3.3 The Function wildcard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.4 Searching Directories for Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . 274.4.1 VPATH: Search Path for All Prerequisites . . . . . . . . . . . . . . . . . . 274.4.2 The vpath Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284.4.3 How Directory Searches are Performed . . . . . . . . . . . . . . . . . . . . 294.4.4 Writing Recipes with Directory Search . . . . . . . . . . . . . . . . . . . . 294.4.5 Directory Search and Implicit Rules . . . . . . . . . . . . . . . . . . . . . . . 304.4.6 Directory Search for Link Libraries. . . . . . . . . . . . . . . . . . . . . . . . 304.5 Phony Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.6 Rules without Recipes or Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . 334.7 Empty Target Files to Record Events . . . . . . . . . . . . . . . . . . . . . . . . . . 33

ivGNU make4.8 Special Built-in Target Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344.9 Multiple Targets in a Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364.10 Multiple Rules for One Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384.11 Static Pattern Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384.11.1 Syntax of Static Pattern Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . 394.11.2 Static Pattern Rules versus Implicit Rules . . . . . . . . . . . . . . . 404.12 Double-Colon Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404.13 Generating Prerequisites Automatically . . . . . . . . . . . . . . . . . . . . . . . 415Writing Recipes in Rules . . . . . . . . . . . . . . . . . . . . . . 435.1Recipe Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435.1.1 Splitting Recipe Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435.1.2 Using Variables in Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455.2 Recipe Echoing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455.3 Recipe Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465.3.1 Using One Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465.3.2 Choosing the Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475.4 Parallel Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495.4.1 Output During Parallel Execution . . . . . . . . . . . . . . . . . . . . . . . . 495.4.2 Input During Parallel Execution . . . . . . . . . . . . . . . . . . . . . . . . . . 515.5 Errors in Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515.6 Interrupting or Killing make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525.7 Recursive Use of make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535.7.1 How the MAKE Variable Works. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535.7.2 Communicating Variables to a Sub-make . . . . . . . . . . . . . . . . . . 545.7.3 Communicating Options to a Sub-make . . . . . . . . . . . . . . . . . . . 565.7.4 The ‘--print-directory’ Option. . . . . . . . . . . . . . . . . . . . . . . . . 575.8 Defining Canned Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585.9 Using Empty Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596How to Use Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 616.16.26.3Basics of Variable References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61The Two Flavors of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62Advanced Features for Reference to Variables . . . . . . . . . . . . . . . . . . 646.3.1 Substitution References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646.3.2 Computed Variable Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656.4 How Variables Get Their Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.5 Setting Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.6 Appending More Text to Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696.7 The override Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706.8 Defining Multi-Line Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716.9 Undefining Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726.10 Variables from the Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726.11 Target-specific Variable Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736.12 Pattern-specific Variable Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746.13 Suppressing Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746.14 Other Special Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

v7Conditional Parts of Makefiles . . . . . . . . . . . . . . . . 817.17.27.38Example of a Conditional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81Syntax of Conditionals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82Conditionals that Test Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84Functions for Transforming Text. . . . . . . . . . . . . . Function Call Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87Functions for String Substitution and Analysis . . . . . . . . . . . . . . . . . 88Functions for File Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91Functions for Conditionals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93The foreach Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94The file Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95The call Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96The value Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97The eval Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97The origin Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98The flavor Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100Functions That Control Make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100The shell Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101The guile Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101How to Run make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1039.19.29.39.49.59.69.710Arguments to Specify the Makefile . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103Arguments to Specify the Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103Instead of Executing Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105Avoiding Recompilation of Some Files . . . . . . . . . . . . . . . . . . . . . . . . 106Overriding Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107Testing the Compilation of a Program . . . . . . . . . . . . . . . . . . . . . . . . 108Summary of Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108Using Implicit Rules . . . . . . . . . . . . . . . . . . . . . . . . 11510.1 Using Implicit Rules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11510.2 Catalogue of Built-In Rules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11610.3 Variables Used by Implicit Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11910.4 Chains of Implicit Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12110.5 Defining and Redefining Pattern Rules. . . . . . . . . . . . . . . . . . . . . . . 12310.5.1 Introduction to Pattern Rules . . . . . . . . . . . . . . . . . . . . . . . . . . 12310.5.2 Pattern Rule Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12310.5.3 Automatic Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12410.5.4 How Patterns Match . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12610.5.5 Match-Anything Pattern Rules . . . . . . . . . . . . . . . . . . . . . . . . . 12710.5.6 Canceling Implicit Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12810.6 Defining Last-Resort Default Rules . . . . . . . . . . . . . . . . . . . . . . . . . . 12910.7 Old-Fashioned Suffix Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12910.8 Implicit Rule Search Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

viGNU make11Using make to Update Archive Files . . . . . . . . 13311.1 Archive Members as Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13311.2 Implicit Rule for Archive Member Targets . . . . . . . . . . . . . . . . . . . 13311.2.1 Updating Archive Symbol Directories . . . . . . . . . . . . . . . . . . . 13411.3 Dangers When Using Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13411.4 Suffix Rules for Archive Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13512Extending GNU make . . . . . . . . . . . . . . . . . . . . . . . . 13712.1 GNU Guile Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13712.1.1 Conversion of Guile Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13712.1.2 Interfaces from Guile to make . . . . . . . . . . . . . . . . . . . . . . . . . . . 13812.1.3 Example Using Guile in make . . . . . . . . . . . . . . . . . . . . . . . . . . . 13812.2 Loading Dynamic Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13912.2.1 The load Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14012.2.2 How Loaded Objects Are Remade . . . . . . . . . . . . . . . . . . . . . . 14112.2.3 Loaded Object Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14112.2.4 Example Loaded Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14313Integrating GNU make . . . . . . . . . . . . . . . . . . . . . . . 14713.1 Sharing Job Slots with GNU make . . . . . . . . . . . . . . . . . . . . . . . . . . .13.1.1 POSIX Jobserver Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . .13.1.2 Windows Jobserver Interaction . . . . . . . . . . . . . . . . . . . . . . . . .13.2 Synchronized Terminal Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14714814814914Features of GNU make . . . . . . . . . . . . . . . . . . . . . . . 15115Incompatibilities and Missing Features . . . . 15516Makefile Conventions. . . . . . . . . . . . . . . . . . . . . . . . 15716.1 General Conventions for Makefiles . . . . . . . . . . . . . . . . . . . . . . . . . . . 15716.2 Utilities in Makefiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15816.3 Variables for Specifying Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 15916.4 DESTDIR: Support for Staged Installs . . . . . . . . . . . . . . . . . . . . . . . . 16016.5 Variables for Installation Directories . . . . . . . . . . . . . . . . . . . . . . . . . 16016.6 Standard Targets for Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16516.7 Install Command Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170Appendix AQuick Reference . . . . . . . . . . . . . . . . . . 173Appendix BErrors Generated by Make . . . . . . 181Appendix CComplex Makefile Example . . . . . . 185Appendix D GNU Free Documentation License . . 191

viiIndex of Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199Index of Functions, Variables, & Directives . . . . 209

11 Overview of makeThe make utility automatically determines which pieces of a large program need to berecompiled, and issues commands to recompile them. This manual describes GNU make,which was implemented by Richard Stallman and Roland McGrath. Development sinceVersion 3.76 has been handled by Paul D. Smith.GNU make conforms to section 6.2 of IEEE Standard 1003.2-1992 (POSIX.2).Our examples show C programs, since they are most common, but you can use makewith any programming language whose compiler can be run with a shell command. Indeed,make is not limited to programs. You can use it to describe any task where some files mustbe updated automatically from others whenever the others change.To prepare to use make, you must write a file called the makefile that describes therelationships among files in your program and provides commands for updating each file.In a program, typically, the executable file is updated from object files, which are in turnmade by compiling source files.Once a suitable makefile exists, each time you change some source files, this simple shellcommand:makesuffices to perform all necessary recompilations. The make program uses the makefile database and the last-modification times of the files to decide which of the files need to beupdated. For each of those files, it issues the recipes recorded in the data base.You can provide command line arguments to make to control which files should berecompiled, or how. See Chapter 9 [How to Run make], page 103.1.1 How to Read This ManualIf you are new to make, or are looking for a general introduction, read the first few sectionsof each chapter, skipping the later sections. In each chapter, the first few sections containintroductory or general information and the later sections contain specialized or technicalinformation. The exception is Chapter 2 [An Introduction to Makefiles], page 3, all of whichis introductory.If you are familiar with other make programs, see Chapter 14 [Features of GNU make],page 151, which lists the enhancements GNU make has, and Chapter 15 [Incompatibilitiesand Missing Features], page 155, which explains the few things GNU make lacks that othershave.For a quick summary, see Section 9.7 [Options Summary], page 108, Appendix A [QuickReference], page 173, and Section 4.8 [Special Targets], page 34.1.2 Problems and BugsIf you have problems with GNU make or think you’ve found a bug, please report it to thedevelopers; we cannot promise to do anything but we might well want to fix it.Before reporting a bug, make sure you’ve actually found a real bug. Carefully rereadthe documentation and see if it really says you can do what you’re trying to do. If it’s notclear whether you should be able to do something or not, report that too; it’s a bug in thedocumentation!

2GNU makeBefore reporting a bug or trying to fix it yourself, try to isolate it to the smallest possiblemakefile that reproduces the problem. Then send us the makefile and the exact results makegave you, including any error or warning messages. Please don’t paraphrase these messages:it’s best to cut and paste them into your report. When generating this small makefile, besure to not use any non-free or unusual tools in your recipes: you can almost always emulatewhat such a tool would do with simple shell commands. Finally, be sure to explain whatyou expected to occur; this will help us decide whether the problem was really in thedocumentation.Once you have a precise problem you can report it in one of two ways. Either sendelectronic mail to:bug-make@gnu.orgor use our Web-based project management tool, at:http://savannah.gnu.org/projects/make/In addition to the information above, please be careful to include the version number ofmake you are using. You can get this information with the command ‘make --version’. Besure also to include the type of machine and operating system you are using. One way toobtain this information is by looking at the final lines of output from the command ‘make--help’.

32 An Introduction to MakefilesYou need a file called a makefile to tell make what to do. Most often, the makefile tells makehow to compile and link a program.In this chapter, we will discuss a simple makefile that describes how to compile and linka text editor which consists of eight C source files and three header files. The makefile canalso tell make how to run miscellaneous commands when explicitly asked (for example, toremove certain files as a clean-up operation). To see a more complex example of a makefile,see Appendix C [Complex Makefile], page 185.When make recompiles the editor, each changed C source file must be recompiled. If aheader file has changed, each C source file that includes the header file must be recompiled tobe safe. Each compilation produces an object file corresponding to the source file. Finally,if any source file has been recompiled, all the object files, whether newly made or savedfrom previous compilations, must be linked together to produce the new executable editor.2.1 What a Rule Looks LikeA simple makefile consists of “rules” with the following shape:target . : prerequisites .recipe.A target is usually the name of a file that is generated by a program; examples of targetsare executable or object files. A target can also be the name of an action to carry out, suchas ‘clean’ (see Section 4.5 [Phony Targets], page 31).A prerequisite is a file that is used as input to create the target. A target often dependson several files.A recipe is an action that make carries out. A recipe may have more than one command,either on the same line or each on its own line. Please note: you need to put a tab characterat the beginning of every recipe line! This is an obscurity that catches the unwary. If youprefer to prefix your recipes with a character other than tab, you can set the .RECIPEPREFIXvariable to an alternate character (see Section 6.14 [Special Variables], page 75).Usually a recipe is in a rule with prerequisites and serves to create a target file if any ofthe prerequisites change. However, the rule that specifies a recipe for the target need nothave prerequisites. For example, the rule containing the delete command associated withthe target ‘clean’ does not have prerequisites.A rule, then, explains how and when to remake certain files which are the targets ofthe particular rule. make carries out the recipe on the prerequisites to create or updatethe target. A rule can also explain how and when to carry out an action. See Chapter 4[Writing Rules], page 23.A makefile may contain other text besides rules, but a simple makefile need only containrules. Rules may look somewhat more complicated than shown in this template, but all fitthe pattern more or less.

4GNU make2.2 A Simple MakefileHere is a straightforward makefile that describes the way an executable file called editdepends on eight object files which, in turn, depend on eight C source and three headerfiles.In this example, all the C files include defs.h, but only those defining editing commandsinclude command.h, and only low level files that change the editor buffer include buffer.h.edit : main.o kbd.o command.o display.o \insert.o search.o files.o utils.occ -o edit main.o kbd.o command.o display.o \insert.o search.o files.o utils.omain.o : main.c defs.hcc -c main.ckbd.o : kbd.c defs.h command.hcc -c kbd.ccommand.o : command.c defs.h command.hcc -c command.cdisplay.o : display.c defs.h buffer.hcc -c display.cinsert.o : insert.c defs.h buffer.hcc -c insert.csearch.o : search.c defs.h buffer.hcc -c search.cfiles.o : files.c defs.h buffer.h command.hcc -c files.cutils.o : utils.c defs.hcc -c utils.cclean :rm edit main.o kbd.o command.o display.o \insert.o search.o files.o utils.oWe split each long line into two lines using backslash/newline; this is like using one longline, but is easier to read. See Section 3.1.1 [Splitting Long Lines], page 12.To use this makefile to create the executable file called edit, type:makeTo use this makefile to delete the executable file and all the object files from the directory,type:make cleanIn the example makefile, the targets include the executable file ‘edit’, and the objectfiles ‘main.o’ and ‘kbd.o’. The prerequisites are files such as ‘main.c’ and ‘defs.h’. Infact, each ‘.o’ file is both a target and a prerequisite. Recipes include ‘cc -c main.c’ and‘cc -c kbd.c’.When a target is a file, it needs to be recompiled or relinked if any of its prerequisiteschange. In addition, any prerequisites that are themselves automatically generated shouldbe updated first. In this example, edit depends on each of the eight object files; the objectfile main.o depends on the source file main.c and on the header file defs.h.

Chapter 2: An Introduction to Makefiles5A recipe may follow each line that contains a target and prerequisites. These recipes sayhow to update the target file. A tab character (or whatever character is specified by the.RECIPEPREFIX variable; see Section 6.14 [Special Variables], page 75) must come at thebeginning of every line in the recipe to distinguish recipes from other lines in the makefile.(Bear in mind that make does not know anything about how the recipes work. It is up toyou to supply recipes that will update the target file properly. All make does is execute therecipe you have specified when the target file needs to be updated.)The target ‘clean’ is not a file, but merely the name of an action. Since you normallydo not want to carry out the actions in this rule, ‘clean’ is not a prerequisite of any otherrule. Consequently, make never does anything with it unless you tell it specifically. Notethat this rule not only is not a prerequisite, it also does not have any prerequisites, so theonly purpose of the rule is to run the specified recipe. Targets that do not refer to filesbut are just actions are called phony targets. See Section 4.5 [Phony Targets], page 31, forinformation about this kind of target. See Section 5.5 [Errors in Recipes], page 51, to seehow to cause make to ignore errors from rm or any other command.2.3 How make Processes a MakefileBy default, make starts with the first target (not targets whose names start with ‘.’). Thisis called the default goal. (Goals are the targets that make strives ultimately to update. Youcan override this behavior using the command line (see Section 9.2 [Arguments to Specifythe Goals], page 103) or with the .DEFAULT GOAL special variable (see Section 6.14 [OtherSpecial Variables], page 75).In the simple example of the previous section, the default goal is to update the executableprogram edit; therefore, we put that rule first.Thus, when you give the command:makemake reads the makefile in the current directory and begins by processing the first rule. Inthe example, this rule is for relinking edit; but before make c

Jan 17, 2020 · 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 en

Related Documents:

May 02, 2018 · D. Program Evaluation ͟The organization has provided a description of the framework for how each program will be evaluated. The framework should include all the elements below: ͟The evaluation methods are cost-effective for the organization ͟Quantitative and qualitative data is being collected (at Basics tier, data collection must have begun)

Silat is a combative art of self-defense and survival rooted from Matay archipelago. It was traced at thé early of Langkasuka Kingdom (2nd century CE) till thé reign of Melaka (Malaysia) Sultanate era (13th century). Silat has now evolved to become part of social culture and tradition with thé appearance of a fine physical and spiritual .

On an exceptional basis, Member States may request UNESCO to provide thé candidates with access to thé platform so they can complète thé form by themselves. Thèse requests must be addressed to esd rize unesco. or by 15 A ril 2021 UNESCO will provide thé nomineewith accessto thé platform via their émail address.

̶The leading indicator of employee engagement is based on the quality of the relationship between employee and supervisor Empower your managers! ̶Help them understand the impact on the organization ̶Share important changes, plan options, tasks, and deadlines ̶Provide key messages and talking points ̶Prepare them to answer employee questions

Dr. Sunita Bharatwal** Dr. Pawan Garga*** Abstract Customer satisfaction is derived from thè functionalities and values, a product or Service can provide. The current study aims to segregate thè dimensions of ordine Service quality and gather insights on its impact on web shopping. The trends of purchases have

programming as well. In fact, while this guide is written and intended as an introduction to Octave, it can serve equally well as a basic introduction to MATLAB. What is GNU? A gnu is a type of antelope, but GNU is a free, UNIX-like computer operating system. GNU is a recursive acronym that stands for \GNU's not Unix." GNU Octave (and

bug-gnubg@gnu.orgor make abug report. All about GNU Backgammon iii COLLABORATORS TITLE : All about GNU Backgammon ACTION NAME DATE SIGNATURE WRITTEN BY Albert Silver and Christian Anthon July 23, 2018 REVISION HISTORY NUMBER DATE DESCRIPTION NAME All about GNU Backgammon March 2007 The GNU Backgammon Project All about GNU March 2007 Albert .

Chính Văn.- Còn đức Thế tôn thì tuệ giác cực kỳ trong sạch 8: hiện hành bất nhị 9, đạt đến vô tướng 10, đứng vào chỗ đứng của các đức Thế tôn 11, thể hiện tính bình đẳng của các Ngài, đến chỗ không còn chướng ngại 12, giáo pháp không thể khuynh đảo, tâm thức không bị cản trở, cái được