From e622f1987b5ad122e0b6dac1e3091f6b0a56cb96 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 20 May 2021 12:52:58 +0300 Subject: [PATCH] Makefile: deduplicate binaries Signed-off-by: Roman Khimov --- Makefile | 23 ++++++----------------- cmd/{gate => s3-gw}/app-healthy.go | 0 cmd/{gate => s3-gw}/app-metrics.go | 0 cmd/{gate => s3-gw}/app-profiler.go | 0 cmd/{gate => s3-gw}/app-settings.go | 0 cmd/{gate => s3-gw}/app.go | 0 cmd/{gate => s3-gw}/app_router.go | 0 cmd/{gate => s3-gw}/main.go | 0 8 files changed, 6 insertions(+), 17 deletions(-) rename cmd/{gate => s3-gw}/app-healthy.go (100%) rename cmd/{gate => s3-gw}/app-metrics.go (100%) rename cmd/{gate => s3-gw}/app-profiler.go (100%) rename cmd/{gate => s3-gw}/app-settings.go (100%) rename cmd/{gate => s3-gw}/app.go (100%) rename cmd/{gate => s3-gw}/app_router.go (100%) rename cmd/{gate => s3-gw}/main.go (100%) diff --git a/Makefile b/Makefile index 1c8b8631..aaad91c4 100644 --- a/Makefile +++ b/Makefile @@ -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: $@" diff --git a/cmd/gate/app-healthy.go b/cmd/s3-gw/app-healthy.go similarity index 100% rename from cmd/gate/app-healthy.go rename to cmd/s3-gw/app-healthy.go diff --git a/cmd/gate/app-metrics.go b/cmd/s3-gw/app-metrics.go similarity index 100% rename from cmd/gate/app-metrics.go rename to cmd/s3-gw/app-metrics.go diff --git a/cmd/gate/app-profiler.go b/cmd/s3-gw/app-profiler.go similarity index 100% rename from cmd/gate/app-profiler.go rename to cmd/s3-gw/app-profiler.go diff --git a/cmd/gate/app-settings.go b/cmd/s3-gw/app-settings.go similarity index 100% rename from cmd/gate/app-settings.go rename to cmd/s3-gw/app-settings.go diff --git a/cmd/gate/app.go b/cmd/s3-gw/app.go similarity index 100% rename from cmd/gate/app.go rename to cmd/s3-gw/app.go diff --git a/cmd/gate/app_router.go b/cmd/s3-gw/app_router.go similarity index 100% rename from cmd/gate/app_router.go rename to cmd/s3-gw/app_router.go diff --git a/cmd/gate/main.go b/cmd/s3-gw/main.go similarity index 100% rename from cmd/gate/main.go rename to cmd/s3-gw/main.go