From 448dc08d6a8424798fa511f57c8155a0f6f42c4c Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 13 Jun 2019 11:59:36 +0200 Subject: [PATCH] Improve Makefile adding auto-help when called with no args --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 55b0c38..69a999b 100644 --- a/Makefile +++ b/Makefile @@ -7,14 +7,18 @@ PYTHON ?= python lib := $(patsubst matrix/%.py, $(DESTDIR)$(PREFIX)/python/matrix/%.py, \ $(wildcard matrix/*.py)) -install: install-dir install-lib +.PHONY: help +help: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +install: install-dir install-lib ## Install the plugin to $(DESTDIR)/$(PREFIX) install -m644 main.py $(DESTDIR)$(PREFIX)/python/matrix.py install-lib: $(lib) install-dir: install -d $(DESTDIR)$(PREFIX)/python/matrix -uninstall: +uninstall: ## Uninstall the plugin from $(PREFIX) rm $(DESTDIR)$(PREFIX)/python/matrix.py $(DESTDIR)$(PREFIX)/python/matrix/* rmdir $(DESTDIR)$(PREFIX)/python/matrix @@ -23,9 +27,9 @@ phony: $(DESTDIR)$(PREFIX)/python/matrix/%.py: matrix/%.py phony install -m644 $< $@ -test: +test: ## Run automated tests python3 -m pytest python2 -m pytest -typecheck: +typecheck: ## Run type check mypy -p matrix --ignore-missing-imports --warn-redundant-casts