-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile
131 lines (102 loc) · 3.8 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
.PHONY: all clean test lint build install
BIN = bin
# Default DESTDIR for installation uses fallback sequence, as documented by go install;
# This Make-escaped ($ replaced with $$) shell oneliner sources the
# environment as returned by go env, and uses the "Default Values" parameter
# expansion ${variable:-default} to implement the fallback sequence:
# $GOBIN, else $GOPATH/bin, else $HOME/go/bin
# If there are multiple entries in GOPATH, take the first.
DESTDIR = $(shell set -a; eval $$( go env ); gopath=$${GOPATH%:*}; echo $${GOBIN:-$${gopath:-$${HOME}/go}/bin})
# HINT: build with TAGS=norains to build without rains support
TAGS =
all: build lint
build: scion-bat \
scion-bwtestclient scion-bwtestserver \
scion-netcat \
scion-sensorfetcher scion-sensorserver \
scion-skip \
scion-ssh scion-sshd \
scion-webapp \
scion-web-gateway \
example-helloworld \
example-helloquic \
example-shttp-client example-shttp-server example-shttp-fileserver example-shttp-proxy \
example-sgrpc-server example-sgrpc-client
clean:
go clean ./...
cd _examples && go clean ./...
rm -f bin/*
test:
go test -tags=$(TAGS) ./...
cd _examples && go test -tags=$(TAGS) ./...
setup_lint:
@# Install golangci-lint (as dumb as this looks, this is the recommended way to install)
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ${DESTDIR} v1.57.1
lint:
@type golangci-lint > /dev/null || ( echo "golangci-lint not found. Install it manually or by running 'make setup_lint'."; exit 1 )
golangci-lint run --timeout=2m0s
cd _examples && golangci-lint run --timeout=2m0s
install: all
# Note: install everything but the examples
mkdir -p $(DESTDIR)
cp -t $(DESTDIR) $(BIN)/scion-*
integration: build
go test -tags=integration,$(TAGS) --count=1 ./...
cd _examples && go test -tags=integration,$(TAGS) --count=1 ./...
.PHONY: scion-bat
scion-bat:
go build -tags=$(TAGS) -o $(BIN)/$@ ./bat/
.PHONY: scion-bwtestclient
scion-bwtestclient:
go build -tags=$(TAGS) -o $(BIN)/$@ ./bwtester/bwtestclient/
.PHONY: scion-bwtestserver
scion-bwtestserver:
go build -tags=$(TAGS) -o $(BIN)/$@ ./bwtester/bwtestserver/
.PHONY: scion-netcat
scion-netcat:
go build -tags=$(TAGS) -o $(BIN)/$@ ./netcat/
.PHONY: scion-sensorfetcher
scion-sensorfetcher:
go build -tags=$(TAGS) -o $(BIN)/$@ ./sensorapp/sensorfetcher/
.PHONY: scion-sensorserver
scion-sensorserver:
go build -tags=$(TAGS) -o $(BIN)/$@ ./sensorapp/sensorserver/
.PHONY: scion-skip
scion-skip:
go build -tags=$(TAGS) -o $(BIN)/$@ ./skip/
.PHONY: scion-ssh
scion-ssh:
go build -tags=$(TAGS) -o $(BIN)/$@ ./ssh/client/
.PHONY: scion-sshd
scion-sshd:
go build -tags=$(TAGS) -o $(BIN)/$@ ./ssh/server/
.PHONY: scion-webapp
scion-webapp:
go build -tags=$(TAGS) -o $(BIN)/$@ ./webapp/
.PHONY: scion-web-gateway
scion-web-gateway:
go build -tags=$(TAGS) -o $(BIN)/$@ ./web-gateway/
.PHONY: example-helloworld
example-helloworld:
cd _examples && go build -tags=$(TAGS) -o ../$(BIN)/$@ ./helloworld/
.PHONY: example-helloquic
example-helloquic:
cd _examples && go build -tags=$(TAGS) -o ../$(BIN)/$@ ./helloquic/
.PHONY: example-shttp-client
example-shttp-client:
cd _examples && go build -tags=$(TAGS) -o ../$(BIN)/$@ ./shttp/client
.PHONY: example-shttp-server
example-shttp-server:
cd _examples && go build -tags=$(TAGS) -o ../$(BIN)/$@ ./shttp/server
.PHONY: example-shttp-fileserver
example-shttp-fileserver:
cd _examples && go build -tags=$(TAGS) -o ../$(BIN)/$@ ./shttp/fileserver
.PHONY: example-shttp-proxy
example-shttp-proxy:
cd _examples && go build -tags=$(TAGS) -o ../$(BIN)/$@ ./shttp/proxy
.PHONY: example-sgrpc-server
example-sgrpc-server:
cd _examples && go build -tags=$(TAGS) -o ../$(BIN)/$@ ./sgrpc/server
.PHONY: example-sgrpc-client
example-sgrpc-client:
cd _examples && go build -tags=$(TAGS) -o ../$(BIN)/$@ ./sgrpc/client