摘要: “order-only”依赖的使用举例: LIBS = libtest.afoo : foo.c | $(LIBS) $(CC) $(CFLAGS) $< -o $@ $(LIBS)make在执行这个规则时,如果目标文件“foo”已经存在。当“foo.c”被修改以后,目标“foo”将会被重建,但是当“libtest.a”被修改以后。将不执行规则的命令来重建目标“foo”。还是自己做一个小例子会比较爽:LIBS=lib.afoo: foo.c | $(LIBS) touch foo @echo "gao"在 foo.c 文件 和 lib.a 文件都存在的情况下。执行 m 阅读全文
posted @ 2012-09-18 16:48 健哥的数据花园 阅读(702) 评论(0) 推荐(0) 编辑
摘要: 继续翻译 The normal prerequisites section may of course be empty. Also, you may still declare multiple lines of prerequisites for the same target: they are appended appropriately (normal prerequisites are appended to the list of normal prerequisites; order-only prerequisites are appended to the list ... 阅读全文
posted @ 2012-09-18 16:34 健哥的数据花园 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 继续翻译 Occasionally, however, you have a situation where you want to impose a specific ordering on the rules to be invoked _without_ forcing the target to be updated if one of those rules is executed. In that case, you want to define "order-only" prerequisites. Order-only prerequisites can b 阅读全文
posted @ 2012-09-18 16:10 健哥的数据花园 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 继续翻译4.3 Types of Prerequisites ========================== There are actually two different types of prerequisites understood by GNU `make': normal prerequisites such as described in the previous section, and "order-only" prerequis... 阅读全文
posted @ 2012-09-18 16:00 健哥的数据花园 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 继续翻译 You may split a long line by inserting a backslash followed by a newline, but this is not required, as `make' places no limit on the length of a line in a makefile. A rule tells `make' two things: when the targets are out of date, and how to updat... 阅读全文
posted @ 2012-09-18 15:36 健哥的数据花园 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 继续翻译 The RECIPE lines start with a tab character (or the first character in the value of the `.RECIPEPREFIX' variable; *note Special Variables::). The first recipe line may appear on the line after the prerequisites, with a tab character, or may appear on the same line,with a semicolon. Either w 阅读全文
posted @ 2012-09-18 15:19 健哥的数据花园 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 学习makefile的写法的时候,遇到了 ar 命令。进行了学习。下面的网址写得非常好:http://www.thegeekstuff.com/2010/08/ar-command-examples/还是通过例子来学习,来得比较快。此文很完美,暂时记录以作备忘。再回头来 看 makefile 的说法:Archive Members as TargetsAn individual member of an archive file can be used as a target or dependency in make. You specify the member named member 阅读全文
posted @ 2012-09-18 15:06 健哥的数据花园 阅读(692) 评论(0) 推荐(0) 编辑
摘要: 继续翻译4.2 Rule Syntax =============== In general, a rule looks like this: TARGETS : PREREQUISITES RECIPE ...... 阅读全文
posted @ 2012-09-18 14:20 健哥的数据花园 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 继续翻译4.1 Rule Example ================ Here is an example of a rule: foo.o : foo.c defs.h # module for twiddling the frobs cc -c -g foo.c ... 阅读全文
posted @ 2012-09-18 14:10 健哥的数据花园 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 看stackoverflow 中的例子:http://stackoverflow.com/questions/7891097/what-are-double-colon-rules-in-a-makefile-forL :: L1 cat $< >> $@ && rm $<L :: L2 cat $< >> $@ && rm $<log 文件的来源不止一个,所以 L1 或者 L2 更新,都会导致 L 被生成。 阅读全文
posted @ 2012-09-18 13:53 健哥的数据花园 阅读(528) 评论(0) 推荐(0) 编辑
摘要: 上例子:all: foo.o echo finalfoo.o: bar.c echo $*bar.c 文件存在,执行后的结果:foofinal 阅读全文
posted @ 2012-09-18 10:59 健哥的数据花园 阅读(1938) 评论(0) 推荐(0) 编辑
摘要: $?所有比目标新的依赖目标的集合。以空格分隔。例子:在目录下,touch footouch bar然后建立Makefile:all: foo bar echo $?此时 由于目录下没有 all 文件,所以 make 的执行结果是:foo bar然后准备再次运行,touch all此时,all 比其他文件(foo bar)都新,运行 make 的执行结果是:all is up to date第三次运行:touch bar此时 新旧顺序是: bar > all > foo,运行 make 的结果是:bar 阅读全文
posted @ 2012-09-18 10:42 健哥的数据花园 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 继续翻译4 Writing Rules *************** A "rule" appears in the makefile and says when and how to remake certain files, called the rule's "targets" (most often only one per rule). It lists the other files that are the "prerequisites"... 阅读全文
posted @ 2012-09-18 10:15 健哥的数据花园 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 继续翻译 Note that the directory prefix (D), as described in *note Implicit Rule Search Algorithm: Implicit Rule Search, is appended (after expansion) to all the patterns in the prerequisites list. As an example: .SECONDEXPANSION: ... 阅读全文
posted @ 2012-09-18 09:29 健哥的数据花园 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 继续翻译Secondary Expansion of Implicit Rules ------------------------------------- As `make' searches for an implicit rule, it substitutes the stem and then performs secondary expansion for every rule with a matching target pattern. ... 阅读全文
posted @ 2012-09-18 08:58 健哥的数据花园 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 学习 makefile遇到了静态模式规则部分,研究一下:http://www.gnu.org/software/make/manual/html_node/Static-Usage.html用的是大家经常用的例子: objects = foo.o bar.o all: $(objects) $(objects): %.o: %.c $(CC) -c $(CFLAGS) $< -o $@我想,是否可以把它类比于通配符。 $(objects)里的内容都要是.o 格式。而每个 .o 都依赖于 .c。 阅读全文
posted @ 2012-09-18 08:34 健哥的数据花园 阅读(2500) 评论(0) 推荐(0) 编辑
摘要: 继续翻译Secondary Expansion of Static Pattern Rules ------------------------------------------- Rules for secondary expansion of static pattern rules are identical to those for explicit rules, above, with one exception: for static pat... 阅读全文
posted @ 2012-09-18 08:13 健哥的数据花园 阅读(181) 评论(1) 推荐(0) 编辑