Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Makefile 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
  2. IMAGE_NAME := mtg
  3. APP_NAME := $(IMAGE_NAME)
  4. CC_BINARIES := $(shell bash -c "echo -n $(APP_NAME)-{linux,freebsd,openbsd}-{386,amd64} $(APP_NAME)-linux-{arm,arm64}")
  5. GOLANGCI_LINT_VERSION := v1.21.0
  6. COMMON_BUILD_FLAGS := -ldflags="-s -w"
  7. MOD_ON := env GO111MODULE=on
  8. MOD_OFF := env GO111MODULE=auto
  9. # -----------------------------------------------------------------------------
  10. $(APP_NAME):
  11. @$(MOD_ON) go build $(COMMON_BUILD_FLAGS) -o "$(APP_NAME)"
  12. static-$(APP_NAME):
  13. @$(MOD_ON) env CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo $(COMMON_BUILD_FLAGS) -o "$(APP_NAME)"
  14. $(APP_NAME)-%: GOOS=$(shell echo -n "$@" | sed 's?$(APP_NAME)-??' | cut -f1 -d-)
  15. $(APP_NAME)-%: GOARCH=$(shell echo -n "$@" | sed 's?$(APP_NAME)-??' | cut -f2 -d-)
  16. $(APP_NAME)-%: ccbuilds
  17. @$(MOD_ON) env "GOOS=$(GOOS)" "GOARCH=$(GOARCH)" \
  18. go build \
  19. $(COMMON_BUILD_FLAGS) \
  20. -o "./ccbuilds/$(APP_NAME)-$(GOOS)-$(GOARCH)"
  21. ccbuilds:
  22. @rm -rf ./ccbuilds && mkdir -p ./ccbuilds
  23. vendor: go.mod go.sum
  24. @$(MOD_ON) go mod vendor
  25. # -----------------------------------------------------------------------------
  26. .PHONY: all
  27. all: $(APP_NAME)
  28. .PHONY: static
  29. static: static-$(APP_NAME)
  30. .PHONY: crosscompile
  31. crosscompile: $(CC_BINARIES)
  32. .PHONY: crosscompile-dir
  33. crosscompile-dir:
  34. @rm -rf "$(CC_DIR)" && mkdir -p "$(CC_DIR)"
  35. .PHONY: lint
  36. lint: vendor
  37. @$(MOD_OFF) golangci-lint run
  38. .PHONY: clean
  39. clean:
  40. @git clean -xfd && \
  41. git reset --hard >/dev/null && \
  42. git submodule foreach --recursive sh -c 'git clean -xfd && git reset --hard' >/dev/null
  43. .PHONY: docker
  44. docker:
  45. @docker build --pull -t "$(IMAGE_NAME)" "$(ROOT_DIR)"
  46. .PHONY: prepare
  47. prepare: install-lint
  48. .PHONY: install-lint
  49. install-lint:
  50. @curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh \
  51. | $(MOD_OFF) bash -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION)