What's New in This Edition
Almost all the material in this book is new. I've divided the material into three parts .
Part I, Basic Concepts , provides a moderately detailed examination of the GNU make features and how to use them.
Chapter 1, is a brief introduction to make with a simple, but complete example. It explains the basic concepts of make such as targets and prerequisites, and covers the syntax of makefile s. This should be sufficient to get you going with your first makefile s.
Chapter 2, discusses the structure and syntax of rules. Explicit rules and pattern rules are covered in great detail along with old-fashioned suffix rules. Special targets and simple dependency generation are also discussed here.
Chapter 3, covers simple and recursive variables . This chapter also discusses how makefile s are parsed, when variables are expanded, and the directives for conditional makefile processing.
Chapter 4, examines the wide variety of built-in functions supported by GNU make . User-defined functions are introduced here, with numerous examples ranging from the trivial to illustrations of advanced concepts.
Chapter 5, explains the details of command scripts, covering how they are parsed and evaluated. Here we also discuss command modifiers, checking command exit status, and the command environment. We explore the problems of command-line limits and some ways to work around these problems. At this point, you will know all the GNU make features discussed in this book.
Part II, Advanced and Specialized Topics , covers larger topics, such as using make on large projects, portability, and debugging.
Chapter 6, discusses many issues encountered when building large projects in make . The first topic is the use of recursive invocations of make , as well as how to implement these makefile s with a single, nonrecursive makefile . In addition, other issues of large systems are discussed, such as filesystem layout, component management, and automated building and testing.
Chapter 7, discusses issues with portability of makefile s, primarily between various flavors of Unix and Windows. The Cygwin Unix emulation environment is discussed in some detail, along with issues arising from nonportable filesystem features and tools.
Chapter 8, provides specific examples of how to separate source and binary trees and how to create read-only source trees. Dependency analysis is revisited, with an emphasis on language-specific solutions. This chapter and the next tie in closely with many issues raised in Chapter 6.
Chapter 9, explains how to apply make to Java-based development environments. Techniques for managing the CLASSPATH variable, compiling large numbers of files, creating jars, and constructing Enterprise JavaBeans (EJBs) are introduced.
Chapter 10, begins by reviewing the performance characteristics of several make operations to provide context for how to write efficient makefile s. Techniques for identifying and reducing bottlenecks are discussed. The GNU make parallel jobs feature is described in some detail.
Chapter 11, provides two complex examples of real makefile s. The first is the makefile used to create this book. It is interesting, partly due to a fairly extreme degree of automation and partly because it applies make to a nontraditional domain. The other example consists of excerpts from the Linux 2.6 kbuild system.
Chapter 12, delves into the black art of fixing broken makefile s. We introduce techniques for discovering what make is doing under the covers and how to ease development pains.
Part III, Appendixes , includes supplemental material.
Appendix A, provides a reference guide to GNU make 's command-line options.
Appendix B, explores the limits of GNU make with two unlikely capabilities: managing data structures and performing arithmetic.
Appendix C, contains the GNU Free Documentation License, under which the text of the book is distributed.