Dev
Mock Makefile 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. The build, test, and run commands are randomised from common toolchain patterns: npm run build / npm test / npm start, go build / go test ./... / go run ., python -m build / pytest / python app.py. The file always includes a .PHONY declaration for all targets, a clean target (rm -rf dist build bin), and an all target that chains build and test. 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
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Click Generate to produce a Makefile.
- Copy it into your project root.
- Adapt the commands to your stack.
- 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
Five targets: build, test, run, clean (rm -rf dist build bin), and all (which chains build and test). All are declared in the .PHONY line. The commands for build, test, and run are randomised from npm, Go, and Python toolchain variants.
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.
Try these next
More free tools from other corners of the catalog, picked by shared themes.