Skip to content

Instantly share code, notes, and snippets.

@adomokos
Last active February 18, 2020 00:21
Show Gist options
  • Save adomokos/2fd95840d59b19bbb3f4 to your computer and use it in GitHub Desktop.
Save adomokos/2fd95840d59b19bbb3f4 to your computer and use it in GitHub Desktop.
Makefile template
DBUSER=db_user
DBPASSWD=db_password
DBNAME=some_db
THIS_FILE := $(lastword $(MAKEFILE_LIST))
.DEFAULT_GOAL := help
build-db: ## Builds the DB
dropdb --if-exists --username $(DBUSER) $(DBNAME)
createdb --username $(DBUSER) $(DBNAME)
.PHONY: help
help: ## Prints this help command
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) |\
sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment