Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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: dbins
  28. xall: dxbins
  29. bins: cli example
  30. xbins: xcli xexample
  31. protos:
  32. @protoc -I. --go_out=plugins=grpc,paths=source_relative:. ${PROTOS}
  33. cli: protos
  34. GOOS=${GOOS} GOARCH=${GOARCH} go build -v -o bin/docker ./cli
  35. xcli: cli
  36. GOOS=linux GOARCH=amd64 go build -v -o bin/docker-linux-amd64 ./cli
  37. GOOS=darwin GOARCH=amd64 go build -v -o bin/docker-darwin-amd64 ./cli
  38. GOOS=windows GOARCH=amd64 go build -v -o bin/docker-windows-amd64.exe ./cli
  39. dbackend-protos:
  40. docker build . \
  41. --output type=local,dest=. \
  42. --target protos
  43. dbins: dprotos
  44. docker build . \
  45. --output type=local,dest=./bin \
  46. --build-arg TARGET_OS=${GOOS} \
  47. --build-arg TARGET_ARCH=${GOARCH} \
  48. --target bins
  49. dxbins: dbins
  50. docker build . \
  51. --output type=local,dest=./bin \
  52. --target xbins
  53. dtest:
  54. docker build . \
  55. --target make-test
  56. test:
  57. gotestsum ./...
  58. FORCE:
  59. .PHONY: all xall protos xcli cli bins dbins dxbins dprotos