Adding help output and remote includes to a Go Makefile with mmake

mmake (“Modern Make”) by TJ Holowaychuk is a small program that wraps make. It adds two things Make lacks, a help command built from comments in your Makefile and includes that point at URLs, and passes everything else straight through to make. You keep writing an ordinary Makefile; there is no separate YAML or JSON task format.
Install
Section titled “Install”From source (needs Go):
go install github.com/tj/mmake/cmd/mmake@latestOr with Homebrew:
brew tap tj/mmake https://github.com/tj/mmake.gitbrew install tj/mmake/mmakeThe README suggests aliasing it so you keep typing make:
alias make=mmakeThe examples below call mmake explicitly.
A Go project with a commented Makefile
Section titled “A Go project with a commented Makefile”Start with a module and a main.go:
mkdir my-go-projectcd my-go-projectgo mod init example.com/my-go-projectpackage main
import "fmt"
func main() { fmt.Println("Hello, mmake!")}Now a Makefile. The comment directly above each target becomes its help text; the first sentence is the short description. Recipe lines must be indented with a tab.
# Build the binary.build: go build -o bin/my-go-project ..PHONY: build
# Run the program.## Builds first if needed.run: build ./bin/my-go-project.PHONY: run
# Run the tests.#- Lines starting with "#-" are left out of the help output.test: go test ./....PHONY: testUsing the help command
Section titled “Using the help command”List every documented target:
mmake help build Build the binary. run Run the program. test Run the tests.Filter with a glob pattern, or show the full comments with -v:
mmake help r*mmake help -v runAny other target goes to make unchanged, so mmake build, mmake run and mmake test behave exactly like make build, make run and make test. The test target prints [no test files] until you add a _test.go file.
Remote includes
Section titled “Remote includes”The other feature is include lines that point at a URL or a GitHub path:
include github.com/apex/make/golanginclude https://github.com/apex/make/test/make.mkmmake downloads these into /usr/local/include, the directory GNU Make searches for includes by default, so the Makefile still works with plain make once the files are there. Includes are resolved recursively, and if a repository has an index.mk you can include the repository path on its own. Downloads are cached; run mmake update to fetch fresh copies.
Two things to watch:
- A remote include is code that runs on your machine. The README’s advice is to fork any Makefile repository you include, so you control what changes.
- Writing to
/usr/local/includeoften needs elevated permissions, and teammates who use plainmakewithout having run mmake once won’t have the included files.
Further reading
Section titled “Further reading”© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)