mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-05 11:24:00 +00:00
162 lines
4 KiB
Makefile
162 lines
4 KiB
Makefile
NAME=Clash.Meta
|
|
BINDIR=bin
|
|
BRANCH=$(shell git branch --show-current)
|
|
ifeq ($(BRANCH),Alpha)
|
|
VERSION=alpha-$(shell git rev-parse --short HEAD)
|
|
else ifeq ($(BRANCH),Beta)
|
|
VERSION=beta-$(shell git rev-parse --short HEAD)
|
|
else ifeq ($(BRANCH),)
|
|
VERSION=$(shell git describe --tags)
|
|
else
|
|
VERSION=unknown
|
|
endif
|
|
|
|
BUILDTIME=$(shell date -u)
|
|
GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version=$(VERSION)" \
|
|
-X "github.com/Dreamacro/clash/constant.BuildTime=$(BUILDTIME)" \
|
|
-w -s -buildid='
|
|
|
|
PLATFORM_LIST = \
|
|
darwin-amd64v1 \
|
|
darwin-amd64v2 \
|
|
darwin-amd64v3 \
|
|
darwin-arm64 \
|
|
linux-amd64v1 \
|
|
linux-amd64v2 \
|
|
linux-amd64v3 \
|
|
linux-armv5 \
|
|
linux-armv6 \
|
|
linux-armv7 \
|
|
linux-arm64 \
|
|
linux-mips64 \
|
|
linux-mips64le \
|
|
linux-mips-softfloat \
|
|
linux-mips-hardfloat \
|
|
linux-mipsle-softfloat \
|
|
linux-mipsle-hardfloat \
|
|
android-arm64 \
|
|
freebsd-386 \
|
|
freebsd-amd64 \
|
|
freebsd-arm64
|
|
|
|
WINDOWS_ARCH_LIST = \
|
|
windows-386 \
|
|
windows-amd64v1 \
|
|
windows-amd64v2 \
|
|
windows-amd64v3 \
|
|
windows-arm64 \
|
|
windows-arm32v7
|
|
|
|
all:linux-amd64 linux-arm64\
|
|
darwin-amd64 darwin-arm64\
|
|
windows-amd64 windows-arm64\
|
|
|
|
docker:
|
|
GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
darwin-amd64v3:
|
|
GOARCH=amd64 GOOS=darwin GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
darwin-amd64v2:
|
|
GOARCH=amd64 GOOS=darwin GOAMD64=v2 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
darwin-amd64v1:
|
|
GOARCH=amd64 GOOS=darwin GOAMD64=v1 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
darwin-arm64:
|
|
GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-386:
|
|
GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-amd64v3:
|
|
GOARCH=amd64 GOOS=linux GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-amd64v2:
|
|
GOARCH=amd64 GOOS=linux GOAMD64=v2 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-amd64v1:
|
|
GOARCH=amd64 GOOS=linux GOAMD64=v1 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-arm64:
|
|
GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-armv5:
|
|
GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-armv6:
|
|
GOARCH=arm GOOS=linux GOARM=6 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-armv7:
|
|
GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-mips-softfloat:
|
|
GOARCH=mips GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-mips-hardfloat:
|
|
GOARCH=mips GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-mipsle-softfloat:
|
|
GOARCH=mipsle GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-mipsle-hardfloat:
|
|
GOARCH=mipsle GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-mips64:
|
|
GOARCH=mips64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
linux-mips64le:
|
|
GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
android-arm64:
|
|
GOARCH=arm64 GOOS=android $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
freebsd-386:
|
|
GOARCH=386 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
freebsd-amd64:
|
|
GOARCH=amd64 GOOS=freebsd GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
freebsd-arm64:
|
|
GOARCH=arm64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
windows-386:
|
|
GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
|
|
|
windows-amd64v3:
|
|
GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
|
|
|
windows-amd64v2:
|
|
GOARCH=amd64 GOOS=windows GOAMD64=v2 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
|
|
|
windows-amd64v1:
|
|
GOARCH=amd64 GOOS=windows GOAMD64=v1 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
|
|
|
windows-arm64:
|
|
GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
|
|
|
windows-arm32v7:
|
|
GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
|
|
|
gz_releases=$(addsuffix .gz, $(PLATFORM_LIST))
|
|
zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST))
|
|
|
|
$(gz_releases): %.gz : %
|
|
chmod +x $(BINDIR)/$(NAME)-$(basename $@)
|
|
gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@)
|
|
|
|
$(zip_releases): %.zip : %
|
|
zip -m -j $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@).exe
|
|
|
|
all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST)
|
|
|
|
releases: $(gz_releases) $(zip_releases)
|
|
|
|
vet:
|
|
go test ./...
|
|
|
|
lint:
|
|
golangci-lint run ./...
|
|
|
|
clean:
|
|
rm $(BINDIR)/*
|