摘要:
继续翻译 Once you've defined the rule to remake the `.d' files, you then usethe `include' directive to read them all in. *Note Include::. Forexample: sources = foo.c bar.c include $(sources:.c=.d)(This example uses a substitution variable reference to translate thelist of source files `foo.c 阅读全文
摘要:
继续翻译 Here is the pattern rule to generate a file of prerequisites (i.e.,a makefile) called `NAME.d' from a C source file called `NAME.c': %.d: %.c @set -e; rm -f $@; \ $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@;... 阅读全文
摘要:
继续翻译 Note that such a prerequisite constitutes mentioning `main.o' in amakefile, so it can never be considered an intermediate file by implicitrule search. This means that `make' won't ever remove the file afterusing it; *note Chains of Implicit Rules: Chained Rules. With old `make' 阅读全文
摘要:
继续翻译4.14 Generating Prerequisites Automatically===========================================In the makefile for a program, many of the rules you need to write oftensay only that some object file depends on some header file. Forexample, if `main.c' uses `defs.h' via an `#include', you would 阅读全文
摘要:
继续翻译 The double-colon rules for a target are executed in the order theyappear in the makefile. However, the cases where double-colon rulesreally make sense are those where the order of executing the recipeswould not matter. Double-colon rules are somewhat obscure and not often very useful;they ... 阅读全文
摘要:
继续翻译4.13 Double-Colon Rules=======================Double-colon rules are explicit rules written with `::' instead of`:' after the target names. They are handled differently from ordinaryrules when the same target appears in more than one rule. Patternrules with double-colons have an entirely 阅读全文
摘要:
继续翻译4.12.2 Static Pattern Rules versus Implicit Rules-------------------------------------------------A static pattern rule has much in common with an implicit rule definedas a pattern rule (*note Defining and Redefining Pattern Rules: PatternRules.). Both have a pattern for the target and patterns. 阅读全文
摘要:
上例子LIBS=foo.k bar.k.PHONY : allall: $(LIBS) @echo final$(LIBS): %.k : text.g @echo $*text.g: echo text.g运行结果:text.gfoobarfinal结束 阅读全文
摘要:
继续翻译 Each target specified must match the target pattern; a warning isissued for each target that does not. If you have a list of files,only some of which will match the pattern, you can use the `filter'function to remove nonmatching file names (*note Functions for StringSubstitution and Analysi 阅读全文
摘要:
继续翻译 `%' characters in pattern rules can be quoted with precedingbackslashes (`\'). Backslashes that would otherwise quote `%'characters can be quoted with more backslashes. Backslashes that quote`%' characters or other backslashes are removed from the pattern beforeit is compared to 阅读全文
摘要:
继续翻译 The TARGET-PATTERN and PREREQ-PATTERNS say how to compute theprerequisites of each target. Each target is matched against theTARGET-PATTERN to extract a part of the target name, called the "stem".This stem is substituted into each of the PREREQ-PATTERNS to make theprerequisite names ( 阅读全文
摘要:
继续翻译4.12 Static Pattern Rules=========================Static pattern rules are rules which specify multiple targets andconstruct the prerequisite names for each target based on the targetname. They are more general than ordinary rules with multiple targetsbecause the targets do not have to have ide. 阅读全文