忽略不存在的先决条件 [英] Make ignoring Prerequisite that doesn't exist

查看:229
本文介绍了忽略不存在的先决条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

make继续构建,并说当我的依赖文件说一个对象依赖于已移动的头文件时,一切都是最新的.

make continues to build and says everything is up to date when my dependency files say an object depends on a header file that has moved.

如果运行make -d来捕获评估,我会看到:

If run make -d to capture the evaluation I see:

Considering target file `../build/out/src/manager.o'.
     Looking for an implicit rule for `../build/out/src/manager.o'.
     No implicit rule found for `../build/out/src/manager.o'.
      Pruning file `../product/build/config/product.conf'.
      Pruning file `../build/out/opt_cc.txt'.
      Considering target file `../mem/src/manager.c'.
       Looking for an implicit rule for `../mem/src/manager.c'.
       No implicit rule found for `../mem/src/manager.c'.
       Finished prerequisites of target file `../mem/src/manager.c'.
      No need to remake target `../mem/src/manager.c'.
      Pruning file `../mem/mem.h'.
     Finished prerequisites of target file `../build/out/src/manager.o'.
     Prerequisite `../product/build/config/product.conf' is older than target `../build/out/src/manager.o'.
     Prerequisite `../build/out/opt_cc.txt' is older than target `../build/out/src/manager.o'.
     Prerequisite `../mem/src/manager.c' is older than target `../build/out/src/manager.o'.
     Prerequisite `../mem/mem.h' of target `../build/out/src/manager.o' does not exist.
../build/out/src/manager.o'.
     Prerequisite `../mem/mem_in.h' is older than target `../build/out/src/manager.o'.
    No need to remake target `../build/out/src/manager.o'.

因此,请知道该文件是必需文件,而不是该文件,但不会尝试根据规则创建文件或失败.

So make knows the file is needed and is not there but doesn't attempt to create it from a rule or fail.

Prerequisite `../mem/mem.h' of target `../build/out/src/manager.o' does not exist.

这是为什么,如何使我不忽略该规则?

Why is this and how can I get make to not ignore this rule?

推荐答案

您很可能已经实现了一种自动依赖项生成方法,该方法告诉make通过定义该文件的目标来实质上忽略那些文件(如果它们不存在).一条规则.当我有这个生成文件时:

Most likely you have implemented an automatic dependency generation method that tells make to essentially ignore those files if they don't exist, by defining a target for that file without a rule. When I have this makefile:

foo: foo.h ; @echo make $@ from $^

然后没有foo.h然后make告诉我:

And no foo.h then make tells me:

$ make
make: **** No rule to make target 'foo.h', needed by 'foo'.  Stop.

但是,如果我有 this 个makefile:

But, if I have this makefile:

foo: foo.h ; @echo make $@ from $^
foo.h:

现在make很高兴:

$ make
make foo from foo.h

这是许多自动依赖关系生成实用程序所依赖的已记录的行为:如果查看生成的依赖关系makefile,您将看到每个头文件的空目标之一.

That's a documented behavior that many auto-dependency generation utilities rely on: if you look in your generated dependency makefiles you'll see one of those empty targets for every header file.

这个想法是,给定正确的依赖关系信息,就永远不能有一种方法来重命名或删除头文件而不修改其他源文件或头文件,这将导致目标文件仍然被重建(因此正确地重新创建了依赖关系信息)下次).

The idea is that given correct dependency information there should never be a way to rename or delete a header file without modifying some other source or header file, which would cause the object file to be rebuilt anyway (hence recreating the dependency information correctly for the next time).

这篇关于忽略不存在的先决条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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