我有一个大型的旧版代码库,其中包含非常复杂的makefile和许多变量。有时我需要更改它们,但发现很难弄清为什么更改未按我期望的方式工作。我想找到的是一个基本上可以对“ make”过程进行逐步调试的工具,我可以在其中给它一个目录,然后我可以在不同位置查看不同变量的值。处理。尽管可能会丢失某些内容,但所有要使的调试标志似乎都没有显示我想要的内容。有人知道这样做的方法吗?
Answers:
您是否一直在查看runningmake -n
和make -np
biggie的输出make -nd
?
您是否使用的是最新版本gmake
?
您是否看过O'Reilly网站上免费的关于调试Makefile的章节,其中包含其出色的著作“使用GNU Make管理项目”(Amazon Link)。
在手册页上的make命令行选项中:
-n, --just-print, --dry-run, --recon
Print the commands that would be executed, but do not execute them.
-d 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.
--debug[=FLAGS] Print debugging information in addition to normal processing.
If the FLAGS are omitted, then the behaviour is the same as if -d was specified.
FLAGS may be:
'a' for all debugging output same as using -d,
'b' for basic debugging,
'v' for more verbose basic debugging,
'i' for showing implicit rules,
'j' for details on invocation of commands, and
'm' for debugging while remaking makefiles.
在http://gmd.sf.net上有一个GNU make调试器项目,它看起来很有用。gmd支持的主要功能是断点,它可能比步进更有用。要使用此功能,请从http://gmd.sf.net下载gmd,并从http://gmsl.sf.net下载gmsl ,然后在makefile中执行“ include gmd”。