FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Development Tools
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
February 05, 2007
Debugging Makefiles

Practical debugging tips for real-world development

(Page 1 of 4)
John Graham-Cumming
John shares practical debugging tips he's used to debug real-world Makefiles.
John is a cofounder of Electric Cloud, which focuses on reducing software build times. He can be contacted at jgc@electric-cloud.com.


Donald Knuth once said that, given a choice between two languages, he'd choose the one with the better debugger. For that reason, he'd probably never choose to use Make. Its debugging facilities are virtually nonexistent.

In this article, I address this problem by providing practical debugging tips I've used to debug real-world Makefiles. To illustrate, I use GNU Make because of its wide platform support and rich language. Unfortunately, that rich language doesn't include much in the way of debugging. In fact, GNU Make's -d command-line flag seems to produce output more useful to the author of GNU Make than to someone facing Makefile problems.

The only GNU Make command-line option that's really useful for Makefile debugging is -p, and all it does is dump the contents of GNU Make's built-in rules and macros, and any rules or macros defined in the Makefile. Granted, that's an enormous amount of information that can be useful in debugging, but hardly counts as a debugger.

Broadly, Makefile debugging problems fall into three categories:

  • What's the value of macro X and how did it get it?
  • Why did file foo get built?
  • How does Make log file output relate to the rules in the Makefile?

1 Debugging Makefiles | 2 What's the Value of Macro X? | 3 Why Did File foo Get Built? | 4 How Does Make Log File Output Relate? Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK