forked from inconshreveable/ngrok
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (60 loc) · 2.46 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
.PHONY: default server client deps fmt clean all release-all assets client-assets server-assets contributors gencert
export GOPATH:=$(shell pwd)
export GO111MODULE=off
BUILDTAGS=debug
default: all
deps: assets
go get -tags '$(BUILDTAGS)' -d -v ngrok/...
server: deps
go install -tags '$(BUILDTAGS)' ngrok/main/ngrokd
fmt:
go fmt ngrok/...
client: deps
go install -tags '$(BUILDTAGS)' ngrok/main/ngrok
assets: client-assets server-assets
bin/cfssl:
ifeq ("$(wildcard bin/cfssl)","")
GOOS="" GOARCH="" go get github.com/cloudflare/cfssl/cmd/cfssl
endif
ifeq ("$(wildcard bin/cfssljson)","")
GOOS="" GOARCH="" go get github.com/cloudflare/cfssl/cmd/cfssljson
endif
gencert: bin/cfssl
ifeq ("$(wildcard assets/tls/ca.pem)","")
bin/cfssl gencert -initca assets/tls/ca-csr.json | bin/cfssljson -bare assets/tls/ca -
endif
ifeq ("$(wildcard assets/server/tls/server.pem)","")
mkdir -p assets/server/tls
bin/cfssl gencert -ca=assets/tls/ca.pem -ca-key=assets/tls/ca-key.pem -config=assets/tls/ca-config.json -profile=server assets/tls/server.json | bin/cfssljson -bare assets/server/tls/server
cp assets/tls/ca.pem assets/server/tls
endif
ifeq ("$(wildcard assets/client/tls/client.pem)","")
mkdir -p assets/client/tls
bin/cfssl gencert -ca=assets/tls/ca.pem -ca-key=assets/tls/ca-key.pem -config=assets/tls/ca-config.json -profile=client assets/tls/client.json | bin/cfssljson -bare assets/client/tls/client
cp assets/tls/ca.pem assets/client/tls
endif
bin/go-bindata:
GOOS="" GOARCH="" go get github.com/jteeuwen/go-bindata/go-bindata
client-assets: gencert bin/go-bindata
bin/go-bindata -nomemcopy -pkg=assets -tags=$(BUILDTAGS) \
-debug=$(if $(findstring debug,$(BUILDTAGS)),true,false) \
-o=src/ngrok/client/assets/assets_$(BUILDTAGS).go \
assets/client/...
server-assets: bin/go-bindata
bin/go-bindata -nomemcopy -pkg=assets -tags=$(BUILDTAGS) \
-debug=$(if $(findstring debug,$(BUILDTAGS)),true,false) \
-o=src/ngrok/server/assets/assets_$(BUILDTAGS).go \
assets/server/...
release-client: BUILDTAGS=release
release-client: client
release-server: BUILDTAGS=release
release-server: server
release-all: fmt release-client release-server
all: fmt client server
clean:
go clean -i -r ngrok/...
rm -rf src/ngrok/client/assets/ src/ngrok/server/assets/
rm -rf assets/tls/*.pem
contributors:
echo "Contributors to ngrok, both large and small:\n" > CONTRIBUTORS
git log --raw | grep "^Author: " | sort | uniq | cut -d ' ' -f2- | sed 's/^/- /' | cut -d '<' -f1 >> CONTRIBUTORS