Makefile 4.3 KB

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