forked from strukturag/nextcloud-spreed-signaling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (90 loc) · 2.6 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
all: build
GO := $(shell which go)
GOPATH := "$(CURDIR)/vendor:$(CURDIR)"
GOOS ?= linux
GOARCH ?= amd64
BINDIR := "$(CURDIR)/bin"
VERSION := $(shell "$(CURDIR)/scripts/get-version.sh")
TARVERSION := $(shell "$(CURDIR)/scripts/get-version.sh" --tar)
ifneq ($(VERSION),)
INTERNALLDFLAGS := -X main.version=$(VERSION)
else
INTERNALLDFLAGS :=
endif
ifneq ($(RACE),)
BUILDARGS := -race
else
BUILDARGS :=
endif
ifneq ($(CI),)
TESTARGS := -race
else
TESTARGS :=
endif
ifeq ($(TIMEOUT),)
TIMEOUT := 60s
endif
ifneq ($(TEST),)
TESTARGS := $(TESTARGS) -run $(TEST)
endif
ifneq ($(COUNT),)
TESTARGS := $(TESTARGS) -count $(COUNT)
endif
hook:
[ ! -d "$(CURDIR)/.git/hooks" ] || ln -sf "$(CURDIR)/scripts/pre-commit.hook" "$(CURDIR)/.git/hooks/pre-commit"
easyjson:
GOPATH=$(GOPATH) $(GO) get -u github.com/mailru/easyjson/...
continentmap.go:
$(CURDIR)/scripts/get_continent_map.py $@
check-continentmap:
set -e ;\
TMP=$$(mktemp -d) ;\
echo Make sure to remove $$TMP on error ;\
$(CURDIR)/scripts/get_continent_map.py $$TMP/continentmap.go ;\
diff -u continentmap.go $$TMP/continentmap.go ;\
rm -rf $$TMP
get:
GOPATH=$(GOPATH) $(GO) get $(PACKAGE)
fmt: hook
$(GO) fmt .
vet: common
$(GO) vet .
test: vet common
$(GO) test -v -timeout $(TIMEOUT) $(TESTARGS) .
cover: vet common
rm -f cover.out && \
GOPATH=$(GOPATH) $(GO) test -v -timeout $(TIMEOUT) -coverprofile cover.out . && \
sed -i "/_easyjson/d" cover.out && \
GOPATH=$(GOPATH) $(GO) tool cover -func=cover.out
coverhtml: vet common
rm -f cover.out && \
GOPATH=$(GOPATH) $(GO) test -v -timeout $(TIMEOUT) -coverprofile cover.out . && \
sed -i "/_easyjson/d" cover.out && \
GOPATH=$(GOPATH) $(GO) tool cover -html=cover.out -o coverage.html
%_easyjson.go: %.go easyjson
PATH=$(shell dirname $(GO)):$(PATH) GOPATH=$(GOPATH) ./vendor/bin/easyjson -all $*.go
common: \
api_signaling_easyjson.go \
api_backend_easyjson.go \
api_proxy_easyjson.go \
natsclient_easyjson.go \
room_easyjson.go
$(BINDIR):
mkdir -p $(BINDIR)
client: common $(BINDIR)
GOPATH=$(GOPATH) $(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/client ./client/...
server: common $(BINDIR)
GOPATH=$(GOPATH) $(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/signaling ./server/...
proxy: common $(BINDIR)
GOPATH=$(GOPATH) $(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/proxy ./proxy/...
clean:
rm -f *_easyjson.go
build: server proxy
tarball:
git archive \
--prefix=nextcloud-spreed-signaling-$(TARVERSION)/ \
-o nextcloud-spreed-signaling-$(TARVERSION).tar.gz \
HEAD
dist: tarball
.NOTPARALLEL: %_easyjson.go
.PHONY: continentmap.go