Exercise 2. Using Makefiles to Build

We’re going to use a program called make to simplify building your exercise code. The make program has been around for a very long time, and because of this it knows how to build quite a few types of software. In this exercise, I’ll teach you just enough Makefile syntax to continue with the course, and then an exercise later will teach you more complete Makefile usage.

Using Make

How make works is you declare dependencies, and then describe how to build them or rely on the program’s internal knowledge of how to build most common software. It has decades of knowledge about building a wide variety of files from other files. In the last exercise, you did this already using commands:

$ make ex1 # or this one ...

Get Learn C the Hard Way: A Clear & Direct Introduction To Modern C Programming 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.