Makefile Best Practices

Much of Equium’s Makefiles were inspired by Davis Hansson’s “Your Makefiles are wrong”give it a read!

See Opinionated Makefiles for detailed examples

Consistent Targets

mazel largely works by having consistent targets across Makefiles. Use common targets like test, format, and lint

BAD

js-package/Makefile:

eslint:
> eslint --fix .
.PHONY: eslint

py-package/Makefile:

black:
> black .
.PHONY: black

BETTER

js-package/Makefile:

format:
> eslint --fix .
.PHONY: eslint

py-package/Makefile:

format:
> black .
.PHONY: format

Now the command mazel run //:format will work against both packages.

See Makefile Mixins for how we can combine if there are multiple rules that should all contribute to the same target.