flâneur — a map of the web's best reading

Practical Makefiles, by example

nuclear.mutantstargoat.com · 4,058 words · saved by 1 readers

The purpose of this document is to explain how to write practical makefiles for your everyday hacks and projects. I want to illustrate, how easy it is to use make for building your programs, and doing so, dispel the notion that resorting to big clunky graphical IDEs, or makefile generators such as autotools or cmake, is the way to focus on your code faster. The purpose of this document is certainly not, to teach you how to write user-friendly, all-encompassing, release-quality build systems. You can certainly arrive to that by extending a simple makefile, and I'll give you a few pointers about that sort of thing in the end, but I will not focus on complexity and completeness, but rather on simplicity and practicality. Finally, it's worth spelling out up front that when I say "make", I'm really referring to the GNU implementation of make, which is packed with useful features, not necessarily found in other make programs out there. It might be interesting to write a follow-up article, pr

Practical Makefiles, by example Practical Makefiles, by example Author: John Tsiombikas Contact: nuclear@mutantstargoat.com Date: 9 Feb 2015 Last update: 2 June 2022 Contents 1 Rationale 2 Building C/C++ programs 3 Enter make 4 Simpler makefile 5 A makefile for 99% of your programs 6 Further improvements 6.1 Multiple source directories 6.2 Handling cross-platform differences 6.3 Wildcard rules 6.4 Automatic #include dependency tracking 6.5 Improved automatic dependency tracking 6.6 Building sub-projects 7 Going the extra mile for release 7.1 Writing install/uninstall rules 7.2 Installing l

Explore this link on the map →

related reading