Skip to main content
Dev · 283 tools

Mock Makefile Generator

Generates an example Makefile with common build and run targets

MakefileExample — click Generate for yours
# quartz-auth: development targets .PHONY: install build test lint fmt run docker deploy clean all install: @echo "Installing dependencies for quartz-auth" npm ci --ignore-scripts build: vite build test: build @echo "==> test quartz-auth" npx vitest run --coverage lint: npm run lint fmt: npm run format run: node dist/quartz-auth.js docker: @echo "Building image for quartz-auth:0.3.4" docker compose build quartz-auth deploy: test @echo "Deploying quartz-auth 0.3.4" fly deploy --app quartz-auth clean: rm -rf dist node_modules/.cache all: install build test

Generated 77 words · 583 characters

See 3 examples
  • Example 1
    # quartz-auth: development targets
    .PHONY: install build test lint fmt run docker deploy clean all
    
    install:
    	@echo "Installing dependencies for quartz-auth"
    	npm ci --ignore-scripts
    
    build:
    	vite build
    
    test: build
    	@echo "==> test quartz-auth"
    	npx vitest run --coverage
    
    lint:
    	npm run lint
    
    fmt:
    	npm run format
    
    run:
    	node dist/quartz-auth.js
    
    docker:
    	@echo "Building image for quartz-auth:0.3.4"
    	docker compose build quartz-auth
    
    deploy: test
    	@echo "Deploying quartz-auth 0.3.4"
    	fly deploy --app quartz-auth
    
    clean:
    	rm -rf dist node_modules/.cache
    
    all: install build test
  • Example 2
    # acorn-ingest build, test and release helpers
    .PHONY: install build test lint fmt run docker deploy clean all
    
    install:
    	@echo "==> install deps (acorn-ingest)"
    	deno cache main.ts
    
    build:
    	@echo "==> build acorn-ingest v0.18.1"
    	deno task build
    
    test: build
    	deno test
    
    lint:
    	deno check main.ts
    
    fmt:
    	deno fmt --check
    
    run:
    	deno run --allow-net main.ts
    
    docker:
    	@echo "Building image for acorn-ingest:0.18.1"
    	docker build -t ghcr.io/labs/acorn-ingest:0.18.1 .
    
    deploy: test
    	kubectl apply -f k8s/acorn-ingest/
    
    clean:
    	rm -f bin/acorn-ingest
    
    all: install build test
  • Example 3
    # Makefile for marble-proxy (Maven)
    .PHONY: install build test lint fmt run docker deploy clean all
    
    install:
    	./mvnw -B dependency:go-offline
    
    build:
    	./mvnw -B package -DskipTests
    
    test: build
    	@echo "Running marble-proxy test suite"
    	mvn -B verify
    
    lint:
    	./mvnw -B pmd:check
    
    fmt:
    	./mvnw spotless:apply
    
    run:
    	java -jar target/marble-proxy-2.19.6.jar
    
    docker:
    	@echo "==> docker image marble-proxy:2.19.6"
    	docker build -t ghcr.io/devtools/marble-proxy:2.19.6 .
    
    deploy: test
    	kubectl rollout restart deployment/marble-proxy
    
    clean:
    	mvn clean
    
    all: install build test

About this generator

Make gives any project a simple, memorable command interface — make build, make test, make run — that works regardless of whether the underlying toolchain is npm, Go, Python, or anything else. For developers who only encounter Makefiles occasionally, the tab-vs-spaces rule and the .PHONY declaration are easy to forget and hard to debug. This tool generates a correct, minimal Makefile. There are no inputs. Each click picks one of 22 toolchains — npm, Yarn, pnpm, Bun, Deno, pip, Poetry, uv, Go, Rust, Ruby, Maven, Gradle, .NET, PHP, Elixir, C/CMake, Swift, Dart, Scala, Haskell and Zig — and fills realistic commands for each target, using a generated project name and version (for example go build -o bin/ledger-api ./cmd/ledger-api or pytest --cov=ledger_api). The file always declares every target in a .PHONY line and includes install, build, test, lint, fmt, run, docker, deploy and clean targets, plus an all target that chains install, build and test; some recipes add an @echo progress line. Copy the output into a Makefile at your project root. The single most important thing to preserve: recipe lines must be indented with a real tab character, not spaces. Most editors can do this, but a copy-paste through some tools converts tabs to spaces, causing a 'missing separator' error that is confusing the first time you see it.

How to use

  1. Click Generate to produce a Makefile.
  2. Copy it into your project root.
  3. Adapt the commands to your stack.
  4. Keep recipe lines indented with tabs.

Use Cases

  • •Learning Make and Makefiles
  • •Scaffolding project commands
  • •Documenting build and run tasks
  • •Giving a project a command interface
  • •Demoing Make conventions

Tips

  • →Recipes must be tab-indented.
  • →.PHONY marks non-file targets.
  • →make build runs the build target.
  • →Adapt commands to your toolchain.

FAQ

what targets does the generated makefile include

Ten targets: install, build, test (which depends on build), lint, fmt, run, docker, deploy (which depends on test), clean, and all (which chains install, build and test). All are declared in the .PHONY line. The commands come from 22 toolchains, from npm and Go to Rust, .NET and CMake, and use a generated project name and version.

why must makefile recipes use tabs not spaces

Make's parser was designed to use a tab as the literal separator between a target line and its recipe. Spaces — even the right number of them — cause a 'missing separator' error. This is a well-known Make quirk. When copying a Makefile, verify your editor has not silently converted the tabs to spaces.

what does .phony do and why does it matter

Without .PHONY, Make checks whether a file named after the target exists. If a file called 'build' or 'test' exists in the directory, Make considers the target up to date and skips it. Declaring targets as .PHONY tells Make they are always commands to run, not files to build, so they execute every time regardless of what is on disk.

can I use a makefile for a project that already has a task runner

Yes — a Makefile works alongside npm scripts, Taskfiles, or CI configs. Many teams use a thin Makefile as a project-level front door that delegates to the underlying tool: make test calls npm test or pytest, so there is one command to remember regardless of language. The generated Makefile demonstrates this pattern.

You might also like

Popular tools from other categories that share themes with this one.