From f05f82b0222f30c9bb9f950e11d5bbc59c4d3d27 Mon Sep 17 00:00:00 2001 From: Pavel Okhlopkov Date: Wed, 5 Feb 2025 10:51:45 +0300 Subject: [PATCH] add makefile Signed-off-by: Pavel Okhlopkov --- Makefile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..3e1f8be7 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +GO=$(shell which go) +GIT=$(shell which git) + +.PHONY: go-check +go-check: + $(call error-if-empty,$(GO),go) + +.PHONY: git-check +git-check: + $(call error-if-empty,$(GIT),git) + +.PHONY: go-module-version +go-module-version: go-check git-check + @echo "go get $(shell $(GO) list ./cmd/shell-operator)@$(shell $(GIT) rev-parse HEAD)" + +.PHONY: test +test: go-check + @$(GO) test --race --cover ./... + +define error-if-empty +@if [[ -z $(1) ]]; then echo "$(2) not installed"; false; fi +endef \ No newline at end of file