继续翻译
By declaring the subdirectories as phony targets (you must do this asthe subdirectory obviously always exists; otherwise it won't be built)you can remove these problems: SUBDIRS = foo bar baz .PHONY: subdirs $(SUBDIRS) subdirs: $(SUBDIRS) $(SUBDIRS): $(MAKE) -C $@ foo: baz Here we've also declared that the `foo' subdirectory cannot be builtuntil after the `baz' subdirectory is complete; this kind ofrelationship declaration is particularly important when attemptingparallel builds.
通过把子目录宣布为伪目标(如果子目录明显存在,你必须这么做,否则就无法运行),你可以避免前述问题:
SUBDIRS = foo bar baz
.PHONY: subdirs $(SUBDIRS)
subdirs: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@foo: baz
这里我们也声明了 foo 子目录要在 baz 子目录处理完毕后再处理;这种关系在并行编译的时候很重要。
后文待续