What is the difference between “make” and “make all”?

来源:互联网 发布:mac系统钥匙串密码 编辑:程序博客网 时间:2024/06/11 00:37

I have a Makefile with the following structure (working example).

.PHONY: image flashcard put-filesput-files:    @echo "=== put-files"image:    @echo "=== image"flashcard:    @echo "=== flashcard"all: put-files image flashcard    @echo "Done"

I expect that a simple make would build all three targets, but this is not so:

% make=== put-files

But if I explicitly specify the target, the dependencies are built as well:

% make all=== put-files=== image=== flashcardDone

What am I doing wrong?

share|edit|flag
 add comment 
start a bounty

1 Answer

activeoldest votes
up vote4 down vote accepted

A simple make will build the first target in the list, which is put-files.

make all will build the target all. If you want all to be the default, then move it to the top of the list.

To understand what the .PHONY does, see http://www.gnu.org/s/hello/manual/make/Phony-Targets.html

0 0
原创粉丝点击