“make” 和 “make” 和有什么不一样?和“创造一切”?
我有一个具有以下结构的 Makefile(工作示例)。
.PHONY: image flashcard put-files
put-files:
@echo "=== put-files"
image:
@echo "=== image"
flashcard:
@echo "=== flashcard"
all: put-files image flashcard
@echo "Done"
我希望一个简单的 make 能够构建所有三个目标,但事实并非如此:
% make
=== put-files
但是如果我显式指定目标,也会构建依赖项:
% make all
=== put-files
=== image
=== flashcard
Done
我做错了什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个简单的
make
将构建列表中的第一个目标,即put-files
。make all
将构建目标all
。如果您希望all
成为默认值,请将其移至列表顶部。要了解
.PHONY
的作用,请参阅 http://www.gnu.org/s/hello/manual/make/Phony-Targets.htmlA simple
make
will build the first target in the list, which isput-files
.make all
will build the targetall
. If you wantall
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