make – GNU’S Build Automation Tool

The make command is a build automation tool that automatically builds executable programs and libraries from source code by reading files called Makefiles. It is a part of the GNU build system and is used to simplify the process of building software applications. The make command is widely used in the Linux community and is an essential tool for software development.


The make command reads a file called Makefile, which contains a set of rules that describe how to build the software. Each rule specifies a target, dependencies, and a set of commands to execute. The target is the name of the file that will be created by the rule, the dependencies are the files that the target depends on, and the commands are the instructions to build the target.

Here is an example of a simple Makefile:

hello: hello.c
    gcc -o hello hello.c

This Makefile contains one rule that specifies that the target hello depends on the file hello.c. The command to build the target is gcc -o hello hello.c, which compiles the source code in hello.c and creates the executable file hello.

To build the software, you simply run the make command followed by the name of the target:

$ make hello

This will execute the commands specified in the rule for the hello target and create the executable file hello.

Use Cases

The make command is used in a variety of software development scenarios, including:

  • Building software from source code
  • Compiling and linking object files
  • Managing dependencies between source files
  • Building libraries and executables
  • Running tests and generating documentation


The make command has several options that can be used to modify its behavior. The following table lists the most commonly used options:

Option Description
-f FILENAME Use FILENAME as the Makefile
-j N Run N jobs in parallel
-k Continue building even if a target fails
-n Print the commands that would be executed, but do not execute them
-C DIRECTORY Change to DIRECTORY before reading the Makefile
-B Force a rebuild of all targets

Troubleshooting Tips

Here are some common issues that you may encounter when using the make command, along with tips for troubleshooting them:

  • Makefile not found: If the make command cannot find the Makefile, you can specify the file using the -f option.
  • Missing dependencies: If a target fails to build because of missing dependencies, make sure that the dependencies are listed correctly in the Makefile.
  • Build errors: If a target fails to build because of errors in the source code, you will need to fix the errors before running make again.
  • Concurrency issues: If you are running make with the -j option and encounter concurrency issues, you can try reducing the number of jobs or adding dependencies to ensure that targets are built in the correct order.


  • The make command is case-sensitive, so make sure that the target names and file names in the Makefile match exactly.
  • The make command is designed to work with C and C++ source code, but can be used with other programming languages as well.
  • The make command is highly customizable and can be extended with plugins and scripts.