Skip to content

Makefiles

Development has many tasks that have configuration options and stages. Building documentation, running test suites, even building the virtual environment, all can have many options. Remembering the right order, combination and so on takes up valuable head-space for a developer and when you send your code to someone else, represents a lot of things to explain and/or document. It is useful, then, to automate these kinds of tasks.

There are many ways to do this, but a common one is to use Makefiles.

Makefiles can be hugely complex, but we are not going to get into anything too complex the important thing to know is that when we provide you with a Makefile, you can find out what it can do by examining the file.

Here, I'm displaying the contents of the Makefile using cat:

Contents of a Makefile

Lines that start with a word and a colon (build:) for example, are the start of the directives that can be used.

make build will activate it.

In many shells, if you type just make and then press tab, you can get a list of options. The provided VM has this feature:

Example of tab-completion of make directives