Skip to end of metadata
Go to start of metadata

Intro

Make has been the de facto standard for managing the build process in software projects. It is principally used in C/C++ projects though, technically, it can be used to automate any process. It is quite ubiquitous and is available for almost all platforms that are of any consequence. One of the disadvantages of make is that is quite tied to the platform for which the build recipe is written. Generating, maintaining and synchronizing platform-specific build recipes is one of the biggest issues for any reasonably large software project.

Make is available in several flavors that offer different sets of features and capabilities. The most common and freely available variant is GNU Make which is part of GNU's build toolchain. It is advisable to stick to GNU Make unless there is a compelling reason to do otherwise.


Quick Start

  1. Read the initial 2 chapters in the Pragmatic Automation [1] book.
  2. Read chapter 2 (An Introduction to Makefiles) from the make manual.
  3. If you have more time, read chapter 3 too.
  4. Find an environment with make installed.
  5. Write your makefile and test.

Installation

Make is most probably already present in your work environment. You are probably looking at make because you do not use Visual Studio or some similar IDE managed project building system. In that case, you are, in all likelihood, compiling on a unix / unix-like environment. If that is the case, make should already be installed by default on your command shell. You will find make by default on your local cygwin or MinGW, all our linux servers and the clusters.


FAQ

I still feel lost. How do I write a makefile for my project?

Unfortunately, understanding and exploiting make can be an arduous process. One tip to find your way is to "read as you need". The make manual exhaustively details all the subtler features and gotchas in using the make system. Once you come up against a problem go back to the manual and try to figure your way out. Even the manual advises the reader to skim through the beginning of each chapter first. Another tip is to start simple. Build your makefile layer by layer, starting with the simplest of tasks needed to automate your project build. Look at example makefiles online. Finally, the SSG Developer team may be able to help you out with questions you have.

How do I compile java code?

Even though Make is supposed to be able to automate anything, we strongly discourage you from using it for java code and the like. For Java, Ant is the way to go. Please consider using make only if you are working on a C/C++ project that you cannot port into another language.

My makefile seems correct, but it still doesn't work.

A common reason for broken makefiles is whitespace. The Makefile syntax is quite sensitive to white spaces. All rules should begin with a tab. If your editor replaces these tabs with spaces, then your makefiles won't work. Make sure that you have tabs at the beginning of the lines which contain commands.

Labels
  • None