Tutorial: Practical makefiles, by example

John Tsiombikas nuclear@mutantstargoat.com

9 February 2015

I know a lot of programmers, who are afraid of makefiles. Most of them come from a windows background, and when they migrate to GNU/Linux or MacOS X they naturally gravitate towards clunky IDEs to manage their build process. Others, fearing that makefiles are going to be too complex to manage manually, try to use even clunkier makefile (or project file) generators like cmake.

While none of the above solutions is without some merit in particular cases, I strongly believe that there's no faster and simpler way to build your project, than writing a small makefile. And in order to dispel the fear, I decided to write a tutorial about how to write simple, practical makefiles, for your programs.

The article is too big and too ... structured, for my idea of what a blog post should be, so I'm hosting it on my web site along with some of my previous articles instead.

So anyway here it is, let me know if you find it useful: Practical makefiles, by example.
Feel free to use the comments section in this post for any feedback, or send me an email if you prefer.

Btw, I used reStructuredText, and the docutils translators for this. So there's also a PDF version, produced through the rst2latex translator. It's not as good as it could have been if I wrote it directly in LaTeX, but I suppose it's serviceable if you prefer a printable off-line version.


This was initially posted in my old wordpress blog. Visit the original version to see any comments.


Discuss this post

Back to my blog