forked from fossabot/clash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (73 loc) · 2.78 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
NAME=clash-core
BUILDDIR=build/releases
VERSION=$(shell git describe --tags || echo v0.0.0-test)
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='
LINUX_ARCH_LIST = \
linux-386 \
linux-amd64 \
linux-armv7 \
linux-arm64 \
linux-mips-softfloat \
linux-mips-hardfloat \
linux-mipsle-softfloat \
linux-mipsle-hardfloat \
linux-mips64 \
linux-mips64le \
linux-riscv64
WINDOWS_ARCH_LIST = \
windows-386 \
windows-amd64 \
windows-arm64 \
windows-armv7
all: linux-amd64 windows-amd64 # Most used
linux-386:
GOARCH=386 GOOS=linux $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
linux-amd64:
GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
linux-armv7:
GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
linux-arm64:
GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
linux-mips-softfloat:
GOARCH=mips GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
linux-mips-hardfloat:
GOARCH=mips GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
linux-mipsle-softfloat:
GOARCH=mipsle GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
linux-mipsle-hardfloat:
GOARCH=mipsle GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
linux-mips64:
GOARCH=mips64 GOOS=linux $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
linux-mips64le:
GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
linux-riscv64:
GOARCH=riscv64 GOOS=linux $(GOBUILD) -o $(BUILDDIR)/../$(NAME)-$@
windows-386:
GOARCH=386 GOOS=windows $(GOBUILD) -o $(BUILDDIR)/../$(NAME)[email protected]
windows-amd64:
GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BUILDDIR)/../$(NAME)[email protected]
windows-arm64:
GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BUILDDIR)/../$(NAME)[email protected]
windows-armv7:
GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BUILDDIR)/../$(NAME)[email protected]
linux_tar_releases=$(addsuffix .tar.gz, $(LINUX_ARCH_LIST))
$(linux_tar_releases): %.tar.gz : %
tar -c -z -f $(BUILDDIR)/$(NAME)-$(patsubst %.tar.gz,%,$@)-$(VERSION).tar.gz -C $(BUILDDIR)/../ $(NAME)-$(patsubst %.tar.gz,%,$@)
windows_cab_releases=$(addsuffix .cab, $(WINDOWS_ARCH_LIST))
$(windows_cab_releases): %.cab : %
makecab $(BUILDDIR)/../$(NAME)-$(basename $@).exe $(BUILDDIR)/$(NAME)-$(basename $@)-$(VERSION).cab
all-arch: $(LINUX_ARCH_LIST) $(WINDOWS_ARCH_LIST)
releases: $(linux_tar_releases) $(windows_cab_releases)
LINT_OS_LIST := windows linux
lint: $(foreach os,$(LINT_OS_LIST),$(os)-lint)
%-lint:
GOOS=$* golangci-lint run ./...
lint-fix: $(foreach os,$(LINT_OS_LIST),$(os)-lint-fix)
%-lint-fix:
GOOS=$* golangci-lint run --fix ./...
clean:
rm $(BUILDDIR)/*
rm $(BUILDDIR)/../*