How to debug make using remake

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, you heard it right, 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.

  • Installing remake is easy on Ubuntu:
$ sudo apt install remake
  • Using remake is as easy as replacing your make command with it:
$ remake
$ remake some_target
  • If you want a verbose output of what is happening with your build use -x option:
$ remake -x
  • To actually debug a build with its debugger:
$ 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

One thought on “How to debug make using remake

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.