Makefile 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. ./tool/go run ./cmd/dist build synology/dsm${SYNO_DSM}/${SYNO_ARCH}
  39. spkall: ## Build synology packages for all architectures and DSM versions
  40. ./tool/go run ./cmd/dist build synology
  41. pushspk: spk ## Push and install synology package on ${SYNO_HOST} host
  42. echo "Pushing SPK to root@${SYNO_HOST} (env var SYNO_HOST) ..."
  43. scp tailscale.spk root@${SYNO_HOST}:
  44. ssh root@${SYNO_HOST} /usr/syno/bin/synopkg install tailscale.spk
  45. publishdevimage: ## Build and publish tailscale image to location specified by ${REPO}
  46. @test -n "${REPO}" || (echo "REPO=... required; e.g. REPO=ghcr.io/${USER}/tailscale" && exit 1)
  47. @test "${REPO}" != "tailscale/tailscale" || (echo "REPO=... must not be tailscale/tailscale" && exit 1)
  48. @test "${REPO}" != "ghcr.io/tailscale/tailscale" || (echo "REPO=... must not be ghcr.io/tailscale/tailscale" && exit 1)
  49. @test "${REPO}" != "tailscale/k8s-operator" || (echo "REPO=... must not be tailscale/k8s-operator" && exit 1)
  50. @test "${REPO}" != "ghcr.io/tailscale/k8s-operator" || (echo "REPO=... must not be ghcr.io/tailscale/k8s-operator" && exit 1)
  51. TAGS=latest REPOS=${REPO} PUSH=true TARGET=client ./build_docker.sh
  52. publishdevoperator: ## Build and publish k8s-operator image to location specified by ${REPO}
  53. @test -n "${REPO}" || (echo "REPO=... required; e.g. REPO=ghcr.io/${USER}/tailscale" && exit 1)
  54. @test "${REPO}" != "tailscale/tailscale" || (echo "REPO=... must not be tailscale/tailscale" && exit 1)
  55. @test "${REPO}" != "ghcr.io/tailscale/tailscale" || (echo "REPO=... must not be ghcr.io/tailscale/tailscale" && exit 1)
  56. @test "${REPO}" != "tailscale/k8s-operator" || (echo "REPO=... must not be tailscale/k8s-operator" && exit 1)
  57. @test "${REPO}" != "ghcr.io/tailscale/k8s-operator" || (echo "REPO=... must not be ghcr.io/tailscale/k8s-operator" && exit 1)
  58. TAGS=latest REPOS=${REPO} PUSH=true TARGET=operator ./build_docker.sh
  59. help: ## Show this help
  60. @echo "\nSpecify a command. The choices are:\n"
  61. @grep -hE '^[0-9a-zA-Z_-]+:.*?## .*$$' ${MAKEFILE_LIST} | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0;36m%-20s\033[m %s\n", $$1, $$2}'
  62. @echo ""
  63. .PHONY: help
  64. .DEFAULT_GOAL := help