-
Notifications
You must be signed in to change notification settings - Fork 56
/
Makefile
133 lines (103 loc) · 3.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
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
include ./Makefile.defs
REGISTRY?=singchia
CC?=cc
all: frontier frontlas
# binary
.PHONY: frontier
frontier:
CC=${CC} CGO_ENABLED=1 go build -trimpath -ldflags "-s -w" -o ./bin/frontier cmd/frontier/main.go
.PHONY: frontier-linux
frontier-linux:
CC=${CC} GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -trimpath -ldflags "-s -w" -o ./bin/frontier cmd/frontier/main.go
.PHONY: frontlas
frontlas:
CC=${CC} CGO_ENABLED=1 go build -trimpath -ldflags "-s -w" -o ./bin/frontlas cmd/frontlas/main.go
.PHONY: frontlas-linux
frontlas-linux:
CC=${CC} GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -trimpath -ldflags "-s -w" -o ./bin/frontlas cmd/frontlas/main.go
# example
.PHONY: examples
examples:
make -C examples
mv examples/iclm/bin/* ./bin/ && rm -rf examples/iclm/bin
mv examples/chatroom/bin/* ./bin/ && rm -rf examples/chatroom/bin
mv examples/rtmp/bin/* ./bin/ && rm -rf examples/rtmp/bin
# clean
.PHONY: clean
clean:
rm ./bin/* || true
make clean -C examples
make clean -C test/bench
# install
.PHONY: install-frontier
install-frontier: frontier
install -m 0755 -d $(DESTDIR)$(BINDIR)
install -m 0755 -d $(DESTDIR)$(CONFDIR)
install -m 0755 ./bin/frontier $(DESTDIR)$(BINDIR)
install -m 0755 ./etc/frontier.yaml $(DESTDIR)$(CONFDIR)
.PHONY: install-frontlas
install-frontlas: frontlas
install -m 0755 -d $(DESTDIR)$(BINDIR)
install -m 0755 -d $(DESTDIR)$(CONFDIR)
install -m 0755 ./bin/frontlas $(DESTDIR)$(BINDIR)
install -m 0755 ./etc/frontlas.yaml $(DESTDIR)$(CONFDIR)
.PHONY: install-example-iclm
install-example-iclm: examples
install -m 0755 -d $(DESTDIR)$(BINDIR)
install -m 0755 ./bin/iclm_service $(DESTDIR)$(BINDIR)
install -m 0755 ./bin/iclm_edge $(DESTDIR)$(BINDIR)
# image
.PHONY: image-frontier
image-frontier:
docker buildx build -t ${REGISTRY}/frontier:${VERSION} -f images/Dockerfile.frontier .
.PHONY: image-frontlas
image-frontlas:
docker buildx build -t ${REGISTRY}/frontlas:${VERSION} -f images/Dockerfile.frontlas .
.PHONY: image-gen-api
image-gen-api:
docker buildx build -t image-gen-api:${VERSION} -f images/Dockerfile.controlplane-api .
.PHONY: image-gen-swagger
image-gen-swagger:
docker buildx build -t frontier-gen-swagger:${VERSION} -f images/Dockerfile.controlplane-swagger .
.PHONY: image-example-iclm
image-example-iclm:
docker buildx build -t ${REGISTRY}/iclm_service:${VERSION} -f images/Dockerfile.example_iclm_service .
# push
.PHONY: push
push: push-frontier push-frontlas
.PHONY: push-frontier
push-frontier:
docker push ${REGISTRY}/frontier:${VERSION}
.PHONY: push-frontlas
push-frontlas:
docker push ${REGISTRY}/frontlas:${VERSION}
.PHONY: push-example-iclm
push-example-iclm:
docker push ${REGISTRY}/iclm_service:${VERSION}
# container
.PHONY: container
container: container-frontier container-frontlas
.PHONY: container-frontier
container-frontier:
docker rm -f frontier
docker run -d --name frontier -p 30011:30011 -p 30012:30012 ${REGISTRY}/frontier:${VERSION} --config /usr/conf/frontier.yaml -v 1
.PHONY: container-frontlas
container-frontlas:
docker rm -f frontlas
docker run -d --name frontlas -p 40011:40011 -p 40012:40012 ${REGISTRY}/frontlas:${VERSION} --config /usr/conf/frontlas.yaml -v 1
# api
.PHONY: api-frontier
api-frontier:
docker run --rm -v ${PWD}/api/controlplane/frontier/v1:/api/controlplane/v1 image-gen-api:${VERSION}
.PHONY: api-frontlas
api-frontlas:
docker run --rm -v ${PWD}/api/controlplane/frontlas/v1:/api/controlplane/v1 image-gen-api:${VERSION}
# bench
.PHONY: bench
bench: container-frontier
make bench -C test/bench
.PHONY: swagger
swagger:
docker run --rm -v ${PWD}:/frontier frontier-gen-swagger:${VERSION}
.PHONY: output
output: build