The (mini) c++ repository - make

Every C++ programmer using make to manage build order should read the Recursive make considered harmfull paper by Peter Miller.

Modern makefiles for developers

Makefiles are (ab)used for a variety of reasons these days. From automatically building projects, over installation scripts to configuration. On this page I focus on the first task, ie how to write makefiles which are handy for a developer (in C/C++).

A lot of the following ideas build on the paper referenced above.

First, what do I like in a Makefile?

What is wrong with automake?

Automake is part of the GNU build toolset and is responsible for generating Makefiles.

The first, obvious question, is why introduce yet another tool in the build process? More tools means less transparency, greater dependencies and much more that can go wrong in areas where a developer does not necessarily has (or even WANT to have) the necessary experience.

Automake is, despite it's name, also not fully automatic. Which means as a developer you have to know certain things about it. Since I am lazy

I feel the case for the use of Automake in a lot of projects is not sufficiently strong. I think the advantages of using automake can also be obtained with a well thought out template Makefile which includes (simple) project specific Makefile fragments enumerating (only) the sources which make up the project.

The modern Makefile

More specifically I am looking for a makefile which allows me to write a Makefile fragment

include SubDir1/Makefile.fragment
include SubDir2/Makefile.fragment
CLASSES += MyClass1 MyClass2 MyClass3
and takes it from there after a simple 'make'. This makefile

Remaining problems

I am still working on an good Makefile template. To get an idea of how it looks, check out one of the software packages I've written.

A few problems remain with my current approach.