为什么要认为目标是最新的? [英] Why does make think the target is up to date?

查看:45
本文介绍了为什么要认为目标是最新的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的Makefile:

This is my Makefile:

REBAR=./rebar
REBAR_COMPILE=$(REBAR) get-deps compile

all: compile

compile:
    $(REBAR_COMPILE)

test:
    $(REBAR_COMPILE) skip_deps=true eunit

clean:
    -rm -rf deps ebin priv doc/*

docs:
    $(REBAR_COMPILE) doc

ifeq ($(wildcard dialyzer/sqlite3.plt),)
static:
    $(REBAR_COMPILE) build_plt analyze
else
static:
    $(REBAR_COMPILE) analyze
endif

我可以多次运行 make compile 并获得

aromanov@alexey-desktop:~/workspace/gm-controller/lib/erlang-sqlite$ make compile
./rebar get-deps compile
==> erlang-sqlite (get-deps)
==> erlang-sqlite (compile)

但是,出于某些原因,运行 make test 总是会给出

However, for some reason running make test always gives

aromanov@alexey-desktop:~/workspace/gm-controller/lib/erlang-sqlite$ make test
make: `test' is up to date.

即使未编译文件也是如此.问题是,为什么?

even if the files are not compiled. The question is, why?

直接运行同一命令即可:

Running the same command directly works:

aromanov@alexey-desktop:~/workspace/gm-controller/lib/erlang-sqlite$ ./rebar get-deps compile skip_deps=true eunit
==> erlang-sqlite (get-deps)
==> erlang-sqlite (compile)
Compiled src/sqlite3_lib.erl
Compiled src/sqlite3.erl
==> erlang-sqlite (eunit)
...

推荐答案

也许您在目录中有一个名为 test 的文件/目录.如果此目录存在,并且没有最新的依赖关系,则不会重建此目标.

Maybe you have a file/directory named test in the directory. If this directory exists, and has no dependencies that are more recent, then this target is not rebuild.

要在这些与文件无关的目标上强制重建,您应该使它们伪造如下:

To force rebuild on these kind of not-file-related targets, you should make them phony as follows:

.PHONY: all test clean

请注意,您可以在那里声明所有虚假目标.

Note that you can declare all of your phony targets there.

虚假目标实际上不是文件名.相反,它只是您明确请求时要执行的配方的名称.

这篇关于为什么要认为目标是最新的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆