Managing Projects with GNU Make

Robert Mecklenburg

出版时间

2004-11-26

ISBN

9780596006105

评分

★★★★★
书籍介绍
The utility simply known as "make" is one of the most enduring features of both Unix and other operating systems. First invented in the 1970s, "make" still turns up to this day as the central engine in most programming projects; it even builds the Linux kernel. In the third edition of the classic "Managing Projects with GNU make," readers will learn why this utility continues to hold its top position in project build software, despite many younger competitors. The premise behind "make" is simple: after you change source files and want to rebuild your program or other output files, "make" checks timestamps to see what has changed and rebuilds just what you need, without wasting time rebuilding other files. But on top of this simple principle, "make" layers a rich collection of options that lets you manipulate multiple directories, build different versions of programs for different platforms, and customize your builds in other ways. This edition focuses on the GNU version of "make," which has deservedly become the industry standard. GNU make contains powerful extensions that are explored in this book. It is also popular because it is free software and provides a version for almost every platform, including a version for Microsoft Windows as part of the free Cygwin project. "Managing Projects with GNU make," 3rd Edition provides guidelines on meeting the needs of large, modern projects. Also added are a number of interesting advanced topics such as portability, parallelism, and use with Java. Robert Mecklenburg, author of the third edition, has used "make" for decades with a variety of platforms and languages. In this book he zealously lays forth how to get your builds to be as efficient as possible, reduce maintenance, avoid errors, and thoroughly understand what "make" is doing. Chapters on C++ and Java provide makefile entries optimized for projects in those languages. The author even includes a discussion of the makefile used to build the book.
AI导读
核心看点
  • 深入解析GNU Make核心机制与依赖管理
  • 将Makefile视为编程语言,提升构建效率
  • 涵盖从基础规则到高级自动化变量的全貌
适合谁读
  • 具备C/C++基础及Linux命令行经验的开发者
  • 希望系统掌握Makefile编写与优化技巧的工程师
  • 对Unix构建系统底层原理感兴趣的计算机专业学生
读前提醒
  • 建议先掌握Bash基础,再结合实例阅读
  • 无需死记硬背,重点理解依赖关系与执行逻辑
  • 可配合官方手册对照阅读,以加深理解
读者共识
  • 内容详实系统,是学习GNU Make的经典教材
  • 部分语法晦涩难懂,初学者阅读门槛较高
  • 掌握核心概念后,能显著提升项目构建能力

本导读基于书籍简介、目录、原文摘录、短评和书评生成,不等同于全文精读。

精彩摘录
  • "The first rule seen by make is used as default rule. A rule consists of three parts: the target, the prerequisites, and the commands to perform. The target is the file or thing that must be made. The prerequisites or dependents are those files that must exist before the target can be successfully cr"
  • "... the order in which commands are executed by make are nearly the opposite to the order they occur in the makefile. This top-down style is common in makefiles. Usually the most general form of target is specified first in the makefile and the details are left for later."
  • "... a standard first target in many makefiles is called all. Targets that do not represent files are known as phony targets. Another standard phony target is clean. clean: rm -f *.o lexer.c make cannot distinguish between a file target and phony target."
  • "$@ The filename representing the target. $% The filename element of an archive member specification. $< The filename of the first prerequisite. $? The names of all prerequisites that are newer than the target, separated by spaces. $^ The filenames of all the prerequisites, separated by spaces. This "
  • "gui.o: CPPFLAGS += -DUSE_NEW_MALLOC=1"
  • "# COMSPEC is defined only on Windows. ifdef COMSPEC PATH_SEP := ; EXE_EXT := .exe else PATH_SEP := : EXE_EXT := endif"
  • "dir Function returns the directory portion of each word in list. source-dir:= $(sort \ $(dir \ $(shell find. -name '*.c')))"
  • "$(player) $(libraries) : $(MAKE) --directory=$@"
作者简介
Robert Mecklenburg began using Unix as a student in 1977 and has been programming professionally for 23 years. His make experience started in 1982 at NASA with Unix version 7. Robert received his Ph.D. in Computer Science from the University of Utah in 1991. Since then he has worked in many fields ranging from mechanical CAD to bioinformatics, and brings his extensive experience in C++, Java and Lisp to bear on the problems of project management with make.
下载
收藏