Example: barber

GNU Make

GNU MakeGNU MakeA Program for Directing RecompilationGNUmakeVersion 2020 Richard M. Stallman, Roland McGrath, Paul D. SmithThis file documents the GNUmakeutility, which determines automatically which pieces ofa large program need to be recompiled, and issues the commands to recompile is Edition , last updated 17 January 2020, ofThe gnu make manual , for GNUmakeversion 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, is granted to copy, distribute and/or modify this document underthe terms of the GNU Free Documentation License, Version or any laterversion published by the Free Software Foundation.

Jan 17, 2020 · 7 Conditional Parts of Makefiles::::: 81 7.1 Example of a Conditional::::: 81 ... The make utility automatically determines which pieces of a large program need to be recompiled, and issues commands to recompile them. This manual describes GNU make, which was implemented by Richard Stallman and Roland McGrath. Development since

Tags:

  Manual, Make, Part, Gnu make

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of GNU Make

1 GNU MakeGNU MakeA Program for Directing RecompilationGNUmakeVersion 2020 Richard M. Stallman, Roland McGrath, Paul D. SmithThis file documents the GNUmakeutility, which determines automatically which pieces ofa large program need to be recompiled, and issues the commands to recompile is Edition , last updated 17 January 2020, ofThe gnu make manual , for GNUmakeversion 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, is granted to copy, distribute and/or modify this document underthe terms of the GNU Free Documentation License, Version or any laterversion published by the Free Software Foundation.

2 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-3 Cover art by Etienne Contents1 Overview Introduction to Recipes in to Use Parts of for Transforming to Using Implicit Usingmaketo Update Archive Extending Integrating Features of Incompatibilities and Missing Makefile Generated by Makefile Free Documentation of of Functions, Variables.

3 & of Contents1 Overview How to Read This Problems and An Introduction to What a Rule Looks A Simple HowmakeProcesses a Variables make Makefiles LettingmakeDeduce the Another Style of Rules for Cleaning the Writing What Makefiles Splitting Long What Name to Give Your Including Other The How Makefiles Are Overriding part of Another HowmakeReads a How Makefiles Are Secondary Writing Rule Types of Using Wildcard Characters in File Wildcard Pitfalls of Using The Searching Directories for : Search Path for All How Directory Searches are Writing Recipes with Directory Directory Search and Implicit Directory Search for Link Phony Rules without Recipes or Empty Target Files to Record Special Built-in Target Multiple Targets in a Multiple Rules for One Static Pattern Syntax of Static Pattern Static Pattern Rules versus Implicit Double-Colon Generating Prerequisites Writing Recipes in Recipe Splitting Recipe Using Variables in Recipe Recipe Using One Choosing the Parallel Output During Parallel Input During Parallel Errors in Interrupting or Recursive

4 Use How theMAKEV ariable Communicating Variables to a Communicating Options to a The --print-directory Defining Canned Using Empty How to Use Basics of Variable The Two Flavors of Advanced Features for Reference to Substitution Computed Variable How Variables Get Their Setting Appending More Text to Defining Multi-Line Undefining Variables from the Target-specific Variable Pattern-specific Variable Suppressing Other Special Conditional Parts of Example of a Syntax of Conditionals that Test Functions for Transforming Function Call Functions for String Substitution and Functions for File Functions for Functions That Control How to Arguments to Specify the Arguments to Specify the Instead of Executing Avoiding Recompilation of Some Overriding Testing the Compilation of a Summary of Using Implicit Using Implicit Catalogue of Built-In Variables Used by Implicit Chains of Implicit Defining and Redefining Pattern Introduction to Pattern Pattern Rule Automatic How Patterns Match-Anything Pattern Canceling Implicit Defining Last-Resort Default Old-Fashioned Suffix Implicit Rule Search

5 Usingmaketo Update Archive Archive Members as Implicit Rule for Archive Member Updating Archive Symbol Dangers When Using Suffix Rules for Archive Extending GNU Guile Conversion of Guile Interfaces from Guile Example Using Guile Loading Dynamic How Loaded Objects Are Loaded Object Example Loaded Integrating Sharing Job Slots with POSIX Jobserver Windows Jobserver Synchronized Terminal Features of Incompatibilities and Missing Makefile General Conventions for Utilities in Variables for Specifying : Support for Staged Variables for Installation Standard Targets for Install Command A Quick B Errors Generated by C Complex Makefile D GNU Free Documentation of of Functions, Variables, & Overview ofmakeThemakeutility automatically determines which pieces of a large program need to berecompiled, and issues commands to recompile them.

6 This manual describes GNUmake,which was implemented by Richard Stallman and Roland McGrath. Development sinceVersion has been handled by Paul D. to section ofIEEE Standard ( ).Our examples show C programs, since they are most common, but you can usemakewith any programming language whose compiler can be run with a shell command. Indeed,makeis not limited to programs. You can use it to describe any task where some files mustbe updated automatically from others whenever the others prepare to usemake, you must write a file called themakefilethat describes therelationships among files in your program and provides commands for updating each a program, typically, the executable file is updated from object files, which are in turnmade by compiling source a suitable makefile exists, each time you change some source files, this simple shellcommand:makesuffices to perform all necessary recompilations.

7 Themakeprogram 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 can provide command line arguments tomaketo control which files should berecompiled, or how. SeeChapter 9 [How to Runmake], page How to Read This ManualIf you are new tomake, 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 isChapter 2 [An Introduction to Makefiles], page 3, all of whichis you are familiar with othermakeprograms, seeChapter 14 [Features of GNUmake],page 151, which lists the enhancements GNUmakehas, andChapter 15 [Incompatibilitiesand Missing Features], page 155, which explains the few things GNUmakelacks that a quick summary, seeSection [Options Summary], page 108,Appendix A [QuickReference], page 173, andSection [Special Targets], page Problems and BugsIf you have problems with GNUmakeor think you ve found a bug, please report it to thedevelopers; we cannot promise to do anything but we might well want to fix reporting a bug, make sure you ve actually found a real bug.

8 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!2 GNUmakeBefore 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 resultsmakegave 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.

9 Finally, be sure to explain whatyou expected to occur; this will help us decide whether the problem was really in you have a precise problem you can report it in one of two ways. Either sendelectronic mail use our Web-based project management tool, at: addition to the information above, please be careful to include the version number ofmakeyou 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 amakefileto tellmakewhat to do.

10 Most often, the makefile tellsmakehow to compile and link a 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 tellmakehow 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,seeAppendix C [Complex Makefile], page 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 What a Rule Looks LikeA simple makefile consists of rules with the following usually the name of a file that is generated by a program; examples of targetsare executable or object files.


Related search queries