浏览代码

Tidy Makefiles

* Make BINARY mutability explicit
* Default docker build output type is local so use this

Signed-off-by: Christopher Crone <[email protected]>
Christopher Crone 5 年之前
父节点
当前提交
654f9ebbaf
共有 2 个文件被更改,包括 13 次插入16 次删除
  1. 6 9
      Makefile
  2. 7 7
      builder.Makefile

+ 6 - 9
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

+ 7 - 7
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