gpt4 book ai didi

makefile - 为什么 make 认为目标是最新的?

转载 作者:行者123 更新时间:2023-12-03 04:10:19 24 4
gpt4 key购买 nike

这是我的 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

我可以多次运行makecompile并得到

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

但是,由于某种原因,运行 make test 总是给出

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

即使文件未编译。问题是,为什么?

直接运行相同的命令即可:

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 的文件/目录。如果此目录存在,并且没有更新的依赖项,则不会重建此目标。

要强制重建这些与文件无关的目标,您应该将它们设置为虚假目标,如下所示:

.PHONY: all test clean

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

虚假目标并不是真正的文件名;相反,它只是当您发出显式请求时要执行的配方的名称。

关于makefile - 为什么 make 认为目标是最新的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3931741/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com