Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
xumng123 authored May 14, 2021
1 parent 2a470b0 commit 9c5f2d3
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@ GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/Dreamacro/clas
-X "github.com/Dreamacro/clash/constant.BuildTime=$(BUILDTIME)" \
-w -s -buildid='

PLATFORM_LIST = \
darwin-amd64 \
darwin-arm64 \
PLATFORM_LIST_32 = \
linux-386 \
linux-amd64 \
linux-armv5 \
linux-armv6 \
linux-armv7 \
linux-armv8 \
linux-mips-softfloat \
linux-mips-hardfloat \
linux-mipsle-softfloat \
linux-mipsle-hardfloat \
linux-mipsle-hardfloat

PLATFORM_LIST_64 = \
darwin-amd64 \
darwin-arm64 \
linux-amd64 \
linux-armv8 \
linux-mips64 \
linux-mips64le \
freebsd-386 \
freebsd-amd64 \
freebsd-arm64

freebsd-arm64 \
freebsd-386

WINDOWS_ARCH_LIST = \
windows-386 \
windows-amd64 \
Expand Down Expand Up @@ -95,19 +97,24 @@ windows-amd64:
windows-arm32v7:
GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe

gz_releases=$(addsuffix .gz, $(PLATFORM_LIST))
gz_releases_32=$(addsuffix .gz, $(PLATFORM_LIST_32))
gz_releases_64=$(addsuffix .gz, $(PLATFORM_LIST_64))
zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST))

$(gz_releases): %.gz : %
$(gz_releases_32): %.gz : %
chmod +x $(BINDIR)/$(NAME)-$(basename $@)
upx --best --lzma $(BINDIR)/$(NAME)-$(basename $@)
gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@)

$(gz_releases_64): %.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)
releases: $(gz_releases_32) $(gz_releases_64) $(zip_releases)
clean:
rm $(BINDIR)/*

0 comments on commit 9c5f2d3

Please sign in to comment.