builder.Makefile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Copyright (c) 2020 Docker Inc.
  2. # Permission is hereby granted, free of charge, to any person
  3. # obtaining a copy of this software and associated documentation
  4. # files (the "Software"), to deal in the Software without
  5. # restriction, including without limitation the rights to use, copy,
  6. # modify, merge, publish, distribute, sublicense, and/or sell copies
  7. # of the Software, and to permit persons to whom the Software is
  8. # furnished to do so, subject to the following conditions:
  9. # The above copyright notice and this permission notice shall be
  10. # included in all copies or substantial portions of the Software.
  11. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  12. # EXPRESS OR IMPLIED,
  13. # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  15. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  16. # HOLDERS BE LIABLE FOR ANY CLAIM,
  17. # DAMAGES OR OTHER LIABILITY,
  18. # WHETHER IN AN ACTION OF CONTRACT,
  19. # TORT OR OTHERWISE,
  20. # ARISING FROM, OUT OF OR IN CONNECTION WITH
  21. # THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. GIT_COMMIT=$(shell git rev-parse --short HEAD)
  23. GOOS ?= $(shell go env GOOS)
  24. GOARCH ?= $(shell go env GOARCH)
  25. PROTOS=$(shell find . -name \*.proto)
  26. export DOCKER_BUILDKIT=1
  27. all: cli
  28. protos:
  29. @protoc -I. --go_out=plugins=grpc,paths=source_relative:. ${PROTOS}
  30. @goimports -w -local github.com/docker/api .
  31. cli:
  32. GOOS=${GOOS} GOARCH=${GOARCH} go build -v -o bin/docker ./cli
  33. xcli:
  34. @GOOS=linux GOARCH=amd64 go build -v -o bin/docker-linux-amd64 ./cli
  35. @GOOS=darwin GOARCH=amd64 go build -v -o bin/docker-darwin-amd64 ./cli
  36. @GOOS=windows GOARCH=amd64 go build -v -o bin/docker-windows-amd64.exe ./cli
  37. test:
  38. @gotestsum ./...
  39. FORCE:
  40. .PHONY: all protos cli xcli