Skip to content
UniKit

Makefile generator

Generate a Makefile for Node, Python, Go, Rust, PHP or Java with install, build, test, lint, run and clean targets, automatic .PHONY registration, variables and an optional self-documenting help target.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Project setup

install, build, test and lint delegate to package.json scripts; run maps to the dev script.

Preview

Targets
7
Lines
30
Targets
  • make helpList every available target
  • make installInstall dependencies
  • make buildBuild the project
  • make testRun the test suite
  • make lintRun the linter
  • make runRun the project locally
  • make cleanRemove build artifacts
Makefile
# Makefile — generated with UniKit

PROJECT  := app
PKG      := pnpm

.DEFAULT_GOAL := help

.PHONY: help install build test lint run clean

help: ## Show available targets
	@echo "$(PROJECT): available targets"
	@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "  \033[36m%-14s\033[0m %s\n", $$1, $$2}'

install: ## Install dependencies
	pnpm install

build: ## Build the project
	pnpm run build

test: ## Run the test suite
	pnpm test

lint: ## Run the linter
	pnpm run lint

run: ## Run the project locally
	pnpm run dev

clean: ## Remove build artifacts
	rm -rf dist coverage

Recipe lines are tab indented and every target is registered under .PHONY; the help target documents itself through ## comments, so a bare make lists all commands.

What this tool does

  • Give a new repository a Makefile so installing, building, testing, linting, running and cleaning all go through stable make install / make build entry points.
  • Generate the right command shapes for each language instead of recalling whether gofmt needs go vet or pytest wants python -m.
  • Agree on one entry point for the team: a newcomer runs make help and sees every command without digging through the README.
  • Call make test and make lint from CI so local runs and the pipeline use exactly the same commands.

Example

Input

Language Node.js, package manager pnpm, project name app, help target enabled

Output

# Makefile — generated with UniKit

PROJECT  := app
PKG      := pnpm

.DEFAULT_GOAL := help

.PHONY: help install build test lint run clean

help: ## Show available targets
	@echo "$(PROJECT): available targets"
	@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "  \033[36m%-14s\033[0m %s\n", $$1, $$2}'

install: ## Install dependencies
	pnpm install

build: ## Build the project
	pnpm run build

test: ## Run the test suite
	pnpm test

lint: ## Run the linter
	pnpm run lint

run: ## Run the project locally
	pnpm run dev

clean: ## Remove build artifacts
	rm -rf dist coverage

Recipe lines must start with a tab, so make sure your editor does not convert them to spaces; $$1 and $$2 are how you write $1 and $2 inside a Makefile.

Frequently asked questions

Why does every command line start with a tab?

GNU Make requires recipe lines to be tab indented — spaces produce a missing separator error. The generator always emits tabs, but if your editor converts tabs to spaces you need to disable that, or set indent_style = tab in .editorconfig.

How does the help target list the commands?

Each target carries a one-line ## description, and the help target greps for lines shaped like target: ## description and pipes them through awk. Add a ## comment to any new target and make help picks it up automatically.

When do the variables use ?= instead of :=?

:= evaluates immediately, which suits fixed values; ?= only applies when nothing else set the variable, so users can override it — PYTHON=python3.12 make test, for example. Tool commands such as python3, cargo and mvn use ?=, while the project name uses :=.

What does the run target do in a Node project?

run maps to the dev script in package.json, which is the local development mode; add a separate start target for production. The package manager decides the syntax: yarn takes the script name directly, while npm, pnpm and bun need run.

What do I normally have to adjust?

Usually three things: that package.json really has build, lint and dev scripts; the Python entry module and requirements.txt; and that the jar name matches the JAR variable in a Maven project. Run make help afterwards to confirm.

Keywords:makefilemakefile generatorMakefile 模板make help.PHONYmake targetsgnu makebuild automation构建脚本自动化任务make installmake build

Related tools