-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
65 lines (49 loc) · 1.38 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
PROJNAME = smfix
ifeq "$(GITHUB_REF_NAME)" ""
VERSION := -X 'main.Version=$(shell git rev-parse --short HEAD)'
else
VERSION := -X 'main.Version=$(GITHUB_REF_NAME)'
endif
FLAGS = -ldflags="-w -s $(VERSION)"
CMD = go build -trimpath $(FLAGS)
DIST = dist/
darwin-arm64:
GOOS=darwin GOARCH=arm64 \
$(CMD) -o $(DIST)$(PROJNAME)-$@
darwin-amd64:
GOOS=darwin GOARCH=amd64 \
$(CMD) -o $(DIST)$(PROJNAME)-$@
linux-amd64:
GOOS=linux GOARCH=amd64 \
$(CMD) -o $(DIST)$(PROJNAME)-$@
linux-arm7:
GOOS=linux GOARCH=arm GOARM=7 \
$(CMD) -o $(DIST)$(PROJNAME)-$@
linux-arm6:
GOOS=linux GOARCH=arm GOARM=6 \
$(CMD) -o $(DIST)$(PROJNAME)-$@
win64:
GOOS=windows GOARCH=amd64 \
$(CMD) -o $(DIST)$(PROJNAME)[email protected]
win32:
GOOS=windows GOARCH=386 \
$(CMD) -o $(DIST)$(PROJNAME)[email protected]
dep: # Get the dependencies
go mod download
all: dep darwin-arm64 darwin-amd64 linux-amd64 linux-arm7 linux-arm6 win64 win32
@true
all-zip: all
for p in darwin-arm64 darwin-amd64 linux-amd64 linux-arm7 linux-arm6 win64 win32; do \
zip -j $(DIST)$(PROJNAME)-$$p.zip $(DIST)$(PROJNAME)-$$p* README.md LICENSE; \
done
clean:
rm -f $(DIST)$(PROJNAME)-*
test:
go test ./fix/...
pprof:
GOOS=darwin GOARCH=arm64 \
$(CMD) -tags pprof -o $(DIST)$(PROJNAME)-pprof
benchmark:
go test -bench=. -memprofile=dist/bench_mem.pprof ./fix/...
pprof-http-mem:
go tool pprof -http=:8080 $(DIST)mem.pprof