This repository has been archived by the owner on Nov 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
100 lines (80 loc) · 3.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
LDFLAGS+=-X github.com/pressly/warpdrive/warpdrive.VERSION=$$(git describe --tags --abbrev=0 --always)
LDFLAGS+=-X github.com/pressly/warpdrive/warpdrive.LONGVERSION=$$(git describe --tags --long --always --dirty)
# to create a root certificate. secret key must be kept secret and
# protected with strong password. Make sure to backup `ca-*.*` files.
#
# e.g. make create-root-certificate password=1234
create-root-certificate:
@certstrap --depot-path "cert" init --passphrase "$(password)" --common-name "ca-query" && \
certstrap --depot-path "cert" init --passphrase "$(password)" --common-name "ca-command";
# before you deploy the warpdrive, you have to call this to generate service certificates
create-service-certificates:
@certstrap --depot-path "cert" request-cert --passphrase "" --common-name "query" && \
certstrap --depot-path "cert" sign "query" --CA "ca-query" && \
certstrap --depot-path "cert" request-cert --passphrase "" --common-name "command" && \
certstrap --depot-path "cert" sign "command" --CA "ca-command";
create-cli-certificate:
@certstrap --depot-path "cert" request-cert --passphrase "" --common-name "cli" && \
certstrap --depot-path "cert" sign "cli" --CA "ca-command";
# follwing command will generate certificate for mobile which let's them connect to
# query service
create-device-certificate:
@certstrap --depot-path "cert" request-cert --passphrase "" --common-name "device" && \
certstrap --depot-path "cert" sign "device" --CA "ca-query";
# to compile the proto file to go code and then run
# go-inject to inject some code to work properly with storm package
compile-protobuf:
@protoc --go_out=plugins=grpc:. ./proto/*.proto; \
protoc-go-inject-tag -input=./proto/warpdrive.pb.go;
#
# Warpdrive Server
#
build-linux-server: compile-protobuf
@export GOGC=off; \
export GOOS=linux; \
export GOARCH=amd64; \
go build -ldflags "$(LDFLAGS)" \
-o ./bin/server/warpdrive-linux-server ./cmd/server;
build-windows-server: compile-protobuf
@export GOGC=off; \
export GOOS=windows; \
export GOARCH=amd64; \
go build -ldflags "$(LDFLAGS)" \
-o ./bin/server/warpdrive-windows-server ./cmd/server;
build-darwin-server: compile-protobuf
@export GOGC=off; \
export GOOS=darwin; \
export GOARCH=amd64; \
go build -ldflags "$(LDFLAGS)" \
-o ./bin/server/warpdrive-darwin-server ./cmd/server;
build-servers: build-linux-server build-windows-server build-darwin-server
#
# Docker
#
build-docker: build-linux-server
docker build -t warpdrive .
#
# Warpdrive cli (warp)
#
build-cli: compile-protobuf
@export GOGC=off; \
export GOOS=darwin; \
export GOARCH=amd64; \
go build -ldflags "$(LDFLAGS)" \
-o ./bin/cli/warp ./cmd/warp;
#
# Warpdrive clients
#
clean-ios:
@rm -rf ./client/ios/Warpdrive.framework; \
mkdir -p ./client/ios;
build-ios: clean-ios
@cd ./cmd/warpdrive && gomobile bind -target=ios -ldflags="-s -w" . && \
mv -f Warpdrive.framework ../../client/ios;
clean-android:
@rm -rf client/android/lib/warpdrive.aar
build-android: clean-android
@cd ./cmd/warpdrive && gomobile bind -target=android -ldflags="-s -w" . && \
mkdir -p ../../client/android/lib && \
mv -f warpdrive.aar ../../client/android/lib;
build-clients: build-ios build-android