base.mk 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. CHECK_TOOLS ?=
  2. TEST_TOOLS ?=
  3. all: clean build test check ## Runs clean, build, test, check
  4. .PHONY: all
  5. prepush: check test ## Runs all checks/test required before pushing
  6. @echo "--- $@"
  7. @echo "all prepush targets passed, okay to push."
  8. .PHONY: prepush
  9. checktools: ## Checks that required check tools are found on PATH
  10. @echo "--- $@"
  11. $(foreach tool, $(CHECK_TOOLS), $(if $(shell which $(tool)),, \
  12. $(error "Required tool '$(tool)' not found on PATH")))
  13. .PHONY: checktools
  14. testtools: ## Checks that required test tools are found on PATH
  15. @echo "--- $@"
  16. $(foreach tool, $(TEST_TOOLS), $(if $(shell which $(tool)),, \
  17. $(error "Required tool '$(tool)' not found on PATH")))
  18. .PHONY: testtools
  19. help: ## Prints help information
  20. @printf -- "\033[1;36;40mmake %s\033[0m\n" "$@"
  21. @echo
  22. @echo "USAGE:"
  23. @echo " make [TARGET]"
  24. @echo
  25. @echo "TARGETS:"
  26. @grep -hE '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk '\
  27. BEGIN { FS = ":.*?## " }; \
  28. { printf " \033[1;36;40m%-20s\033[0m %s\n", $$1, $$2 }'
  29. .PHONY: help