Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. IMAGE_REPO ?= tailscale/tailscale
  2. SYNO_ARCH ?= "amd64"
  3. SYNO_DSM ?= "7"
  4. TAGS ?= "latest"
  5. vet: ## Run go vet
  6. ./tool/go vet ./...
  7. tidy: ## Run go mod tidy
  8. ./tool/go mod tidy
  9. lint: ## Run golangci-lint
  10. ./tool/go run github.com/golangci/golangci-lint/cmd/golangci-lint run
  11. updatedeps: ## Update depaware deps
  12. # depaware (via x/tools/go/packages) shells back to "go", so make sure the "go"
  13. # it finds in its $$PATH is the right one.
  14. PATH="$$(./tool/go env GOROOT)/bin:$$PATH" ./tool/go run github.com/tailscale/depaware --update \
  15. tailscale.com/cmd/tailscaled \
  16. tailscale.com/cmd/tailscale \
  17. tailscale.com/cmd/derper
  18. depaware: ## Run depaware checks
  19. # depaware (via x/tools/go/packages) shells back to "go", so make sure the "go"
  20. # it finds in its $$PATH is the right one.
  21. PATH="$$(./tool/go env GOROOT)/bin:$$PATH" ./tool/go run github.com/tailscale/depaware --check \
  22. tailscale.com/cmd/tailscaled \
  23. tailscale.com/cmd/tailscale \
  24. tailscale.com/cmd/derper
  25. buildwindows: ## Build tailscale CLI for windows/amd64
  26. GOOS=windows GOARCH=amd64 ./tool/go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled
  27. build386: ## Build tailscale CLI for linux/386
  28. GOOS=linux GOARCH=386 ./tool/go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled
  29. buildlinuxarm: ## Build tailscale CLI for linux/arm
  30. GOOS=linux GOARCH=arm ./tool/go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled
  31. buildwasm: ## Build tailscale CLI for js/wasm
  32. GOOS=js GOARCH=wasm ./tool/go install ./cmd/tsconnect/wasm ./cmd/tailscale/cli
  33. buildplan9:
  34. GOOS=plan9 GOARCH=amd64 ./tool/go install ./cmd/tailscale ./cmd/tailscaled
  35. buildlinuxloong64: ## Build tailscale CLI for linux/loong64
  36. GOOS=linux GOARCH=loong64 ./tool/go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled
  37. buildmultiarchimage: ## Build (and optionally push) multiarch docker image
  38. ./build_docker.sh
  39. check: staticcheck vet depaware buildwindows build386 buildlinuxarm buildwasm ## Perform basic checks and compilation tests
  40. staticcheck: ## Run staticcheck.io checks
  41. ./tool/go run honnef.co/go/tools/cmd/staticcheck -- $$(./tool/go list ./... | grep -v tempfork)
  42. spk: ## Build synology package for ${SYNO_ARCH} architecture and ${SYNO_DSM} DSM version
  43. ./tool/go run ./cmd/dist build synology/dsm${SYNO_DSM}/${SYNO_ARCH}
  44. spkall: ## Build synology packages for all architectures and DSM versions
  45. ./tool/go run ./cmd/dist build synology
  46. pushspk: spk ## Push and install synology package on ${SYNO_HOST} host
  47. echo "Pushing SPK to root@${SYNO_HOST} (env var SYNO_HOST) ..."
  48. scp tailscale.spk root@${SYNO_HOST}:
  49. ssh root@${SYNO_HOST} /usr/syno/bin/synopkg install tailscale.spk
  50. publishdevimage: ## Build and publish tailscale image to location specified by ${REPO}
  51. @test -n "${REPO}" || (echo "REPO=... required; e.g. REPO=ghcr.io/${USER}/tailscale" && exit 1)
  52. @test "${REPO}" != "tailscale/tailscale" || (echo "REPO=... must not be tailscale/tailscale" && exit 1)
  53. @test "${REPO}" != "ghcr.io/tailscale/tailscale" || (echo "REPO=... must not be ghcr.io/tailscale/tailscale" && exit 1)
  54. @test "${REPO}" != "tailscale/k8s-operator" || (echo "REPO=... must not be tailscale/k8s-operator" && exit 1)
  55. @test "${REPO}" != "ghcr.io/tailscale/k8s-operator" || (echo "REPO=... must not be ghcr.io/tailscale/k8s-operator" && exit 1)
  56. TAGS="${TAGS}" REPOS=${REPO} PUSH=true TARGET=client ./build_docker.sh
  57. publishdevoperator: ## Build and publish k8s-operator image to location specified by ${REPO}
  58. @test -n "${REPO}" || (echo "REPO=... required; e.g. REPO=ghcr.io/${USER}/tailscale" && exit 1)
  59. @test "${REPO}" != "tailscale/tailscale" || (echo "REPO=... must not be tailscale/tailscale" && exit 1)
  60. @test "${REPO}" != "ghcr.io/tailscale/tailscale" || (echo "REPO=... must not be ghcr.io/tailscale/tailscale" && exit 1)
  61. @test "${REPO}" != "tailscale/k8s-operator" || (echo "REPO=... must not be tailscale/k8s-operator" && exit 1)
  62. @test "${REPO}" != "ghcr.io/tailscale/k8s-operator" || (echo "REPO=... must not be ghcr.io/tailscale/k8s-operator" && exit 1)
  63. TAGS="${TAGS}" REPOS=${REPO} PUSH=true TARGET=operator ./build_docker.sh
  64. help: ## Show this help
  65. @echo "\nSpecify a command. The choices are:\n"
  66. @grep -hE '^[0-9a-zA-Z_-]+:.*?## .*$$' ${MAKEFILE_LIST} | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0;36m%-20s\033[m %s\n", $$1, $$2}'
  67. @echo ""
  68. .PHONY: help
  69. .DEFAULT_GOAL := help