Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to debug make using remake

📅 2018-Apr-26 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

In big projects that use Make, it can be hard to examine how a make build is working and to diagnose a build problem. Imagine my joy when I finally discovered ReMake. This is a debugger built off a version of GNU Make. It essentially allows you to step through a make build just like you would step through a program using GDB and examine state at any point in time.

$ sudo apt install remake
$ remake
$ remake some_target
$ remake -x
$ remake --targets
$ remake --tasks
$ remake -X

The debugger jumps and waits at the line with the target that it needs to execute first. Use the help command to get a list of commands that you can use. They are all similar to GDB: step to step into, next to execute next line, print to print values of make variables (this is a lifesaver!) and so on.

Tried with: remake 3.82 and Ubuntu 16.04