将makefile依赖项标记为可选或不重要 [英] Marking a makefile dependency as optional or otherwise unimportant

查看:92
本文介绍了将makefile依赖项标记为可选或不重要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有以下规则的Makefile:

I have a Makefile with a pair of rules like the following:

file.c: filesvn

filesvn: .svn/entries
     action1
     action2

在svn存储库中,这当然可以正常工作.该文件取决于生活在Subversion存储库中.当从存储库中导出时,这不起作用(没有规则可用于创建目标...),我想解决此问题.我试图将以前生成的filesvn版本简单地导出到导出的目录中,但是Make仍然坚持要验证filesvn的依赖性.

Within the svn repository, this of course works fine. The file is dependent upon living in a subversion repository. When exported from the repository, this does not work (No rule to make target...), and I would like to fix that. I have tried to simply bring a previously-generated version of filesvn out into the exported directory, but Make still insists on verifying filesvn's dependency.

当然,仅删除.svn/entries的依赖性确实可以,但是由于关注修订版本是目标,因此该规则的精神被破坏了.

Simply deleting the dependency of .svn/entries does work, of course, but then the spirit of the rule is broken since watching for a revision update is the goal.

是否有一种方法可以让Make不在乎.svn/entries文件不存在?

Is there a way to get Make to not care that the .svn/entries file is not there?

这种技术的优点并不是问题的真正组成部分.我无法从根本上改变这一点,但是如果有改变保持了可能奏效的精神.当然,回答您不能"是完全有效的. :)

The merits of such a technique are not really part of the question. I can't fundamentally change this, but if there is a change that maintains the spirit that might work. An answer of "You can't" is perfectly valid of course. :)

推荐答案

您可以添加一个目标,该目标生成带有更改的实际makefile副本,这些副本会删除svn依赖项,并对其进行运行,然后将其删除.

You can add a target that generates copy of actual makefile with changes that drop the svn dependency, run make with it and then deletes it.

这篇关于将makefile依赖项标记为可选或不重要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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