2018-06-17 00:18:39 +00:00
|
|
|
NAME=clash
|
|
|
|
BINDIR=bin
|
2021-07-01 14:49:29 +00:00
|
|
|
VERSION=$(shell git describe --tags --always 2>/dev/null || date +%F)
|
2019-03-23 11:24:26 +00:00
|
|
|
BUILDTIME=$(shell date -u)
|
2020-05-20 07:13:33 +00:00
|
|
|
GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version=$(VERSION)" \
|
2019-03-23 11:24:26 +00:00
|
|
|
-X "github.com/Dreamacro/clash/constant.BuildTime=$(BUILDTIME)" \
|
2020-10-08 09:54:38 +00:00
|
|
|
-w -s -buildid='
|
2018-06-17 00:18:39 +00:00
|
|
|
|
2019-01-03 02:49:09 +00:00
|
|
|
PLATFORM_LIST = \
|
|
|
|
darwin-amd64 \
|
2021-02-18 10:15:09 +00:00
|
|
|
darwin-arm64 \
|
2019-01-03 02:49:09 +00:00
|
|
|
linux-386 \
|
|
|
|
linux-amd64 \
|
|
|
|
linux-armv5 \
|
|
|
|
linux-armv6 \
|
|
|
|
linux-armv7 \
|
|
|
|
linux-armv8 \
|
|
|
|
linux-mips-softfloat \
|
|
|
|
linux-mips-hardfloat \
|
2019-07-26 10:45:50 +00:00
|
|
|
linux-mipsle-softfloat \
|
|
|
|
linux-mipsle-hardfloat \
|
2019-01-03 02:49:09 +00:00
|
|
|
linux-mips64 \
|
|
|
|
linux-mips64le \
|
|
|
|
freebsd-386 \
|
2021-04-26 12:42:17 +00:00
|
|
|
freebsd-amd64 \
|
|
|
|
freebsd-arm64
|
2018-06-17 00:18:39 +00:00
|
|
|
|
2019-01-03 02:49:09 +00:00
|
|
|
WINDOWS_ARCH_LIST = \
|
|
|
|
windows-386 \
|
2020-08-16 05:50:56 +00:00
|
|
|
windows-amd64 \
|
2021-08-18 05:26:23 +00:00
|
|
|
windows-arm64 \
|
2020-08-16 05:50:56 +00:00
|
|
|
windows-arm32v7
|
2019-01-03 02:49:09 +00:00
|
|
|
|
|
|
|
all: linux-amd64 darwin-amd64 windows-amd64 # Most used
|
2018-06-17 00:18:39 +00:00
|
|
|
|
2020-06-21 04:38:14 +00:00
|
|
|
docker:
|
|
|
|
$(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
|
2019-01-03 02:49:09 +00:00
|
|
|
darwin-amd64:
|
2018-06-17 00:18:39 +00:00
|
|
|
GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
|
2021-02-18 10:15:09 +00:00
|
|
|
darwin-arm64:
|
|
|
|
GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
|
2019-01-03 02:49:09 +00:00
|
|
|
linux-386:
|
|
|
|
GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
|
|
|
|
linux-amd64:
|
|
|
|
GOARCH=amd64 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-armv8:
|
|
|
|
GOARCH=arm64 GOOS=linux $(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)-$@
|
|
|
|
|
2019-07-26 10:45:50 +00:00
|
|
|
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)-$@
|
2019-01-03 02:49:09 +00:00
|
|
|
|
|
|
|
linux-mips64:
|
|
|
|
GOARCH=mips64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
|
|
|
|
linux-mips64le:
|
|
|
|
GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
|
|
|
|
freebsd-386:
|
|
|
|
GOARCH=386 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
|
|
|
|
freebsd-amd64:
|
2018-12-31 12:57:21 +00:00
|
|
|
GOARCH=amd64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
|
2021-04-22 08:38:13 +00:00
|
|
|
freebsd-arm64:
|
|
|
|
GOARCH=arm64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
|
|
|
|
|
2019-01-03 02:49:09 +00:00
|
|
|
windows-386:
|
2019-02-15 15:43:28 +00:00
|
|
|
GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
2018-06-20 15:00:16 +00:00
|
|
|
|
2019-01-03 02:49:09 +00:00
|
|
|
windows-amd64:
|
|
|
|
GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
2021-07-01 14:49:29 +00:00
|
|
|
|
2021-08-18 05:26:23 +00:00
|
|
|
windows-arm64:
|
|
|
|
GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
|
|
|
|
2020-08-16 05:50:56 +00:00
|
|
|
windows-arm32v7:
|
|
|
|
GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
|
2019-01-03 02:49:09 +00:00
|
|
|
|
|
|
|
gz_releases=$(addsuffix .gz, $(PLATFORM_LIST))
|
|
|
|
zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST))
|
|
|
|
|
|
|
|
$(gz_releases): %.gz : %
|
|
|
|
chmod +x $(BINDIR)/$(NAME)-$(basename $@)
|
2019-03-30 07:34:24 +00:00
|
|
|
gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@)
|
2019-01-03 02:49:09 +00:00
|
|
|
|
|
|
|
$(zip_releases): %.zip : %
|
2019-03-23 11:24:26 +00:00
|
|
|
zip -m -j $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@).exe
|
2019-01-03 02:49:09 +00:00
|
|
|
|
|
|
|
all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST)
|
2018-06-17 00:18:39 +00:00
|
|
|
|
2019-01-03 02:49:09 +00:00
|
|
|
releases: $(gz_releases) $(zip_releases)
|
2021-10-10 15:44:09 +00:00
|
|
|
|
2021-10-28 03:36:11 +00:00
|
|
|
vet:
|
|
|
|
go vet ./...
|
|
|
|
|
2021-10-10 15:44:09 +00:00
|
|
|
lint:
|
2022-02-18 16:08:51 +00:00
|
|
|
golangci-lint run ./...
|
2021-10-10 15:44:09 +00:00
|
|
|
|
2018-06-17 00:18:39 +00:00
|
|
|
clean:
|
2021-10-28 03:36:11 +00:00
|
|
|
rm -rf $(BINDIR)/*
|