Skip to content
BENIBIX Learn

Make (Build Tool)

Development🛠️ Editors & ToolsBuild Automation

Also known as Makefile, GNU Make, make command

An old, simple build tool. It reads a Makefile and redoes only what changed.

Think of it like

It is like a list of chores where some must wait for others. It does only the ones still needed.

Example

Jack keeps a Makefile in his project. He types make test, and Make builds what changed, then runs the tests.

Why it matters

It is on most Unix systems. Many teams use a Makefile as the one place to start each job.

Definition

Make is an old and simple build tool that reads a file called a Makefile. The file lists targets, the files each one needs, and the commands that make it. Make checks which files changed, and rebuilds only what depends on them. It began with C programs, but people use it to run any job. Each command line in a Makefile must start with a tab, not spaces.

Example code

makefile
app: main.c
	cc -o app main.c

test: app
	./app --self-test
Two targets. The test target needs app first, so Make builds app, then tests it.
Make is the build tool that reads a Makefile as its recipe.

Common mistake

Starting a command line with spaces. Make wants a tab there, and fails with a missing separator error.

Key takeaways

  1. 1
    Targets. Each one names a file or a job.
  2. 2
    Only what changed. It compares file times.
  3. 3
    Tabs matter. Command lines start with a tab.

Learn it properly