This repository has been archived by the owner on May 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
80 lines (68 loc) · 5.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
GOCMD=GO111MODULE=on go
GOBUILD=$(GOCMD) build
GOTEST=$(GOCMD) test
all: setup build
setup:
rm -rdf ./dist/
mkdir -p ./dist/linux
mkdir -p ./dist/windows
mkdir -p ./dist/mac
mkdir -p ./dist/log
build-linux:
cp ./cmd/nats/comet/comet-config.toml ./dist/linux/comet-config.toml
cp ./cmd/nats/logic/logic-config.toml ./dist/linux/logic-config.toml
cp ./cmd/nats/job/job-config.toml ./dist/linux/job-config.toml
cp ./third-party/discoveryd/discoveryd-config.toml ./dist/linux/
${BUILD_ENV} GOARCH=amd64 GOOS=linux go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/linux/gnatsd ./third-party/gnatsd/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=linux go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/linux/discoveryd ./third-party/discoveryd/
${BUILD_ENV} GOARCH=amd64 GOOS=linux go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/linux/liftbridge ./third-party/liftbridge/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=linux go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/linux/comet ./cmd/nats/comet/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=linux go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/linux/logic ./cmd/nats/logic/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=linux go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/linux/job ./cmd/nats/job/main.go
build-win:
cp ./cmd/nats/comet/comet-config.toml ./dist/windows/comet-config.toml
cp ./cmd/nats/logic/logic-config.toml ./dist/windows/logic-config.toml
cp ./cmd/nats/job/job-config.toml ./dist/windows/job-config.toml
cp ./third-party/discoveryd/discoveryd-config.toml ./dist/windows/
${BUILD_ENV} GOARCH=amd64 GOOS=windows go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/windows/gnatsd ./third-party/gnatsd/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=windows go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/windows/discoveryd ./third-party/discoveryd/
${BUILD_ENV} GOARCH=amd64 GOOS=windows go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/windows/liftbridge ./third-party/liftbridge/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=windows go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/windows/comet.exe ./cmd/nats/comet/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=windows go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/windows/logic.exe ./cmd/nats/logic/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=windows go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/windows/job.exe ./cmd/nats/job/main.go
build-mac:
cp ./cmd/nats/comet/comet-config.toml ./dist/mac/comet-config.toml
cp ./cmd/nats/logic/logic-config.toml ./dist/mac/logic-config.toml
cp ./cmd/nats/job/job-config.toml ./dist/mac/job-config.toml
cp ./third-party/discoveryd/discoveryd-config.toml ./dist/mac/
${BUILD_ENV} GOARCH=amd64 GOOS=darwin go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/mac/gnatsd ./third-party/gnatsd/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=darwin go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/mac/discoveryd ./third-party/discoveryd/
${BUILD_ENV} GOARCH=amd64 GOOS=darwin go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/mac/liftbridge ./third-party/liftbridge/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=darwin go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/mac/comet ./cmd/nats/comet/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=darwin go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/mac/logic ./cmd/nats/logic/main.go
${BUILD_ENV} GOARCH=amd64 GOOS=darwin go build -gcflags=-trimpath=OPATH -asmflags=-trimpath=OPATH -a -tags netgo -ldflags "-w -s -extldflags '-static'" -o ./dist/mac/job ./cmd/nats/job/main.go
test:
$(GOTEST) -v ./...
clean:
rm -rf dist/
run-linux:
nohup ./dist/linux/gnatsd 2>&1 > dist/log/gnatsd.log &
nohup ./dist/linux/liftbridge --raft-bootstrap-seed 2>&1 > dist/log/liftbridge.log &
nohup ./dist/linux/discoveryd 2>&1 > dist/log/discoveryd.log &
nohup ./dist/linux/logic 2>&1 > dist/log/logic.log &
nohup ./dist/linux/comet 2>&1 > dist/log/comet.log &
nohup ./dist/linux/job 2>&1 > dist/log/job.log &
run-mac:
nohup ./dist/mac/gnatsd 2>&1 > dist/log/gnatsd.log &
nohup ./dist/mac/liftbridge --raft-bootstrap-seed 2>&1 > dist/log/liftbridge.log &
nohup ./dist/mac/discoveryd 2>&1 > dist/log/discoveryd.log &
nohup ./dist/mac/logic 2>&1 > dist/log/logic.log &
nohup ./dist/mac/comet 2>&1 > dist/log/comet.log &
nohup ./dist/mac/job 2>&1 > dist/log/job.log &
stop:
pkill -f ./dist/linux/gnatsd
pkill -f ./dist/linux/liftbridge
pkill -f ./dist/linux/discoveryd
pkill -f ./dist/linux/logic
pkill -f ./dist/linux/job
pkill -f ./dist/linux/comet