From 654f9ebbaf846cfc8c098502e047b44013ab83df Mon Sep 17 00:00:00 2001 From: Christopher Crone Date: Tue, 2 Jun 2020 11:53:13 +0200 Subject: [PATCH] Tidy Makefiles * Make BINARY mutability explicit * Default docker build output type is local so use this Signed-off-by: Christopher Crone --- Makefile | 15 ++++++--------- builder.Makefile | 14 +++++++------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 11a8f5dcd..aec719638 100644 --- a/Makefile +++ b/Makefile @@ -29,12 +29,12 @@ all: cli protos: ## Generate go code from .proto files @docker build . --target protos \ - --output type=local,dest=./protos + --output ./protos cli: ## Compile the cli @docker build . --target cli \ --platform local \ - --output type=local,dest=./bin + --output ./bin e2e-local: ## Run End to end local tests go test -v ./tests/e2e ./moby/e2e @@ -43,20 +43,17 @@ e2e-aci: ## Run End to end ACI tests (requires azure login) go test -v ./tests/aci-e2e cross: ## Compile the CLI for linux, darwin and windows - @docker build . \ - --output type=local,dest=./bin \ - --target cross + @docker build . --target cross \ + --output ./bin \ test: ## Run unit tests - @docker build . \ - --target test + @docker build . --target test cache-clear: ## Clear the builder cache @docker builder prune --force --filter type=exec.cachemount --filter=unused-for=24h lint: ## run linter(s) - @docker build . \ - --target lint + @docker build . --target lint classic-link: ## create docker-classic symlink if does not already exist ln -s /Applications/Docker.app/Contents/Resources/bin/docker /usr/local/bin/docker-classic diff --git a/builder.Makefile b/builder.Makefile index d001063f9..ce5ea1a8c 100644 --- a/builder.Makefile +++ b/builder.Makefile @@ -23,21 +23,21 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH # THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -GOOS ?= $(shell go env GOOS) -GOARCH ?= $(shell go env GOARCH) +GOOS?=$(shell go env GOOS) +GOARCH?=$(shell go env GOARCH) PROTOS=$(shell find protos -name \*.proto) -EXTENSION := +EXTENSION:= ifeq ($(GOOS),windows) - EXTENSION := .exe + EXTENSION:=.exe endif STATIC_FLAGS=CGO_ENABLED=0 -LDFLAGS := "-s -w" -GO_BUILD = $(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS) +LDFLAGS:="-s -w" +GO_BUILD=$(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS) -BINARY=bin/docker +BINARY?=bin/docker BINARY_WITH_EXTENSION=$(BINARY)$(EXTENSION) all: cli