调试GNU make

编程入门 行业动态 更新时间:2024-10-12 05:50:44
本文介绍了调试GNU make的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

make中是否存在命令行方式来找出目标的哪些先决条件未更新?

Is there a command line way in make to find out which of the prerequisites of a target is not updated?

推荐答案

make -d

应该给您的信息更多,而不是足够的信息来调试您的Makefile.

should give you more than enough information to debug your makefile.

请注意:分析输出将花费一些时间和精力,但是将输出加载到您喜欢的编辑器中并进行搜索会很有帮助.

Be warned: it will take some time and effort to analyze the output but loading the output into your favorite editor and doing searches will assist a lot.

如果您指定感兴趣的特定目标,则可以大大减少调试输出的数量.因此,如果您仅对dodgy目标感兴趣,而不只是对make -d感兴趣,这可能会造成上百种差异东西,尝试:

You can greatly reduce the amount of debugging output if you specify the specific target you're interested in. So if you're only interested in the dodgy target, instead of just make -d which may make a hundred different things, try:

make clean make -d dodgy

(假设您当然有一个clean目标).

(assuming you have a clean target of course).

make --debug与make -d相同,但是您也可以指定:

The make --debug is identical to make -d but you can also specify:

make --debug=FLAGS

其中的标志可以是:

  • a用于所有调试(与make -d和make --debug相同).
  • b用于基本调试.
  • v进行更详细的基本调试.
  • i用于隐式规则.
  • j获取调用信息.
  • m有关在重新制作Makefile期间的信息.
  • a for all debugging (same as make -d and make --debug).
  • b for basic debugging.
  • v for slightly more verbose basic debugging.
  • i for implicit rules.
  • j for invocation information.
  • m for information during makefile remakes.

make --debug=b似乎是满足您需求的最佳选择,如以下记录所示:

It looks like make --debug=b is the best option for what you need, as shown in the following transcript:

pax@paxbox> cat makefile c:a b touch c pax@paxbox> touch a b ; make touch c pax@paxbox> make make: 'c' is up to date. pax@paxbox> touch a ; make --debug=b GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. Blah, blah, blah. Reading makefiles... Updating goal targets.... Prerequisite 'a' is newer than target 'c'. Must remake target 'c'. touch c Successfully remade target file 'c'.

更多推荐

调试GNU make

本文发布于:2023-11-24 17:07:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626097.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:GNU

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!