GNU做出:“'target'不需要做任何事情"与“'target'是最新的" [英] GNU make: “Nothing to be done for 'target'” vs. “'target' is up to date”

查看:84
本文介绍了GNU做出:“'target'不需要做任何事情"与“'target'是最新的"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GNU如何确定要发出哪些消息?我正在使用的Makefile导致目标未达到目标时,什么都不做,不会发出目标" 消息.但我认为目标"是最新的会更合适.

How does GNU make decide which of the messages to emit? The Makefile I am using causes Nothing to be done for 'target' messages to be emitted when the target is up do date. But I think 'target' is up to date would be more appropriate.

推荐答案

主要区别在于gmake是否具有构建目标的规则.如果目标没有规则,但目标存在,则gmake会说什么都没做",例如,我不知道如何更新此内容,但它已经存在,所以我猜有无计可施."如果有规则,但是目标已经是最新的,则gmake会说是最新的",例如,我确实有更新此内容的说明,但它似乎已经更新了-到目前为止,所以我什么也不会做."

The chief difference is in whether gmake has a rule to build the target or not. If there is no rule for the target, but the target exists, then gmake will say, "Nothing to be done", as in, "I don't know how to update this thing, but it already exists, so I guess there's nothing to be done." If there is a rule, but the target is already up-to-date, then gmake will say, "is up to date", as in, "I do have instructions for updating this thing, but it appears to already be up-to-date, so I'm not going to do anything."

这是一个具体的例子:

$ echo "upToDate: older ; @echo done" > Makefile
$ touch older ; sleep 2 ; touch upToDate ; touch nothingToDo
$ ls --full-time -l older upToDate nothingToDo
-rw-r--r-- 1 ericm ericm 0 2011-04-20 11:13:04.970243002 -0700 nothingToDo
-rw-r--r-- 1 ericm ericm 0 2011-04-20 11:13:02.960243003 -0700 older
-rw-r--r-- 1 ericm ericm 0 2011-04-20 11:13:04.960243001 -0700 upToDate
$ gmake upToDate
gmake: `upToDate' is up to date.
$ gmake nothingToDo
gmake: Nothing to be done for `nothingToDo'.

由于gmake没有关于"nothingToDo"的规则,但是该文件已经存在,因此您会收到什么都不要做"的消息.如果"nothingToDo"不存在,那么您将收到熟悉的无需制定规则"消息.

Since gmake has no rule for "nothingToDo", but the file already exists, you get the "nothing to be done" message. If "nothingToDo" did not exist, you would instead get the familiar, "No rule to make" message.

相比之下,由于gmake的规则为"upToDate",并且文件似乎是最新的,因此您会收到是最新的"消息.

In contrast, because gmake has a rule for "upToDate", and the file appears to be up-to-date, you get the "is up to date" message.

这篇关于GNU做出:“'target'不需要做任何事情"与“'target'是最新的"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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