diff --git a/Makefile b/Makefile index d60ec5ea7..20dbf3874 100644 --- a/Makefile +++ b/Makefile @@ -11,46 +11,53 @@ define check_command } endef -all : check_rake +# For colors +ifneq ($(shell tty -s),) + CYAN := $(shell tput setaf 6) + RESET := $(shell tput sgr0) +else + CYAN := + RESET := +endif + +.PHONY: all test clean check checkinstall checkupdate composecheck composetest check_rake check_docker_compose check_pre_commit help +.DEFAULT_GOAL := all + +all: check_rake ## build all targets, install (locally) in-repo $(RAKE) -.PHONY : all -test : check_rake all +test: check_rake all ## build and run all mruby tests $(RAKE) test -.PHONY : test -clean : check_rake +clean: check_rake ## clean all built and in-repo installed artifacts $(RAKE) clean -.PHONY : clean -check : check_pre_commit +check: check_pre_commit ## run all pre-commit hooks against all files $(PRE_COMMIT) run --all-files -.PHONY : check -checkinstall : check_pre_commit +checkinstall: check_pre_commit ## install the pre-commit hooks $(PRE_COMMIT) install -.PHONY : checkinstall -checkupdate : check_pre_commit +checkupdate: check_pre_commit ## check the pre-commit hooks for updates $(PRE_COMMIT) autoupdate -.PHONY : checkupdate -composecheck : check_docker_compose check_pre_commit +composecheck: check_docker_compose check_pre_commit ## run all pre-commit hooks against all files with docker-compose $(DOCKER_COMPOSE) -p mruby run test $(PRE_COMMIT) run --all-files -.PHONY : composecheck -composetest : check_docker_compose +composetest: check_docker_compose ## build and run all mruby tests with docker-compose $(DOCKER_COMPOSE) -p mruby run test -.PHONY : composetest -check_rake: +check_rake: ## check if Rake is installed $(call check_command, $(RAKE)) -.PHONY : check_rake -check_docker_compose: +check_docker_compose: ## check if docker-compose is installed $(call check_command, $(DOCKER_COMPOSE)) -.PHONY : check_docker_compose -check_pre_commit: +check_pre_commit: ## check if pre-commit is installed $(call check_command, $(PRE_COMMIT)) -.PHONY : check_pre_commit + +help: ## display this help message + @echo "Usage: make " + @echo + @echo "Available targets:" + @grep -E '^[a-z_-]+:.*##' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*## *"}; {printf " $(CYAN)%-20s$(RESET) %s\n", $$1, $$2}'