摘要:
上例子LIBS=foo.gao bar.gao.INTERMEDIATE:$(LIBS).SECONDARY:bar.gaoall: $(LIBS) #passfoo.gao: @echo $@ touch $@bar.gao: @echo $@ touch $@ make --dry-run 的结果:foo.gaotouch foo.gaobar.gaotouch bar.gao#passrm foo.gao可见,SECONDARY 确实起到了保护 中间文件的作用结束 阅读全文
摘要:
先看例子一.INTERMEDIATE: foo.gaoall: foo.gao #passfoo.gao: @echo "test" touch foo.gao$make --dry-runtesttouch foo.gao#passrm foo.gao再看例子二all: foo.gao #passfoo.gao: @echo "test" touch foo.gao$make --dry-runtesttouch foo.gao#pass结束 阅读全文
摘要:
继续翻译`.PRECIOUS' The targets which `.PRECIOUS' depends on are given the following special treatment: if `make' is killed or interrupted during the execution of their recipes, the target is not deleted. *Note Interrupting or Killing `make': Interrupts. Also, if the target... 阅读全文
摘要:
参考 stackoverflow 的例子:http://stackoverflow.com/questions/5426934/why-this-makefile-removes-my-goal下面的 :%.txt: foo.log #pass%.log: #pass 运行时,用 make a.txt --dry-run, 会得到如下的结果:#pass#passrm foo.log也就是说, 中间文件 foo.log 被删除。但是,如果改为:all: foo.log #pass%.log: #pass这时候,再运行 make --dry-run, 会得到如下的结果:#pass#pas... 阅读全文
摘要:
当前目录中存在 gao.g 文件(其实际内容是一个简单的C语言程序)先是用如下的例子来看:例子一.SUFFIXES:.SUFFIXES: .g .oLIBS=gao.oall: $(LIBS)%.o:%g @echo "in %.o:%g"运行结果是: no rule to make target gao.o...也就是说 .SUFFIXES 和 %.o:%g 模式规则一起使用没有效果。再看看如下的例子:把.SUFFIXES 去掉看看,例子二LIBS=gao.oall: $(LIBS)%.o:%g @echo "in %.o:%g"运行结果仍然是:no 阅读全文