• Complain

John Graham-Cumming - The GNU Make Book

Here you can read online John Graham-Cumming - The GNU Make Book full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2015, publisher: No Starch Press, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

John Graham-Cumming The GNU Make Book
  • Book:
    The GNU Make Book
  • Author:
  • Publisher:
    No Starch Press
  • Genre:
  • Year:
    2015
  • Rating:
    5 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 100
    • 1
    • 2
    • 3
    • 4
    • 5

The GNU Make Book: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "The GNU Make Book" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

GNU make is the most widely used build automation tool, but it can be challenging to master and its terse language can be tough to parse for even experienced programmers. Those who run into difficulties face a long, involved struggle, often leaving unsolved problems behind and GNU makes vast potential untapped.The GNU Make Book demystifies GNU make and shows you how to use its best features. Youll find a fast, thorough rundown of the basics of variables, rules, targets, and makefiles. Learn how to fix wastefully long build times and other common problems, and gain insight into more advanced capabilities, such as complex pattern rules. With this utterly pragmatic manual and cookbook, youll make rapid progress toward becoming a more effective user.Youll also learn how to: Master user-defined functions, variables, and path handling Weigh the pitfalls and advantages of GNU make parallelization Handle automatic dependency generation, rebuilding, and non-recursive make Modify the GNU make source and take advantage of the GNU Make Standard Library Create makefile assertions and debug makefilesGNU make is known for being tricky to use, but it doesnt have to be. If youre looking for a deeper understanding of this indispensable tool, youll find The GNU Make Book to be an indispensable guide.

John Graham-Cumming: author's other books


Who wrote The GNU Make Book? Find out the surname, the name of the author of the book and a list of all author's works by series.

The GNU Make Book — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "The GNU Make Book" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
The GNU Make Book
John Graham-Cumming
Published by No Starch Press
About the Author

John Graham-Cumming is a longtime GNU make expert. He wrote the acclaimed machine learningbased POPFile email filter and successfully petitioned the British government to apologize for its treatment of Alan Turing. He holds a doctorate in computer security from Oxford University and works at CloudFlare.

About the Technical Reviewer

Paul Smith has been the Free Software Foundations GNU make project maintainer since 1996. Hes been using and contributing to free software since the 1980s and to GNU/Linux since 1993. Professionally, he writes networking and database system software. Personally, he enjoys biking and scuba diving with his wife and kids.

Preface

I can no longer remember when I first encountered a make program, but I imagine that, as with many programmers, I was trying to build someone elses software. And like many programmers, I was probably surprised and seduced by the simplicity of makes syntax without realizing the hidden depths and power of this universal program.

After many years of working with a variety of real makefiles, blogging about my findings, and answering GNU make questions from my blog readers, I gained real-world insights and a deep appreciation for GNU make. Many of these insights came from founding a company called Electric Cloud, where one of my projects was to completely replicate the functionality of GNU make. To do so, I absorbed the GNU make manual; wrote countless test makefiles to ensure that my GNU make, written in C++, worked like the real program; and spent hours testing my version against enormous real-world makefiles supplied by our customers.

From my experiences with GNU make came my desire to write a book to share tips, warnings, solutions, and further possibilities, big and small, that would help programmers get the most out of this sometimes difficult but ultimately indispensable program. The core make syntax results in makefiles that are terse and understandable (at least small parts are) but can be difficult to maintain. On the bright side, make provides just enough functionality for software builds without including too many extra features. Many make replacements have found niches but have failed to displace GNU make (and other similar make programs).

I hope this book will be a practical source of help for those of you who wrangle makefiles daily or for anyone who has wondered, Now, how do I do that using make? If youre new to GNU make, I recommend that you start with and work your way through the book. Otherwise, feel free to skip around. In any case, I hope you will find ideas to help you spend less time debugging makefiles and more time running fast builds.

Note

Because GNU make is sensitive about different types of whitespace, whenever a tab character is needed Ive usedfor clarity.

Id particularly like to thank the following people who encouraged me in my makefile hacking and GNU make programming: Mike Maciag, Eric Melski, Usman Muzaffar (who pops up in ), John Ousterhout, and the maintainer of GNU make, Paul Smith. Finally, Im very grateful to the team at No Starch Press who jumped at the idea of publishing a book about GNU make when I emailed them out of the blue; they have been a great team to work with.

Chapter 1. The Basics Revisited

This chapter covers material that might be considered basic GNU make knowledge but covers it to highlight commonly misunderstood functionality and clarify some confusing parts of GNU make. It also covers the differences between GNU make versions 3.79.1, 3.81, 3.82, and 4.0. If youre working with a version prior to 3.79.1, you should probably upgrade.

This chapter is in no way a replacement for the official GNU make manual (Free Software Foundation, 2004). I highly recommend owning a copy of it. You can also find the manual at http://www.gnu.org/make/manual .

Getting Environment Variables into GNU make

Any variable set in the environment when GNU make is started will be available as a GNU make variable inside the makefile. For example, consider the following simple makefile:

$(info $(FOO))

If FOO is set in the environment to foo when GNU make is run, this makefile will output foo, thus verifying that FOO was indeed set to foo inside the makefile. You can discover where FOO got that value by using GNU makes $(origin) function. Try adding to the makefile as follows (the new part is in bold):

$(info $(FOO) $(origin FOO) )

If a variable FOO is defined in the environment and automatically imported into GNU make, $(origin FOO) will have the value environment. When you run the makefile, it should give the output foo environment.

A variable imported from the environment can be overridden inside the makefile. Simply set its value:

FOO=bar $(info $(FOO) $(origin FOO))

This gives the output bar file. Notice how the value of $(origin FOO) has changed from environment to file, indicating that the variable got its value inside a makefile.

Its possible to prevent a definition in a makefile from overriding the environment by specifying the -e (or --environment-overrides) option on the command line of GNU make. Running the preceding makefile with FOO set to foo in the environment and the -e command line option gives the output foo environment override. Notice here that FOO has the value from the environment (foo) and that the output of $(origin FOO) has changed to environment override to inform us that the variable came from the environment, even though it was redefined in the makefile. The word override appears only if a variable definition was actually overridden; the $(origin) function simply returns environment (no override) if the variable being tested was defined in the environment, but there was no attempt to redefine it in the makefile.

If all you care about is whether the variable got its value from the environment, then using $(firstword $(origin VAR)) is always guaranteed to return the string environment if the variable VAR got its value from the environment, regardless of whether -e is specified or not.

Suppose you absolutely want to guarantee that the variable FOO gets its value inside the makefile, not from the environment. You can do this with the override directive:

override FOO=bar$(info $(FOO) $(origin FOO))

This will output bar override regardless of the value of FOO in the environment or whether you specify the -e command line option. Note that $(origin) tells you this is an override by returning override.

The other way to get around -e and set the value of a variable is by setting it on the GNU make command line. For example, revert your makefile to the following:

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «The GNU Make Book»

Look at similar books to The GNU Make Book. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «The GNU Make Book»

Discussion, reviews of the book The GNU Make Book and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.