Update: Now also supports C++, see the Github repository[^n] for the updated file.
In every single project, or even just test, I write the same simple
Makefile over and over, by now I can write it without looking up anything. And if I forgot something, I would go through my old projects, to dig up the definition I need.
Today I got fed up with that, and decided to write one completely generic
Makefile I can just reuse in all my projects. It only requires a reasonably new make, nothing else.
- Automatic detection of changes in dependencies (eg header files)
- Detection of system compiler / linker (via environment variables
- Ability to amend
cleantargets, the former also respects
- Generetion of gdb debug files
- Sane compiler defaults
You can find the repository containing the file on GitHub[^n]. Currently it only supports C, but I might add C++ support in the feature, be sure to keep an eye on my blog to be notified about any news.