摘要:
继续翻译 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 $@ ... 阅读全文
摘要:
上例子主 Makefile内容:SUBDIRS=foo bar bazsubdirs: for dir in $(SUBDIRS); do\ $(MAKE) -C $$dir; \ done当前目录下各个子目录的Makfile内容:./foo/Makefile:foo: @echo "foo..."./bar/Makefile:bar: @echo "bar..."./baz/Makefile:baz: @echo "baz..."执行结果:for dir in foo bar baz;do\ make -C $dir; \donem 阅读全文
摘要:
上例子SUBDIRS=foo bar bazsubdir: for dir in $(SUBDIRS); do \ @echo $$dir; \ done执行结果:for dir in foo bar baz ; do @echo $dir;donefoobarbaz 阅读全文
摘要:
返回:Linux/Unix 索引页 上例子 for i in f1 f2 f3; do @echo $i; done 执行结果: f1 f2 f3 但是,请注意:如果是在makefile 中写,要写成这个样子: all: for i in f1 f2 f3; do\ @echo $$i; \ don 阅读全文
摘要:
继续翻译 Thus, you first write the line that states that `clean' is a phony target, then you write the rule, like this: .PHONY: clean clean: rm *.o temp Another example of the usefulness of phony targets is in conjunction with recursive invocations of `make' (for more information... 阅读全文
摘要:
继续翻译 The phony target will cease to work if anything ever does create afile named `clean' in this directory. Since it has no prerequisites,the file `clean' would inevitably be considered up to date, and itsrecipe would not be executed. To avoid this problem, you can explicitlydeclare the tar 阅读全文
摘要:
继续翻译4.6 Phony Targets================= A phony target is one that is not really the name of a file; rather it is just a name for a recipe to be executed when you make an explicit request. There are two reasons to use a phony target: to avoid a conflict with a file of the same name, and to improve... 阅读全文
摘要:
继续翻译 Although the default set of files to be searched for is `libNAME.so'and `libNAME.a', this is customizable via the `.LIBPATTERNS' variable.Each word in the value of this variable is a pattern string. When aprerequisite like `-lNAME' is seen, `make' will replace the percent in 阅读全文
摘要:
继续翻译4.5.6 Directory Search for Link Libraries ----------------------------------------- Directory search applies in a special way to libraries used with the linker. This special feature comes into play when you write a prerequisi... 阅读全文
摘要:
继续翻译4.5.5 Directory Search and Implicit Rules-----------------------------------------The search through the directories specified in `VPATH' or with `vpath' also happens during consideration of implicit rules (*note Using Implicit Rules: Implicit Rules.). For example, when a file `foo.o' 阅读全文