Home

makefile

A Makefile is a special file used by the make utility to control the building of programs and other tasks. It describes how to derive target files from a set of prerequisite files and commands, allowing incremental builds and automation.

A rule in a Makefile has the form target: prerequisites and a recipe. The recipe is a

Makefiles support features such as include directives to pull in other files, pattern rules using the %

Make checks dependencies by comparing file modification times; if a prerequisite is newer than its target or

History and usage: Make and Makefiles originated on Unix in the 1970s and remain widely used, especially

sequence
of
shell
commands
executed
to
create
the
target
from
the
prerequisites.
Variables
can
be
defined
and
referenced
as
$(VAR).
Common
targets
include
programs,
libraries,
and
auxiliary
tasks.
wildcard,
and
automatic
variables
such
as
$@
for
the
target
name,
$<
for
the
first
prerequisite,
and
$^
for
all
prerequisites.
Special
targets
like
.PHONY
declare
that
a
name
is
not
a
real
file.
the
target
is
missing,
the
recipe
runs.
This
enables
incremental
builds.
The
default
shell
is
typically
/bin/sh,
and
recipes
run
in
that
environment;
the
SHELL
variable
can
modify
this.
in
C
and
C++
projects,
though
other
build
systems
have
become
popular
for
other
languages.