https://stackoverflow.com/questions/6856263/what-is-the-difference-between-make-and-make-all
问:
我有一个如下结构的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
来build三个target,但是这样不行:
$ make
=== put-files
但是如果我指明target,所有的依赖也会被build:
$ make all
=== put-files
=== image
=== flashcard
Done
我做的不对吗?
答:
单单一个make
只会build列表中的第一个target,即:put-files
。
而builld all
会build all
,如果你想默认buildall
,那就需要把all
移到列表最前面。
关于.PHONY
,可以参考 http://www.gnu.org/s/hello/manual/make/Phony-Targets.html