mbake
A Python-based Makefile formatter and linter
What it is and what it does
mbake is a Python-based formatter and linter for Makefiles that enforces consistent style—converting spaces to tabs in recipes, normalizing spacing around assignments and colons, and cleaning up line continuations. It includes intelligent .PHONY detection that analyzes recipe commands to identify targets that don't produce files, and can optionally insert .PHONY declarations automatically. The tool validates Makefile syntax before and after formatting, supports CI/CD workflows with a check mode that reports whether formatting is needed without modifying files, and allows customization through a TOML configuration file.
The package is designed for developers and build systems that need to maintain consistent Makefile style across projects. It integrates with VSCode through an extension and provides command-line commands for formatting, validation, and configuration management. Dependencies are minimal—rich for terminal output, tomli for TOML parsing, and typer for CLI argument handling—making it lightweight to add to existing build pipelines.
Use it for:
- Enforce consistent Makefile formatting in CI/CD pipelines using --check mode to validate style compliance before merge
- Auto-format Makefiles in a repository to fix inconsistent spacing, tabs, and line continuations across multiple projects
- Validate Makefile syntax as part of a build validation step to catch errors before deployment
- Automatically insert and manage .PHONY declarations based on recipe analysis to prevent false file-target conflicts
- Integrate with VSCode to format Makefiles on save or on-demand using the mbake extension
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
mbake formats and lints Makefiles, enforcing consistent spacing, tab usage in recipes, and valid syntax while optionally auto-detecting and managing .PHONY declarations.
Yes. mbake fills a genuine gap in Makefile tooling with low install friction, active maintenance, permissive licensing, and no known vulnerabilities. It is well-suited for teams that need consistent Makefile style enforcement or CI/CD validation.
Install
mbake on PyPI
pip
pip install mbakeuv
uv add mbakepoetry
poetry add mbakeInstalling mbake
Before you install
Low install friction with three lightweight runtime dependencies (rich, tomli, typer). Active maintenance with recent release and steady repository activity.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.
Quickstart
pip install mbake
mbake format --check Makefile
Verify before relying
- Whether GNU make must be installed on the system for validation features to work
- Scope of Makefile syntax validation coverage across different make dialects
- Performance characteristics when formatting very large Makefiles
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — rich, tomli, typer |
| Maintenance | actively maintained — 136 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 78,960/month — #14,390 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mbake-1.4.6-py3-none-any.whl
Keywords: build-tools, formatter, linter, makefile
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
config-formatterAutomatically formats .ini and .cfg…
permissive · top 15,000 on PyPI
djlintdjlint formats and lints HTML templates with…
copyleft · top 5,000 on PyPI
yamllintyamllint checks YAML files for syntax errors,…
copyleft · top 1,000 on PyPI
flake8-broken-lineA flake8 plugin that detects and forbids…
permissive · top 15,000 on PyPI
gersemigersemi is a command-line formatter for CMake…
copyleft · top 15,000 on PyPI
robotframework-tidyRobotidy autoformats Robot Framework test code,…
permissive · top 15,000 on PyPI
lintroLintro unifies code formatting, linting, and…
permissive · top 15,000 on PyPI
reformat-gherkinAutomatically formats Gherkin feature files to…
permissive · top 15,000 on PyPI
tclinttclint is a CLI linter, formatter, and language…
permissive · top 15,000 on PyPI
compiledbGenerates Clang JSON compilation databases from…
copyleft · top 15,000 on PyPI