Building, as the Makefile understands, consists of many goals. For example, to create a project you may need
- Build file1.o from file1.c
- Build file2.o from file2.c
- Build file3.o from file3.c
- Compile executable file1 from file1.o and file3.o
- Build executable2 from file2.o
If you performed this workflow using the makefile, you can do each of the goals separately. For example, if you wrote
make file1.o
if necessary, he will create only this file.
The name all not fixed. This is just a conditional name; all target means that if you call it, make will create all , which is necessary to create a complete assembly. This is usually a fictitious target that does not create any files, but simply depends on other files. In the above example, the construction of everything necessary is the creation of executable files, other files are drawn in as dependencies. Therefore, in the makefile, it looks like this:
all: executable1 executable2
all target is usually the first one in the makefile, because if you simply write make on the command line without specifying a target, it will build the first target. And you expect this to be all .
all usually also a .PHONY object. More details here .
Pavel Shved Mar 25 '10 at 11:26 2010-03-25 11:26
source share