This repository has been archived by the owner on Feb 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
58 lines (47 loc) · 2.08 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
all: build
backend:
go build -o out/bofied-backend/bofied-backend cmd/bofied-backend/main.go
frontend:
rm -f web/app.wasm
GOOS=js GOARCH=wasm go build -o web/app.wasm cmd/bofied-frontend/main.go
go build -o /tmp/bofied-frontend-build cmd/bofied-frontend/main.go
rm -rf out/bofied-frontend
/tmp/bofied-frontend-build -build
cp -r web/* out/bofied-frontend/web
build: backend frontend
release-backend:
CGO_ENABLED=0 go build -ldflags="-extldflags=-static" -tags netgo -o out/release/bofied-backend/bofied-backend.linux-$$(uname -m) cmd/bofied-backend/main.go
release-frontend: frontend
rm -rf out/release/bofied-frontend
mkdir -p out/release/bofied-frontend
cd out/bofied-frontend && tar -czvf ../release/bofied-frontend/bofied-frontend.tar.gz .
release-frontend-github-pages: frontend
rm -rf out/release/bofied-frontend-github-pages
mkdir -p out/release/bofied-frontend-github-pages
/tmp/bofied-frontend-build -build -path bofied -out out/release/bofied-frontend-github-pages
cp -r web/* out/release/bofied-frontend-github-pages/web
release: release-backend release-frontend release-frontend-github-pages
install: release-backend
sudo install out/release/bofied-backend/bofied-backend.linux-$$(uname -m) /usr/local/bin/bofied-backend
sudo setcap cap_net_bind_service+ep /usr/local/bin/bofied-backend
dev:
while [ -z "$$BACKEND_PID" ] || [ -n "$$(inotifywait -q -r -e modify pkg cmd web/*.css)" ]; do\
$(MAKE);\
kill -9 $$BACKEND_PID 2>/dev/null 1>&2;\
kill -9 $$FRONTEND_PID 2>/dev/null 1>&2;\
wait $$BACKEND_PID $$FRONTEND_PID;\
sudo setcap cap_net_bind_service+ep out/bofied-backend/bofied-backend;\
out/bofied-backend/bofied-backend & export BACKEND_PID="$$!";\
/tmp/bofied-frontend-build -serve & export FRONTEND_PID="$$!";\
done
clean:
rm -rf out
rm -rf pkg/api/proto/v1
rm -rf ~/.local/share/bofied
depend:
# Setup CLIs
GO111MODULE=on go get github.com/golang/protobuf/protoc-gen-go@latest
GO111MODULE=on go get github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
GO111MODULE=on go get github.com/golang/protobuf/protoc-gen-go@latest
# Generate bindings
go generate ./...