LinuxCommandLibrary

make

builds programs from source

TLDR

Build default target

$ make
copy
Build specific target
$ make [target]
copy
Build with jobs
$ make -j [4]
copy
Use specific makefile
$ make -f [Makefile.custom]
copy
Dry run
$ make -n
copy
Set variable
$ make [VAR=value]
copy
Clean build
$ make clean
copy

SYNOPSIS

make [options] [target]

DESCRIPTION

make is a build automation tool that reads instructions from a Makefile to compile and link programs from source code. Each Makefile defines targets (the files to build), their dependencies (the source files they rely on), and the shell commands needed to produce them. When invoked, make constructs a dependency graph and executes only the commands whose targets are out of date.
The tool determines what needs rebuilding by comparing file modification timestamps -- if a source file is newer than its corresponding target, that target is rebuilt along with anything that depends on it. This incremental approach avoids redundant recompilation and can dramatically speed up large builds. The `-j` flag enables parallel execution of independent targets across multiple CPU cores, further reducing build times.
Make's rule-based system also supports pattern rules, implicit rules, and variables, allowing concise Makefiles that scale from simple single-file projects to complex multi-directory software systems.

PARAMETERS

TARGET

Target to build.
-f FILE
Use specified makefile.
-j N
Parallel jobs.
-n
Dry run (don't execute).
-B
Force rebuild all.
-C DIR
Change directory first.
--help
Display help information.

CAVEATS

Tab characters required. Different make implementations. Parallel builds may have issues.

HISTORY

make was created by Stuart Feldman at Bell Labs in 1976, revolutionizing software building automation.

SEE ALSO

cmake(1), ninja(1), autoconf(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community