By John Paul Mueller, Jeff Cogswell

Since the beginning of time, or at least since the beginning of the Unix operating system, programmers have used a utility called make to build their applications. And it’s still often used today. The make utility looks at which of your source code files have changed and decides what needs to be compiled and built. Here are some features you can use when working with Makefiles:

  • If your lines run long and you want to continue them on the next line without confusing poor old make, you can end a line with a backslash () and then continue it on the next line.

  • Your best bet when working with Makefiles is to start with one that you know works and then change it so that it applies to your current project. The truth is, almost no programmer creates a Makefile from scratch. Programmers don’t like to work that hard on auxiliary projects like messing with Makefiles. They’d rather get to their programming.

  • Most Makefiles will have a rule called all. The idea behind this rule is that it encompasses all the other rules. When you type make all, you can build your whole project.

  • You can include comments in your Makefiles by starting them with a # character. These comments are not used by the Makefile.

  • Makefiles can include what are called implicit rules, which are rules that pertain to a whole set of files with the same file extension (such as .cpp). These comments can help you understand the Makefiles when working with them.

  • If you don’t like Makefiles, you don’t have to use them. Development environments such as Code::Blocks and Microsoft Visual C++ make it possible to create great applications without ever touching a Makefile.