<p>I have a large legacy codebase with very complicated makefiles, with lots of variables.  Sometimes I need to change them, and I find that it's very difficult to figure out why the change isn't working the way I expect.  What I'd like to find is a tool that basically does step-through-debugging of the "make" process, where I would give it a directory, and I would be able to see the value of different variables at different points in the process.  None of the debug flags to make seem to show me what I want, although it's possible that I'm missing something.  Does anyone know of a way to do this?</p>

[{'answer_id': 54767, 'author': 'Rob Wells', 'author_id': 2974, 'author_profile': 'https://Stackoverflow.com/users/2974', 'pm_score': 6, 'selected': False, 'text': '<p>Have you been looking at the output from running <code>make -n</code> and <code>make -np</code>, and the biggie <code>make -nd</code>?</p>\n\n<p>Are you using a fairly recent version of <code>gmake</code>?</p>\n\n<p>Have you looked at the free chapter on <a href="http://oreilly.com/catalog/make3/book/index.csp" rel="noreferrer">Debugging Makefiles</a> available on O\'Reilly\'s site for their excellent book "Managing Projects with GNU Make" (<a href="https://rads.stackoverflow.com/amzn/click/com/0596006101" rel="noreferrer" rel="nofollow noreferrer">Amazon Link</a>).</p>\n'}, {'answer_id': 54781, 'author': 'argv0', 'author_id': 5595, 'author_profile': 'https://Stackoverflow.com/users/5595', 'pm_score': 3, 'selected': False, 'text': "<p>I'm not aware of any specific flag that does exactly what you want, but <pre>--print-data-base</pre> sounds like it might be useful.</p>\n"}, {'answer_id': 313763, 'author': 'Rajish', 'author_id': 29576, 'author_profile': 'https://Stackoverflow.com/users/29576', 'pm_score': 5, 'selected': False, 'text': '<p>I\'m sure that <a href="http://bashdb.sourceforge.net/remake/" rel="noreferrer">remake</a> is what you are looking for.</p>\n\n<p>From the homepage:</p>\n\n<blockquote>\n  <p><strong>remake</strong> is a patched and modernized version of GNU make utility that adds improved error reporting, the ability to trace execution in a comprehensible way, and a debugger. </p>\n</blockquote>\n\n<p>It has gdb-like interface and is supported by mdb-mode in (x)emacs which means breakponts, watches etc. And there\'s  <a href="http://www.gnu.org/software/ddd/" rel="noreferrer">DDD</a> if you don\'t like (x)emacs</p>\n'}, {'answer_id': 15522386, 'author': 'GuruM', 'author_id': 452885, 'author_profile': 'https://Stackoverflow.com/users/452885', 'pm_score': 5, 'selected': False, 'text': "<p>From the man page on make command-line options:  </p>\n\n<pre><code>-n, --just-print, --dry-run, --recon  \nPrint the commands that would be executed, but do not execute them.  \n\n-d  Print debugging information in addition to normal processing.  \nThe debugging information says  \nwhich files are being considered for remaking,  \nwhich file-times are being compared and with what results,  \nwhich files actually need  to  be  remade,  \nwhich implicit  rules are considered and which are applied---  \neverything interesting about how make decides what to do.  \n\n--debug[=FLAGS] Print debugging information in addition to normal processing.  \nIf the FLAGS are omitted, then the behaviour is the same as if -d was specified.  \nFLAGS may be:  \n'a' for all debugging output same as using -d,  \n'b' for basic debugging,  \n'v' for more verbose basic debugging,  \n'i' for showing implicit rules,  \n'j' for details on invocation of commands, and  \n'm' for debugging while remaking makefiles.  \n</code></pre>\n"}, {'answer_id': 25311779, 'author': 'Howard Lee Harkness', 'author_id': 25823, 'author_profile': 'https://Stackoverflow.com/users/25823', 'pm_score': 0, 'selected': False, 'text': '<p>There is a GNU make debugger project at <a href="http://gmd.sf.net" rel="nofollow">http://gmd.sf.net</a> which looks quite useful. The main feature supported by gmd is breakpointing, which may be more useful than stepping. To use this, you download gmd from <a href="http://gmd.sf.net" rel="nofollow">http://gmd.sf.net</a> and gmsl from <a href="http://gmsl.sf.net" rel="nofollow">http://gmsl.sf.net</a>, and do an \'include gmd\' in your makefile.</p>\n'}, {'answer_id': 57884854, 'author': 'mavijana', 'author_id': 4193667, 'author_profile': 'https://Stackoverflow.com/users/4193667', 'pm_score': 2, 'selected': False, 'text': '<pre>remake --debugger all</pre>\n\n<p>More info <a href="https://vimeo.com/97397484" rel="nofollow noreferrer">https://vimeo.com/97397484</a></p>\n\n<p><a href="https://github.com/rocky/remake/wiki/Installing" rel="nofollow noreferrer">https://github.com/rocky/remake/wiki/Installing</a></p>\n'}]
['https://Stackoverflow.com/questions/54753', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5241/']