Skip to content

Instantly share code, notes, and snippets.

@damienpontifex
Last active September 16, 2025 00:38
Show Gist options
  • Save damienpontifex/5b87aeb8c0091c30798e1ba47dc5a4fb to your computer and use it in GitHub Desktop.
Save damienpontifex/5b87aeb8c0091c30798e1ba47dc5a4fb to your computer and use it in GitHub Desktop.
Makefile template
.SHELLFLAGS := -o errexit -o nounset -o pipefail
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
.PHONY: help all fmt validate
## help: Display available commands and their descriptions
help:
@echo "Usage:"
@sed -n 's/^##//p' $(MAKEFILE_LIST) \
| sort \
| awk -v bold="$$(tput bold)" -v normal="$$(tput sgr0)" '{ $$1 = bold $$1 normal; print }' \
| column -t -s ':'
all: fmt validate
## validate: Validate files
validate:
@echo "TODO: implement validation"
## fmt: Format files
fmt:
@echo "TODO: implement formatter"
# So that we don't have to setup symlinks, point to custom location instead of .git/hooks
git config --local core.hooksPath scripts/githooks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment