0123456789101112131415161718192021222324252627
|
.PHONY: all build image tidy test benchmark help
all: help
MODULE = $(shell go list -m)
PROGRAM = goit
VERSION ?= $(shell git describe --tags --always)
build: ## Build the project
@go build -ldflags "-X $(MODULE)/res.Version=$(VERSION)" -o "./bin/$(PROGRAM)" ./src
@go build -ldflags "-X $(MODULE)/res.Version=$(VERSION)" -o "./bin/$(PROGRAM)-shell" ./src/shell
image: ## Build the project image
@docker build -t "$(PROGRAM):$(VERSION)" --build-arg version="$(VERSION)" .
tidy: ## Tidy the project
@go mod tidy
@go fmt ./...
test: ## Run unit tests
@go test ./...
benchmark: ## Run benchmarks
@go test -run - -bench . ./...
help: ## Display help information
@grep -E '^[a-zA-Z_-]+:.*?##.*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## *"}; {printf "\033[36m%-9s\033[0m %s\n", $$1, $$2}'
|