您的位置:首页 > Web前端

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

2014-01-22 16:07 633 查看
I have a Makefile with the following structure (working example).

.PHONY: image flashcard put-files

put-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
=== flashcard
Done

What am I doing wrong?

makefile

gnu-make
share|edit|flag
edited
Jul 28 '11 at 8:51

asked
Jul 28 '11 at 8:44




Dave Vogt

3,43721325

add
comment
start a bounty

1 Answer

active

oldest
votes

up vote
4
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: