BIVBlog #41: Makefile Basics (not only) for Microcontrollers

As useful as Makefiles are, a lot of people are mortally afraid of them. Admittedly, their syntax is somewhat quirky, and not knowing in advance in what exact order during execution may seem somewhat disconcerting, but they are an invaluable tool not only in multi-file projects but also whenever you want to compile programs in a reproducible—and convenient—manner.

Beyond syntax there are a number of good practices and widespread conventions that you want to know about to make sure that your Makefiles are, and stay, maintainable so they can evolve together with the rest of your projects.

Being part of the microcontroller tutorial series, in this video I also do some slightly beyond-the-ordinary stuff to accomodate for the particular needs of microcontroller projects.

Table of Contents

00:01:25 In case you already know about make
00:02:00 The reputation of make
00:02:30 Why to use make
00:03:05 What make is there—and good—for
00:04:30 The importance of conventions
00:05:20 The evolution of make: GNUMake, BSDMake (pmake) and others
00:07:20 Grabbing commands from the command line history
07:08:00 Basic Make rules
00:10:35 Re-running Make and dependency based target rebuilds
00:11:10 Phony targets
00:13:55 The implicit default target
00:14:20 Aggregating phony target conventions
00:19:10 Speeding things up using parallel builds
00:20:10 Keeping configurables in variables
00:30:00 Basic Makefile structure conventions recapitulated
00:31:30 GNUMake pattern rules
00:38:00 Overriding variables on the command line
00:40:00 Outlook


bivblog41-mcu-makefiles-20160819-214049.tar.gz: A tarball containing the C sources from BIVBlog #40 and the new Makefile shown in the video.


Long term IPv6 evangelist/book author/trainer/consultant and generic Unix guy (*BSD, Linux, Solaris, and about a dozen more).

Leave a Reply

Your email address will not be published.