Makefile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. GOOS ?= $(shell go env GOOS)
  23. GOARCH ?= $(shell go env GOARCH)
  24. export DOCKER_BUILDKIT=1
  25. all: cli
  26. protos: ## Generate go code from .proto files
  27. @docker build . \
  28. --target protos
  29. cli: ## Compile the cli
  30. @docker build . \
  31. --output type=local,dest=./bin \
  32. --build-arg TARGET_OS=${GOOS} \
  33. --build-arg TARGET_ARCH=${GOARCH} \
  34. --target cli
  35. e2e-local: ## Run End to end local tests
  36. go run ./tests/e2e/e2e.go
  37. cross: ## Compile the CLI for linux, darwin and windows
  38. @docker build . \
  39. --output type=local,dest=./bin \
  40. --target cross
  41. test: ## Run unit tests
  42. @docker build . \
  43. --target test
  44. cache-clear: ## Clear the builder cache
  45. @docker builder prune --force --filter type=exec.cachemount --filter=unused-for=24h
  46. lint: ## run linter(s)
  47. @docker build . \
  48. --target lint
  49. help: ## Show help
  50. @echo Please specify a build target. The choices are:
  51. @grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
  52. FORCE:
  53. .PHONY: all protos cli e2e-local cross test cache-clear lint help