wisconsin
Make

Make

Curated by Last modified: 2 min read

Make is a build automation tool that automatically builds executable programs and libraries from source code by reading a file called Makefile. The Makefile contains a set of rules used to build the target file(s) from the source file(s). The rules are written in the form of a recipe that specifies the dependencies and the commands to build the target file(s).

Declared prerequisite timestamps are tracked, so if a dependency is modified, Make will automatically rebuild the target file(s) that depend on it. This allows for incremental builds, where only the modified files are rebuilt, rather than rebuilding everything from scratch.

Syntax

The syntax of a Makefile is as follows:

target: dependencies
	command
  • target: The file(s) to be built.
  • dependencies: The file(s) that the target file(s) depend on.
  • command: The command(s) to build the target file(s) from the dependencies.

Other features of Makefile include:

  • Variables: Used to store values that can be referenced later in the file.
  • Comments: Lines starting with # are treated as comments.
  • Rules: Define how to build the target file(s) from the dependencies.
  • Phony targets: Targets that do not represent actual files but are used as commands.

Connections

Obvious technical and formatting errors repaired.

Linked to this page