Makefile: deduplicate binaries

Signed-off-by: Roman Khimov <roman@nspcc.ru>
remotes/KirillovDenis/bugfix/681-fix_acl_parsing
Roman Khimov 2021-05-20 12:52:58 +03:00
parent 4e8412b86c
commit e622f1987b
8 changed files with 6 additions and 17 deletions

View File

@ -5,36 +5,25 @@ REPO ?= $(shell go list -m)
VERSION ?= "$(shell git describe --tags 2>/dev/null || git rev-parse --short HEAD | sed 's/^v//')"
BINDIR = bin
# s3 gw variables
BIN_NAME=neofs-s3-gw
BIN = "$(BINDIR)/$(BIN_NAME)"
# Binaries to build
CMDS = $(addprefix neofs-, $(notdir $(wildcard cmd/*)))
BINS = $(addprefix $(BINDIR)/, $(CMDS))
# Variables for docker
HUB_IMAGE ?= "nspccdev/$(BIN_NAME)"
HUB_TAG ?= "$(shell echo ${VERSION} | sed 's/^v//')"
# Authmate variables
AUTHMATE_BIN_NAME=neofs-authmate
AUTHMATE_BIN = "$(BINDIR)/$(AUTHMATE_BIN_NAME)"
.PHONY: help all dep clean format test cover lint docker/lint image-push image dirty-image
# Make all binaries
all: $(BIN) $(AUTHMATE_BIN)
all: $(BINS)
$(BIN): $(BINDIR) dep
$(BINS): $(BINDIR) dep
@echo "⇒ Build $@"
CGO_ENABLED=0 \
go build -v -trimpath \
-ldflags "-X main.Version=$(VERSION)" \
-o $@ ./cmd/gate
$(AUTHMATE_BIN): $(BINDIR) dep
@echo "⇒ Build $@"
CGO_ENABLED=0 \
go build -v -trimpath \
-ldflags "-X main.Version=$(VERSION)" \
-o $@ ./cmd/authmate
-o $@ ./cmd/$(subst neofs-,,$(notdir $@))
$(BINDIR):
@echo "⇒ Ensure dir: $@"