Makefile Basics
If you don't use make
on a regular basis, it's often difficult to remember exactly what goes where in a makefile, so here are a few things to keep in mind. Besides comments, which begin with a hash mark (#
), there are only three basic types of entities in a makefile:
Variable assignments
Rules
Commands
While there are several other types of constructs in a makefile (including conditional statements, directives, extension rules, pattern rules, function variables, and include statements, among others), for our purposes, we'll just touch lightly on them as needed instead of covering them all in detail. This doesn't mean they're unimportant, however—on the contrary, they're very useful if you're going to write your own complex build system ...
Get Autotools now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.