make is a program for building files (usually executables or libraries) from other files. You give make a makefile containing a set of rules explaining how to build some files from other files (for example, you can build an object file from a program file by compiling it, and an executable file from some object files by linking them together). make figures out which files need to be rebuilt, and then proceeds to rebuild only those files which must be rebuilt.

Typically, this saves a great deal of time when recompiling a medium or large program. If your program is split into some 10 or more files, and you change only 2 of them, make will (if possible) only rebuild the 2 corresponding object files, and then relink. You could, of course, try to do this by hand. But it would be both tedious and error-prone.

The best make is GNU make (aka gmake). Most make programs have various extensions, and of course every vendor has different extensions. But GNU make runs on everything in sight, and has almost every useful extension, so it allows you to write meaningful makefiles which will run on all platforms.

make's biggest weakness is that its concept of when a file needs to be rebuilt is based solely on modification time: a file needs to be rebuilt if it is older than some file from which it is built. This is usually the right thing, but not always:

  • If you change some compilation flags (say from "optimize for speed" to "include debugging information"), then the compilation command changes, so you'd want to rebuild everything. But make won't do this.
  • If you use a version control system such as ClearCase, cancelling a checkout makes that source file grow older, not newer. Again, this causes make not to perform some necessary operations. Arguably this is a fault with ClearCase, not make

Still, all things considered, make is an extremely useful tool.