mihomo/Makefile

151 lines
3.9 KiB
Makefile
Raw Normal View History

2021-12-03 20:38:40 +08:00
NAME=Clash.Meta
BINDIR=bin
2022-01-25 21:47:11 +08:00
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
VERSION=$(shell git describe --tags || echo "unknown version" )
2022-02-06 05:08:11 +08:00
ifeq ($(BRANCH),Alpha)
VERSION=alpha-$(shell git rev-parse --short HEAD)
2022-01-25 21:47:11 +08:00
endif
2019-03-23 19:24:26 +08:00
BUILDTIME=$(shell date -u)
2021-12-03 22:13:05 +08:00
GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version=$(VERSION)" \
-X "github.com/Dreamacro/clash/constant.BuildTime=$(BUILDTIME)" \
2021-12-03 20:38:40 +08:00
-w -s -buildid='
2018-06-17 08:18:39 +08:00
2019-01-03 10:49:09 +08:00
PLATFORM_LIST = \
darwin-amd64 \
darwin-arm64 \
2021-12-03 20:38:40 +08:00
linux-amd64 \
linux-armv5 \
linux-armv6 \
linux-armv7 \
linux-armv8 \
linux-mips64 \
linux-mips64le \
linux-mips-softfloat \
linux-mips-hardfloat \
linux-mipsle-softfloat \
linux-mipsle-hardfloat \
2022-02-21 18:04:38 +08:00
android-armv8 \
freebsd-386 \
freebsd-amd64 \
freebsd-arm64
2021-12-04 19:59:41 +08:00
2018-06-17 08:18:39 +08:00
2019-01-03 10:49:09 +08:00
WINDOWS_ARCH_LIST = \
2021-12-03 20:38:40 +08:00
windows-386 \
windows-amd64 \
windows-arm64 \
windows-arm32v7
2021-12-04 19:59:41 +08:00
2019-01-03 10:49:09 +08:00
2022-03-16 00:43:08 +08:00
all:linux-amd64\
linux-armv7\
darwin-amd64 darwin-arm64\
windows-amd64 windows-386 \
linux-mips-hardfloat linux-mips-softfloat linux-mips64 linux-mips64le linux-mipsle-hardfloat linux-mipsle-softfloat# Most used
2018-06-17 08:18:39 +08:00
2021-12-03 20:38:40 +08:00
docker:
$(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2020-06-21 12:38:14 +08:00
2019-01-03 10:49:09 +08:00
darwin-amd64:
2021-12-03 20:38:40 +08:00
GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2018-06-17 08:18:39 +08:00
darwin-arm64:
2021-12-03 20:38:40 +08:00
GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2019-01-03 10:49:09 +08:00
linux-386:
2021-12-03 20:38:40 +08:00
GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2019-01-03 10:49:09 +08:00
linux-amd64:
2021-12-03 20:38:40 +08:00
GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2019-01-03 10:49:09 +08:00
2021-12-04 19:59:41 +08:00
linux-amd64-AutoIptables:
2021-12-04 17:41:13 +08:00
GOARCH=amd64 GOOS=linux $(GOBUILDOP) -o $(BINDIR)/$(NAME)-$@
2021-12-04 14:34:01 +08:00
linux-arm64:
GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2021-12-04 19:59:41 +08:00
linux-arm64-AutoIptables:
2021-12-04 17:41:13 +08:00
GOARCH=arm64 GOOS=linux $(GOBUILDOP) -o $(BINDIR)/$(NAME)-$@
2021-12-03 20:38:40 +08:00
linux-armv5:
GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2021-12-04 21:43:33 +08:00
linux-armv5-AutoIptables:
2021-12-04 17:41:13 +08:00
GOARCH=arm GOOS=linux GOARM=5 $(GOBUILDOP) -o $(BINDIR)/$(NAME)-$@
2021-12-03 20:38:40 +08:00
linux-armv6:
GOARCH=arm GOOS=linux GOARM=6 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2021-12-04 21:43:33 +08:00
linux-armv6-AutoIptables:
2021-12-04 17:41:13 +08:00
GOARCH=arm GOOS=linux GOARM=6 $(GOBUILDOP) -o $(BINDIR)/$(NAME)-$@
2021-12-03 20:38:40 +08:00
linux-armv7:
GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2021-12-04 21:43:33 +08:00
linux-armv7-AutoIptables:
2021-12-04 17:41:13 +08:00
GOARCH=arm GOOS=linux GOARM=7 $(GOBUILDOP) -o $(BINDIR)/$(NAME)-$@
2021-12-03 20:38:40 +08:00
linux-armv8:
GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2021-12-04 21:43:33 +08:00
linux-armv8-AutoIptables:
2021-12-04 17:41:13 +08:00
GOARCH=arm64 GOOS=linux $(GOBUILDOP) -o $(BINDIR)/$(NAME)-$@
2021-12-03 20:38:40 +08:00
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)-$@
2022-02-21 18:04:38 +08:00
android-armv8:
GOARCH=arm64 GOOS=android $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2021-12-03 20:38:40 +08:00
freebsd-386:
GOARCH=386 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
freebsd-amd64:
GOARCH=amd64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
freebsd-arm64:
GOARCH=arm64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
2019-01-03 10:49:09 +08:00
windows-386:
2021-12-03 20:38:40 +08:00
GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
2018-06-20 23:00:16 +08:00
2019-01-03 10:49:09 +08:00
windows-amd64:
2021-12-03 20:38:40 +08:00
GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
2021-12-04 17:41:13 +08:00
windows-arm64:
GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
2021-12-03 20:38:40 +08:00
windows-arm32v7:
GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
2019-01-03 10:49:09 +08: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 15:34:24 +08:00
gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@)
2019-01-03 10:49:09 +08:00
$(zip_releases): %.zip : %
2019-03-23 19:24:26 +08:00
zip -m -j $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@).exe
2019-01-03 10:49:09 +08:00
all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST)
2018-06-17 08:18:39 +08:00
2019-01-03 10:49:09 +08:00
releases: $(gz_releases) $(zip_releases)
2018-06-17 08:18:39 +08:00
clean:
2022-02-21 18:04:38 +08:00
rm $(BINDIR)/*