我想只为安装编写一个makefile。我想拥有一个 install
目标和 all
目标。 all
目标将仅作为默认目标存在,因此运行 make
会说“没什么可 build 的”。但是,当我做一个小测试并运行 make
时或 make all
,看来安装目标也运行了。这是生成文件:
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
目标。有人可以解释为什么会发生这种情况吗?
最佳答案
呵呵,不错的。 :)
Run `make install` to
这包含反引号,它调用命令
make install
.使用简单的撇号。
关于makefile - make 运行所有目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23186068/