
The Quest to the Perfect Makefile - nhooyr
https://r4nd0m6uy.ch/the-quest-to-the-perfect-makefile.html
======
jart
This is a good rundown of GNU Make capabilities. Be careful about relying on
things like pkg-config to auto-discover dependencies, since distros changing
things will permanently break the entire history of your project. Then you
can't git bisect and have to use things like Docker to go back and examine old
versions.

Here's a Makefile I put together recently that builds over 9000 objects, 72
libraries, and a few hundred executables.
[https://github.com/jart/cosmopolitan/blob/master/Makefile](https://github.com/jart/cosmopolitan/blob/master/Makefile)
The interesting part I've noticed is tuning the makefile so it correctly
orders linker arguments, making sure the relationships between granular
libraries is a DAG, and being able to build individual targets without
building the world. GNU Make probably makes this easier than any other tool,
since it's secretly a functional programming language. Which is something that
might frighten the uninitiated.

