Synopses & Reviews
GNU Make is the ultimate utility for automatically building programs from source files. But even though GNU Make is the go-to tool for developers and end users needing to build, update, and install packages, it remains notoriously tricky to understand and use correctly. Learners and regular users who run into problems face a long, confusing struggle, often leaving GNU Make's full potential untapped.
GNU Make Book demystifies GNU Make and highlights its most powerful features. Author John Graham-Cumming combines a fast but thorough rundown of the basics with handy solutions to common problems and deeper insights into GNU Make's most useful capabilities. Part manual, part recipe book, GNU Make Book fully equips you to use GNU Make confidently and effectively in the situations you'll inevitably encounter.
In this book, you'll learn about:
- User-defined functions, macros, and path handling
- Creating makefile assertions and debugging makefiles
- The pitfalls and benefits of GNU Make parallelization
- Automatic dependency generation, rebuilding targets, and non-recursive Make
- Using the GNU Make Standard Library
GNU Make Book is the first new guide to GNU Make in ten years, and comes recommended by the official GNU Make maintainer. With its easygoing, tutorial-like approach to teaching, solving issues, and helping you take advantage of what's great about this essential utility,
GNU Make Book will ensure that you know GNU Make inside and out.
Synopsis
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 make's vast potential untapped.
The GNU Make Book demystifies GNU make and shows you how to use its best features. You'll 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, you'll make rapid progress toward becoming a more effective user.
You'll 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 makefiles
GNU make is known for being tricky to use, but it doesn't have to be. If you're looking for a deeper understanding of this indispensable tool, you'll find The GNU Make Book to be an indispensable guide.
About the Author
John Graham-Cumming is a longtime GNU Make expert and the creator of the GNU Make Standard Library. He wrote the acclaimed POPFile email filter, co-founded Electric Cloud, Inc., and, in 2009, got the British government to apologize for mistreating Alan Turing. Graham-Cumming holds a doctorate in computer security from Oxford University and currently works at CloudFlare. He is the proud owner of a three-letter domain name where he hosts his web site: http://www.jgc.org.
Table of Contents
About the Author; About the Technical Reviewer; Preface; Chapter 1: The Basics Revisited; 1.1 Getting Environment Variables into GNU make; 1.2 Setting Variables from Outside the Makefile; 1.3 The Environment Used by Commands; 1.4 The $(shell) Environment; 1.5 Target-Specific and Pattern-Specific Variables; 1.6 Version Checking; 1.7 Using Boolean Values; 1.8 Logical Operations Using Boolean Values; 1.9 Command Detection; 1.10 Delayed Variable Assignment; 1.11 Simple List Manipulation; 1.12 User-Defined Functions; 1.13 Recent GNU make Versions: 3.81, 3.82, and 4.0; Chapter 2: Makefile Debugging; 2.1 Printing the Value of a Makefile Variable; 2.2 Dumping Every Makefile Variable; 2.3 Tracing Variable Values; 2.4 Tracing Rule Execution; 2.5 Makefile Assertions; 2.6 An Interactive GNU make Debugger; 2.7 Dynamic Breakpoints in the GNU make Debugger; 2.8 An Introduction to remake; Chapter 3: Building and Rebuilding; 3.1 Rebuilding When CPPFLAGS Changes; 3.2 Rebuilding When a File's Checksum Changes; 3.3 Automatic Dependency Generation; 3.4 Atomic Rules in GNU make; 3.5 Painless Non-recursive make; Chapter 4: Pitfalls and Problems; 4.1 GNU make Gotcha: ifndef and ?=; 4.2 $(shell) and := Go Together; 4.3 $(eval) and Variable Caching; 4.4 The Trouble with Hidden Targets; 4.5 GNU make's Escaping Rules; 4.6 The Trouble with $(wildcard); 4.7 Making Directories; 4.8 GNU make Meets Filenames with Spaces; 4.9 Path Handling; 4.10 Usman's Law; 4.11 Pitfalls and Benefits of GNU make Parallelization; 4.12 Making $(wildcard) Recursive; 4.13 Which Makefile Am I In?; Chapter 5: Pushing the Envelope; 5.1 Doing Arithmetic; 5.2 Making an XML Bill of Materials; 5.3 Advanced User-Defined Functions; 5.4 GNU make 4.0 Loadable Objects; 5.5 Using Guile in GNU make; 5.6 Self-Documenting Makefiles; Chapter 6: The GNU Make Standard Library; 6.1 Importing the GMSL; 6.2 Calling a GMSL Function; 6.3 Checking the GMSL Version; 6.4 Example Real-World GMSL Use; 6.5 GMSL Reference; Updates;