-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
79 lines (57 loc) · 1.93 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
SERVER_NAME = wormholed
CLI_NAME = wormhole
SHARED = \
client \
utils
CLI = \
cli \
main/$(CLI_NAME)
SERVER = \
pkg/netaddr \
pkg/proxy \
server \
main/$(SERVER_NAME)
COMBINED := $(SHARED) $(CLI) $(SERVER)
SHARED_DEPS = \
github.com/raff/tls-ext \
github.com/raff/tls-psk
# kubernetes/pkg/api is needed for pkg/proxy
# the other dependencies besides netns and netlink are for kubernetes
SERVER_DEPS = \
github.com/GoogleCloudPlatform/kubernetes/pkg/api \
github.com/fsouza/go-dockerclient \
github.com/golang/glog \
code.google.com/p/go.net/context \
gopkg.in/v1/yaml \
github.com/vishvananda/netns \
github.com/vishvananda/netlink
CLI_DEPS =
TEST_DEPS =
COMBINED_DEPS := $(SHARED_DEPS) $(CLI_DEPS) $(SERVER_DEPS) $(TEST_DEPS)
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
gofiles = $(foreach d,$(1),$(wildcard $(d)/*.go))
testdirs = $(call uniq,$(foreach d,$(1),$(dir $(wildcard $(d)/*_test.go))))
goroot = $(addprefix ../../../,$(1))
unroot = $(subst ../../../,,$(1))
all: $(SERVER_NAME) $(CLI_NAME)
$(call goroot,$(COMBINED_DEPS)):
go get $(call unroot,$@)
$(SERVER_NAME): $(call goroot,$(SHARED_DEPS)) $(call goroot,$(SERVER_DEPS)) $(call gofiles,$(SERVER)) $(call gofiles,$(SHARED))
go build github.com/vishvananda/wormhole/main/wormholed
$(CLI_NAME): $(call goroot,$(SHARED_DEPS)) $(call goroot,$(CLI_DEPS)) $(call gofiles,$(CLI)) $(call gofiles,$(SHARED))
go build github.com/vishvananda/wormhole/main/wormhole
.PHONY: $(call testdirs,$(COMBINED))
$(call testdirs,$(COMBINED)): $(call goroot,$(TEST_DEPS))
sudo -E go test -v github.com/vishvananda/wormhole/$@
fmt:
for dir in . $(COMBINED); do go fmt github.com/vishvananda/wormhole/$$dir; done
test: test-unit test-functional
test-unit: $(call testdirs,$(COMBINED))
.PHONY: pong
pong:
$(MAKE) -C pong all
test-functional: $(SERVER_NAME) $(CLI_NAME) pong
sudo -E go test -v functional_test.go
.PHONY: clean
clean:
-rm wormhole wormholed