forked from rusq/slackdump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (41 loc) · 1.21 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
SHELL=/bin/sh
CMD=./cmd/slackdump
OUTPUT=slackdump
EXECUTABLE=slackdump
BUILD=$(shell git describe --tags)
BUILD_YEAR=$(shell date +%Y)
PKG=github.com/rusq/slackdump/v2
LDFLAGS="-s -w -X 'main.build=$(BUILD)' -X 'main.buildYear=$(BUILD_YEAR)'"
OSES=linux darwin windows
DISTFILES=README.rst LICENSE
ZIPFILES=$(foreach s,$(OSES),$(OUTPUT)-$s.zip)
.PHONY: dist all test
# special guest.
$(OUTPUT)-windows.zip: EXECUTABLE=$(OUTPUT).exe
$(foreach s,$(OSES),$(eval $(OUTPUT)-$s.zip: GOOS=$s))
$(foreach s,$(OSES),$(eval $(OUTPUT)-$s.zip: $(EXECUTABLE)))
all: $(EXECUTABLE)
dist:
$(MAKE) $(ZIPFILES)
%.zip:
7z a $@ $(EXECUTABLE) $(DISTFILES)
rm $(EXECUTABLE)
$(OUTPUT).exe: GOOS=windows
$(OUTPUT).exe: $(OUTPUT)
$(OUTPUT):
GOARCH=$(GOARCH) GOOS=$(GOOS) go build -ldflags=$(LDFLAGS) -o $(EXECUTABLE) $(CMD)
x86_%:
GOARCH=amd64 go build -ldflags=$(LDFLAGS) -o $@ $(CMD)
arm_%:
GOARCH=arm64 go build -ldflags=$(LDFLAGS) -o $@ $(CMD)
clean:
-rm slackdump slackdump.exe $(wildcard *.zip)
test:
go test -race -cover -count=3 ./...
docker_test:
docker build .
man: slackdump.1
slackdump.1: README.rst
rst2man.py $< $@ --syntax-highlight=none
callvis:
go-callvis -group pkg,type -limit $(PKG) $(PKG)/cmd/slackdump