Chapter 2. Makefile Debugging
This chapter covers techniques that can be useful when debugging makefiles. The lack of built-in debugging tools, and the complexities of following variables in make
, can make it very challenging to understand why a particular target was (or more often was not) built.
The first recipe in this chapter shows the single most useful line that you can add to a makefile; it’s the equivalent of a print statement inserted into code for debugging.
Printing the Value of a Makefile Variable
If you’ve ever looked in a makefile, you’ll realize that makefile variables (often just called variables) form the backbone of any make
process. Variables often define which files will be compiled, what command line parameters to pass to compilers, ...
Get The GNU Make Book now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.