众所周知make工具是Unix和其他操作系统上最悠久的特色。make在20世纪70年代被发明,现在仍被作为大多数的编程项目的核心编译辅助工具在使用。它甚至可以构建Linux内核。本书第三版中,你将知道为何在许多新的竞争者出现的情况下这个工具仍在项目构建软件中占据头等位置。
make的思路很简单:当你改变了源文件并想重新构建程序或者其他的输出文件时,make检查时间戳看哪些改变了,并按要求重新构建这些文件,而不需要浪费时间重新构建其他文件。但是在这个基本的原则之上,make提供了丰富的选项集合,让你能够操作多个目录,为不同平台构建不同的版本,能够以其他的方式定制你的构建过程。
本书第三版主要讨论了GNU版的make,它目前已经成为工业标准。书中仔细讨论了GNU make的各种扩展。GNU make非常流行,因为它是自由软件,为几乎每个平台包括Microsoft Windows(作为自由项目Cygwin的一部分)都提供了不同的版本。
Robert Mecklenburg——本书第三版的作者,在不同的平台和语言下使用make已经有数十年了。在本书中,他热心地列出了怎样让你的构建尽可能地有效,怎样减少维护,避免错误,并且让你彻底理解make在干什么。关于C++和Java的章节为使用这些语言的项目提供了优化的makefile条目。作者甚至提供了一个关于构建这本书的makefile的讨论。
Foreword
Preface
Part I. Basic Concepts
1. How to Write a Simple Makefile
rgets and Prerequisites
pendency Checking
nimizing Rebuilds
oking make
Basic Makefile Syntax
2. Rules
Explicit Rules
Variables
Finding Files with VPATH and vpath
Pattern Rules
The Implicit Rules Database
Special Targets
Automatic Dependency Generation
Managing Libraries
3. Variables and Macros
What Variables Are Used For
Variable Types
Macros
When Variables Are Expanded
Target-and Pattern-Specific Variables
Where Variables Come From
Conditional and include Processing
Standard make Variables
4. Functions
User-Defined Functions
Built-in Functions
Advanced User-Defined Functions
5. Commands
Parsing Commands
Which Shell to Use
Empty Commands
Command Environment
Evaluating Commands
Command-Line Limits
Part II. Advanced and Specialized Topics
6. Managing Large Projects
Recursive make
Nonrecursive make
Components of Large Systems
Filesystem Layout
Automating Builds and Testing
7. Portable Makefiles
Portability Issues
Cygwin
Managing Programs and Files
Working with Nonportable Tools
Automake
8. C and C++
Separating Source and Binary
Read-Only Source
Dependency Generation
Supporting Multiple Binary Trees
Partial Source Trees
Reference Builds,Libraries,and Installers
9. Java
Alternatives to make
A Generic Java Makefile
Compiling Java
Managing Jars
Reference Trees and Third-Party Jars
Enterprise JavaBeans
10. Improving the Performance of make
Benchmarking
Identifying and Handling Bottlenecks
Parallel make
Distributed make
11. Example Makefiles
The Book Makefile
The Linux Kernel Makefile
12. Debugging Makefiles
Debugging Features of make
Writing Code for Debugging
Common Error Messages
Part III. Appendixes
A. Running make
B. The Outer Limits
C. GNU Free Documentation License—GNU Project—Free Software
Foundation (FSF)
Index