Best practices for a (GNU) makefile in the XXI century

This is not really a tutorial on makefiles; there are lots of those around the web.

But most of those are very outdated, and/or follow dubious practices. You'll end up with a makefile which was OK for a make and a compiler from the 90's, maybe even around year 2000. Even the GNU make manual recommends unnecessarily complicated things, given the capabilities gcc has grown in the last decade.

So, if you know how makefiles generally work (it's enough to know what a rule, a recipe and a variable is), and want to improve yours or know of better options, the following may help.


Fred Brooks vs Dijkstra?

In the 60's, Freed Brooks led the development of the IBM/360 system and its OS. The experience made him write the famous The Mythical Man-Month.

Turns out that Dijkstra also wrote about that system in his EWD255. And everything he complained about on that system is the standard nowadays! Sounds like he considered that a lot of the complexity that should be fixed by the computer is being dumped on the programmer; that the features touted by the IBM/360’s OS are in fact partial fixes to the bad design of the computer:


"Cómo reconocer cuándo alguien es de izquierdas o derechas" - volumen II

Éste era uno de esos estúpidos chistes que van por ahí, de mail en mail o incluso de whatsapp en whatsapp. Pero me resultó suficientemente tendencioso (por supuesto hacia lo buenos que son los pobrecitos de la derecha y lo malos que son los abusones de la izquierda - por qué siempre este tipo de cosas llevan esa orientación? *) que tuve que escribir una 2a versión, aún más clara sobre lo que piensan los de derecha - o al menos lo que parece que piensan los que yo conozco ;P.