2020-07-14 11:33:52 +00:00
|
|
|
VERSION ?= "$(shell git describe --tags 2>/dev/null || git rev-parse --short HEAD | sed 's/^v//')"
|
2020-07-03 15:08:57 +00:00
|
|
|
BUILD_VERSION ?= "$(shell git describe --abbrev=0 --tags | sed 's/^v//')"
|
|
|
|
|
|
|
|
.PHONY: help format deps
|
|
|
|
|
|
|
|
# Show this help prompt
|
|
|
|
help:
|
|
|
|
@echo ' Usage:'
|
|
|
|
@echo ''
|
|
|
|
@echo ' make <target>'
|
|
|
|
@echo ''
|
|
|
|
@echo ' Targets:'
|
|
|
|
@echo ''
|
|
|
|
@awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort | uniq
|
|
|
|
|
2020-07-14 11:33:52 +00:00
|
|
|
# Show current version
|
|
|
|
version:
|
|
|
|
@echo $(VERSION)
|
|
|
|
|
2020-07-03 15:08:57 +00:00
|
|
|
# Reformat code
|
|
|
|
format:
|
|
|
|
@[ ! -z `which goimports` ] || (echo "install goimports" && exit 2)
|
|
|
|
@for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \
|
|
|
|
echo "⇒ Processing $$f"; \
|
|
|
|
goimports -w $$f; \
|
|
|
|
done
|
|
|
|
|
|
|
|
# Make sure that all files added to commit
|
|
|
|
deps:
|
|
|
|
@printf "⇒ Ensure vendor: "
|
|
|
|
@go mod tidy -v && echo OK || (echo fail && exit 2)
|
|
|
|
@printf "⇒ Download requirements: "
|
|
|
|
@go mod download && echo OK || (echo fail && exit 2)
|
|
|
|
@printf "⇒ Store vendor localy: "
|
|
|
|
@go mod vendor && echo OK || (echo fail && exit 2)
|
|
|
|
|
|
|
|
# Build current docker image
|
|
|
|
image-build:
|
|
|
|
@echo "⇒ Build docker-image"
|
|
|
|
@docker build \
|
|
|
|
--build-arg VERSION=$(VERSION) \
|
|
|
|
-f Dockerfile \
|
|
|
|
-t nspccdev/neofs-s3-gate:$(VERSION) .
|