如何跟踪Makefile目标以进行故障排除? [英] How to trace Makefile targets for troubleshooting?

查看:300
本文介绍了如何跟踪Makefile目标以进行故障排除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的构建系统中有一个漫长而复杂的Makefile.是否有一种很好的方法来准确跟踪给定的make调用执行了哪些目标?

We have a long and complicated Makefile in our build system. Is there a good way to trace exactly which targets get executed for a given make invocation?

推荐答案

使用make -dmake --debug[=flags]

‘-d’

除了正常处理外,还打印调试信息. 调试信息表明正在考虑重新制作哪些文件,正在比较哪些文件时间以及哪些结果,实际上需要重新制作哪些文件,要考虑哪些隐式规则以及应用哪些隐式规则.关于make如何决定做什么的有趣. -d选项等效于‘--debug=a’(请参见下文).

Print debugging information in addition to normal processing. The debugging information says which files are being considered for remaking, which file-times are being compared and with what results, which files actually need to be remade, which implicit rules are considered and which are applied—everything interesting about how make decides what to do. The -d option is equivalent to ‘--debug=a’ (see below).

‘--debug[=options]’

除了正常处理外,还打印调试信息.可以选择各种级别和类型的输出.不带任何参数的情况下,显示调试的基本"级别.可能的参数如下:仅考虑第一个字符,并且值必须用逗号或空格分隔.

Print debugging information in addition to normal processing. Various levels and types of output can be chosen. With no arguments, print the "basic" level of debugging. Possible arguments are below; only the first character is considered, and values must be comma- or space-separated.

a(全部) 启用所有类型的调试输出.这等效于使用"-d".

a (all) All types of debugging output are enabled. This is equivalent to using ‘-d’.

b(基本) 基本调试将打印发现已过期的每个目标以及构建是否成功.

v(详细) ‘basic’以上的水平;包括有关已解析哪些makefile的消息,不需要重建的先决条件等.此选项还启用‘basic’消息.

v (verbose) A level above ‘basic’; includes messages about which makefiles were parsed, prerequisites that did not need to be rebuilt, etc. This option also enables ‘basic’ messages.

i(隐式) 打印描述每个目标隐式规则搜索的消息.此选项还启用‘basic’消息.

i (implicit) Prints messages describing the implicit rule searches for each target. This option also enables ‘basic’ messages.

j(工作) 打印消息,提供有关特定子命令调用的详细信息.

j (jobs) Prints messages giving details on the invocation of specific subcommands.

m(makefile) 默认情况下,在尝试重新制作makefile时未启用上述消息.此选项还可以在重建makefile的同时启用消息.请注意,‘all’选项确实启用了此选项.此选项还启用‘basic’消息.

m (makefile) By default, the above messages are not enabled while trying to remake the makefiles. This option enables messages while rebuilding makefiles, too. Note that the ‘all’ option does enable this option. This option also enables ‘basic’ messages.

另一种选择是使用 remake -GNU Make的补丁版本,它增加了改进的错误报告,跟踪执行的能力以及调试器.

Another option is to use remake - a patched version of GNU Make that adds improved error reporting, the ability to trace execution, and a debugger.

这篇关于如何跟踪Makefile目标以进行故障排除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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