摘要:
继续翻译A rule such as this should not be placed at the beginning of the makefile, because we do not want it to run by default! Thus, in theexample makefile, we want the rule for `edit', which recompiles the editor, to remain the default goal. Since `c... 阅读全文
摘要:
继续翻译 In practice, we might want to write the rule in a somewhat more complicated manner to handle unanticipated situations. We would dothis: .PHONY : clean clean : -rm edit $(object... 阅读全文
摘要:
继续翻译2.7 Rules for Cleaning the Directory ==================================== Compiling a program is not the only thing you might want to write rules for. Makefiles commonly tell how to do a few other things besidescompiling a pr... 阅读全文
摘要:
继续翻译Here `defs.h' is given as a prerequisite of all the object files;`command.h' and `buffer.h' are prerequisites of the specific objectfiles listed for them. Whether this is better is a matter of taste: it is more compact, but some people dislike it... 阅读全文
摘要:
继续翻译2.6 Another Style of Makefile ============================= When the objects of a makefile are created only by implicit rules, an alternative style of makefile is possible. In this style of makefile,you group entries by their... 阅读全文
摘要:
继续翻译This is how we would write the makefile in actual practice. (The complications associated with `clean' are described elsewhere. See *note Phony Targets::, and *note Errors in Recipes: Errors.) Because implicit rules are so convenient, they are ... 阅读全文
摘要:
继续翻译 When a `.c' file is used automatically in this way, it is also automatically added to the list of prerequisites. We can therefore omit the `.c' files from the prerequisites, provided we omit the recipe. Here is the entire example, with both of these ... 阅读全文
摘要:
继续翻译2.5 Letting `make' Deduce the Recipes ===================================== It is not necessary to spell out the recipes for compiling the individual C source files, because `make' can figure them out: it has an implicit rule ... 阅读全文
摘要:
继续翻译Then, each place we want to put a list of the object file names, we can substitute the variable's value by writing `$(objects)' (*note How toUse Variables: Using Variables.). Here is how the complete simple makefile looks when you use a variable ... 阅读全文
摘要:
继续翻译 It is standard practice for every makefile to have a variable named `objects', `OBJECTS', `objs', `OBJS', `obj', or `OBJ' which is a listof all object file names. We would define such a variable `objects'with a line like this in the makefile: ... 阅读全文
摘要:
继续翻译2.4 Variables Make Makefiles Simpler ==================================== In our example, we had to list all the object files twice in the rule for `edit' (repeated here): ... 阅读全文
摘要:
继续翻译 After recompiling whichever object files need it, `make' decides whether to relink `edit'. This must be done if the file `edit' doesnot exist, or if any of the object files are newer than it. If an object file was just recompiled, it is now newer than `edit', so `edit' is re 阅读全文
摘要:
继续翻译 The other rules are processed because their targets appear as prerequisites of the goal. If some other rule is not depended on by thegoal (or anything it depends on, etc.), that rule is not processed, unless you tell `make' to do so (with a command such as `make clean'). ... 阅读全文