Managing Projects with GNU Make

Robert Mecklenburg

出版时间

2004-11-26

ISBN

9780596006105

评分

★★★★★
书籍介绍
这本书最引争议之处,在于作者坚持把 Make 当作一门语言来教,而非一堆需要死记的配置文件语法。多数读者只需掌握其中约30%的知识便能应付日常项目,但作者执意带你深入规则、目标、先决条件与自动变量的完整体系——这正是它和《跟我学写makefile》这类速成读物最大的分野。它适合两类人:一类是受够了每次手动编译链接、想彻底搞懂构建机制的程序员;另一类是愿意花时间把工具用顺手的进阶者。它不适合只想快速看懂现成Makefile的人。书的后半部分相当硬核,自动变量、条件判断、隐式规则层层叠加,读起来确实费劲,但正因如此,它才能帮你把Make从
作者简介
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.
AI导读
核心看点
  • 深入解析GNU Make核心机制与依赖管理
  • 将Makefile视为编程语言,提升构建效率
  • 涵盖从基础规则到高级自动化变量的全貌
读者共识
  • 内容详实系统,是学习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=$@"
下载
收藏