Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to print in a Makefile

📅 2019-Apr-19 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ info, make, makefile ⬩ 📚 Archive

Makefiles and especially recursive Makefiles can be hard to understand and debug. But the good old debugging method of printing out values from certain locations in the source code can be employed here too.

$(info Hello World Make just parsed past this line)

Note that make typically parses a file twice before it executes what is needed to satisfy its targets. So, you will see the message you are printing twice.

$(info $(FOOBAR_VAR))

Tried with: GNU Make 4.1 and Ubuntu 18.04

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧