make运行所有目标

时间:2014-04-20 18:24:14

标签: makefile

我想只为安装编写一个makefile。我在考虑拥有install目标和all目标。 all目标只会作为默认目标存在,因此运行make会说"无需构建"。但是,当我进行小型测试并运行makemake all时,似乎也会运行安装目标。这是makefile:

vimprefix=/usr/share/vim/vim73

.PHONY: all
all: 
    @echo "Nothing to build. Run `make install` to install configurations."

.PHONY: install
install:
    test -d $(vimprefix)

以下是make的输出:

$ make
Nothing to build. Run make[1]: Entering directory `/home/user/documents/conf'
test -d /usr/share/vim/vim73
make[1]: Leaving directory `/home/user/documents/conf' to install configurations.

我注意到,如果我在touch all目标中添加all之类的内容,就不会发生这种情况。有人可以解释为什么会发生这种情况吗?

1 个答案:

答案 0 :(得分:8)

嘿,好的。 :)

Run `make install` to 

这包含反引号,它会调用命令make install。使用简单的撇号。

相关问题