Makefile Generator
Generate Makefiles with common targets for your project language. Customize and download.
Targets
What is a Makefile?
A Makefile is a build automation file read by the make utility. It declares targets — named tasks such as build, test, and clean — each with an optional list of prerequisites and a set of shell commands to run. You invoke a target by name (make test), and running make with no argument executes the first target in the file, conventionally called all.
Makefiles are language-agnostic, which is why they persist far beyond their C origins: the same file can orchestrate a Node.js install, run a Python test suite, or shell out to Cargo. Because the rules are just shell commands plus dependency relationships, you can express anything from a one-line convenience task to a multi-stage build graph.
This generator produces a well-structured Makefile with the targets you choose. Every command is assigned to an overridable variable, dependencies are ordered sensibly (run depends on build, deploy depends on test build), and .PHONY declarations are added so that a stray file named test can never shadow the target.
Makefile concepts used here
- Targets — the name before the colon. Prerequisites after the colon must run first.
- Recipes — the indented lines under a target. They must be indented with a real tab, not spaces.
- Variables — values such as
TEST_CMDdefined with?=, meaning "set only if not already defined". - .PHONY — marks targets that are not files and should always run.
- Self-documenting help — comments beginning with
##are scraped by thehelptarget to build a target list. - Command-line overrides — because variables use
?=, you can runmake test TEST_CMD="pytest -x"without editing the file.
How to Use
- Select Language — Choose your project language. Each language generates language-appropriate commands.
- Set Binary Name — Enter the output binary or main file name for build targets.
- Choose Targets — Toggle which make targets to include: all, install, build, test, lint, clean, run, deploy.
- Configure Options — Enable .PHONY declarations, help target, or Docker targets if needed.
- Copy or Download — Download the Makefile and place it in your project root. Run
maketo execute the default target.
Targets reference
| Target | Depends on | What it does |
|---|---|---|
| all | install lint test build | Default target; runs the full check-and-build chain. |
| install | — | Installs dependencies via INSTALL_CMD. |
| build | — | Compiles or bundles the project via BUILD_CMD. |
| test | — | Runs the test suite via TEST_CMD. |
| lint | — | Runs the linter via LINT_CMD. |
| clean | — | Removes language-specific build artifacts. |
| run | build | Builds, then runs the program via RUN_CMD. |
| deploy | test build | Placeholder deploy target; add your own commands. |
| help | — | Lists every target carrying a ## description comment. |
Example generated Makefile
A trimmed Node.js Makefile with the default targets might look like this:
MAKEFLAGS += --no-print-directory
BIN ?= node
INSTALL_CMD ?= npm ci
BUILD_CMD ?= npm run build
TEST_CMD ?= npm test
LINT_CMD ?= npm run lint
RUN_CMD ?= node myapp.js
## Node.js — default target
all: install lint test build
## Install project dependencies
install:
@echo " Installing dependencies..."
@$(INSTALL_CMD)
## Run tests
test:
@echo " Running tests..."
@$(TEST_CMD)
.PHONY: all install build test lint clean run help
Each recipe line begins with a literal tab. If your editor replaces tabs with spaces, make will fail with a "missing separator" error — configure your editor to keep tabs in Makefiles.
Common use cases
- One-command onboarding — give a new contributor a single
makethat installs, lints, tests, and builds. - Continuous integration — call
make testfrom any CI provider so the build logic lives in one place. - Go, Rust, and C/C++ projects — wrap compiler invocations behind memorable target names.
- Polyglot repositories — expose a uniform interface over several toolchains.
- Local development — add Docker targets to build and run a container without memorising long commands.
Frequently Asked Questions
Do I need GNU Make installed?
Yes. The generated Makefile uses GNU Make syntax. On Linux install it with sudo apt install make. On macOS it ships with the Xcode Command Line Tools. On Windows use Chocolatey (choco install make) or run inside WSL.
What does the help target do?
The help target prints a list of all available targets with descriptions. It scans the Makefile for lines beginning with ## and prints them, so any target you document with a ## comment appears automatically when you run make help.
What are .PHONY targets?
.PHONY targets are targets that do not represent files and should always run, even if a file with the same name exists in the directory. Declaring clean, test, and install as phony prevents a file named test from silently blocking the test target.
Why does make say "missing separator"?
Make recipes must be indented with a real tab character, not spaces. If your editor converts tabs to spaces, make cannot parse the file. Enable "keep tabs" or an editor-level setting that preserves tabs in Makefiles.
How do the variables work?
Commands are stored in variables defined with ?=, which assigns a default only when the variable is not already set. That lets you override any command on the command line, for example make test TEST_CMD="pytest -x", without editing the file.
Does the Makefile work on Windows?
The generated file targets a POSIX shell. On Windows it works best under WSL or Git Bash, where make and a Unix-like shell are available. Native Windows users can install make through Chocolatey and use a shell such as Git Bash.
What does the deploy target do?
It is a placeholder. It depends on test and build so those run first, then it prints instructions to add your own commands. Replace the echo lines with your real deployment steps, such as rsync, kubectl, or ssh.
Is my data stored?
No. Everything runs entirely in your browser. Your project name and selections are never sent to any server.