2008-09-10 93 views
46

我有一個很大的遺留代碼庫,其中包含非常複雜的makefile以及很多變量。有時候我需要改變它們,我發現很難弄清楚爲什麼變化不能按我期望的方式工作。我想找到的是一個基本上對「make」過程進行逐步調試的工具,在那裏我會給它一個目錄,並且我將能夠看到不同變量在不同點上的值處理。沒有一個調試標誌可以讓我看到我想要的東西,儘管可能我錯過了一些東西。有誰知道一種方法來做到這一點?用於調試makefile的工具

回答

48

您是否一直在尋找運行make -nmake -np以及biggie make -nd的輸出?

您是否使用gmake的相當新版本?

你看過O'Reilly網站上有關Debugging Makefiles的免費章節:他們出色的書「使用GNU Make管理項目」(Amazon Link)。

3

我不知道任何特定的標誌確實符合您的要求,但

--print-data-base
聽起來像是有用的。

+0

或`-p`作爲別名 – sercxjo 2016-04-13 20:26:21

20

我相信remake是你在找什麼。

從主頁:

翻拍是GNU的修補和現代化的版本做,增加了改進的錯誤報告,跟蹤執行在理解的方式的能力,以及調試工具。

它GDB一樣的接口,並由MDB-模式(X)emacs的,這意味着breakponts,手錶等支持,並有DDD,如果你不喜歡的(X)emacs的

+0

如果我可以,我會添加+100。當使用重拍('brew install remake'進行安裝)時,我不得不調試DISAPPEARED的問題。不知道問題是什麼,但誰在乎? :) – ishahak 2015-03-11 14:57:21

10

從對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. 
0

有一個在http://gmd.sf.net一個GNU調試器做項目,看起來相當有用。 gmd支持的主要功能是突出點,這可能比步進更有用。要使用這個,你從http://gmd.sf.net和gmsl從http://gmsl.sf.net下載gmd,然後在你的makefile中做一個'include gmd'。