Whether you’re actually utilizing Make’s build capabilities, or simply using it to run ad-hoc “tasks”, Make is a ubiquitous tool used across the industry, but can we improve upon it without starting from scratch?
MMake or “Modern Make” is a small Go program wrapping standard Make to augment its functionality, providing nice help output, remote inclusion, and possibly more in the future.
The first small feature is first-class target help output. Suppose you have the following makefile with a few targets defined, you’d like to have a way to view the help from the command-line right?
# Start the dev server.
# Note that the API must also be running.
@gopherjs -m -v serve --http :3000 github.com/tj/docs/client
# Start the API server.
@go run server/cmd/api/api.go
# Display dependency graph.
@godepgraph github.com/tj/docs/client | dot -Tsvg | browser
# Display size of dependencies.
@gopherjs build client/*.go -m -o /tmp/out.js
@du -h /tmp/out.js
@gopher-count /tmp/out.js | sort -nr
With make aliased to mmake you can simply run
start Start the dev server.
api Start the API server.
deps Display dependency graph.
size Display size of dependencies.
Alternatively you may view the full description for a single target via
make help start :
Start the dev server.
Note that the API must be also running.
The second feature currently supported is recursive remote includes, which are stored in /usr/local/include providing backwards-compatible support for users without mmake installed.
For example to extract some common functionality for your team, you might want a repo with common includes like ./deploy.mk, ./lint.mk and so on. The
include directive supports directories as well, so you can structure these repos however you like.
Alternatively you might want one include per environment such as Node or Golang, making it easy to keep the team up-to-date.
If you’re worried about arbitrary code execution, then simply fork a project and retain full control.
I’ve been wanting this for years but never actually got around to it! If you use Make check out the project at https://github.com/tj/mmake, and if you don’t, maybe now you’ll consider it :).