Makefile 4.2 KB

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