-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
254 lines (189 loc) · 6.95 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
NAME=connect_jxyy_network
BINDIR=bin
VERSION=$(shell git describe --tags || echo "unknown version")
BUILDTIME=$(shell date -u)
GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/wochaoop/connect_jxyy_network/constant.Version=$(VERSION)" \
-X "github.com/wochaoop/connect_jxyy_network/constant.BuildTime=$(BUILDTIME)" \
-w -s -buildid='
PLATFORM_LIST = \
aix-ppc64 \
android-arm64 \
darwin-amd64 \
darwin-arm64 \
dragonfly-amd64 \
freebsd-386 \
freebsd-amd64 \
freebsd-arm \
freebsd-arm64 \
freebsd-riscv64 \
illumos-amd64 \
ios-amd64 \
ios-arm64 \
linux-386 \
linux-amd64 \
linux-arm-v5 \
linux-arm-v6 \
linux-arm-v7 \
linux-arm64 \
linux-loong64 \
linux-mips \
linux-mips64 \
linux-mips64le \
linux-mipsle \
linux-ppc64 \
linux-ppc64le \
linux-riscv64 \
linux-s390x \
netbsd-386 \
netbsd-amd64 \
netbsd-arm \
netbsd-arm64 \
openbsd-386 \
openbsd-amd64 \
openbsd-arm \
openbsd-arm64 \
openbsd-ppc64 \
plan9-386 \
plan9-amd64 \
plan9-arm \
solaris-amd64
WINDOWS_ARCH_LIST = \
windows-386 \
windows-amd64 \
windows-amd64-v3 \
windows-arm64 \
windows-armv7
WASM_LIST = \
js-wasm \
wasip1-wasm
all: linux-amd64 darwin-amd64 windows-amd64 # Most used
aix-ppc64:
GOARCH=ppc64 GOOS=aix $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
android-386:
GOARCH=386 GOOS=android $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
android-amd64:
android-arm:
GOARCH=arm GOOS=android $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
android-arm64:
GOARCH=arm64 GOOS=android $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
darwin-amd64:
GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
darwin-arm64:
GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
dragonfly-amd64:
GOARCH=amd64 GOOS=dragonfly $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
freebsd-386:
GOARCH=386 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
freebsd-amd64:
GOARCH=amd64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
freebsd-arm:
GOARCH=arm GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
freebsd-arm64:
GOARCH=arm64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
freebsd-riscv64:
GOARCH=riscv64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
illumos-amd64:
GOARCH=amd64 GOOS=illumos $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
ios-amd64:
GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
ios-arm64:
GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
js-wasm:
GOARCH=wasm GOOS=js $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME).wasm
linux-386:
GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-amd64:
GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-arm-v5:
GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-arm-v6:
GOARCH=arm GOOS=linux GOARM=6 $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-arm-v7:
GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-arm64:
GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-loong64:
GOARCH=loong64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-mips:
GOARCH=mips GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-mips64:
GOARCH=mips64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-mips64le:
GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-mipsle:
GOARCH=mipsle GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-ppc64:
GOARCH=ppc64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-ppc64le:
GOARCH=ppc64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-riscv64:
GOARCH=riscv64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
linux-s390x:
GOARCH=s390x GOOS=linux $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
netbsd-386:
GOARCH=386 GOOS=netbsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
netbsd-amd64:
GOARCH=amd64 GOOS=netbsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
netbsd-arm:
GOARCH=arm GOOS=netbsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
netbsd-arm64:
GOARCH=arm64 GOOS=netbsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
openbsd-386:
GOARCH=386 GOOS=openbsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
openbsd-amd64:
GOARCH=amd64 GOOS=openbsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
openbsd-arm:
GOARCH=arm GOOS=openbsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
openbsd-arm64:
GOARCH=arm64 GOOS=openbsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
openbsd-ppc64:
GOARCH=ppc64 GOOS=openbsd $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
plan9-386:
GOARCH=386 GOOS=plan9 $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
plan9-amd64:
GOARCH=amd64 GOOS=plan9 $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
plan9-arm:
GOARCH=arm GOOS=plan9 $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
solaris-amd64:
GOARCH=amd64 GOOS=solaris $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME)
wasip1-wasm:
GOARCH=wasm GOOS=js $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME).wasm
windows-386:
GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME).exe
windows-amd64:
GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME).exe
windows-amd64-v3:
GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME).exe
windows-arm64:
GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME).exe
windows-armv7:
GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BINDIR)/$(basename $@)/$(NAME).exe
gz_releases=$(addsuffix .gz, $(PLATFORM_LIST))
zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST))
wasm_releases=$(addsuffix .wasm, $(WASM_LIST))
$(gz_releases): %.gz : %
-upx -9 $(BINDIR)/$(basename $@)/$(NAME)
chmod +x $(BINDIR)/$(basename $@)/$(NAME)
gzip -f -S -$(VERSION).gz $(BINDIR)/$(basename $@)/$(NAME)
mv $(BINDIR)/$(basename $@)/$(NAME)-$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).gz
rm -r $(BINDIR)/$(basename $@)
$(zip_releases): %.zip : %
-upx -9 $(BINDIR)/$(basename $@)/$(NAME).exe
zip -m -j $(BINDIR)/$(basename $@)/$(NAME)-$(VERSION).zip $(BINDIR)/$(basename $@)/$(NAME).exe
mv $(BINDIR)/$(basename $@)/$(NAME)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip
rm -r $(BINDIR)/$(basename $@)
$(wasm_releases): %.wasm : %
-upx -9 $(BINDIR)/$(basename $@)/$(NAME).wasm
mv $(BINDIR)/$(basename $@)/$(NAME).wasm $(BINDIR)/$(NAME)-$(basename $@).wasm
rm -r $(BINDIR)/$(basename $@)
all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST) $(WASM_LIST)
releases: $(gz_releases) $(zip_releases) $(wasm_releases)
LINT_OS_LIST := darwin windows linux freebsd openbsd
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 $(BINDIR)/*