-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
46 lines (34 loc) · 1.32 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
GOCMD=go
YARNCMD=yarnpkg
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
YARNBUILD=$(YARNCMD) generate
PREFIX=/usr/local/bin
BIN_FOLDER=bin
SERVER_BINARY_NAME=sox
CLIENT_BINARY_NAME=sox-cli
UI_BINARY_NAME=sox-ui
VERSION := $(shell date -u +"%Y.%m.%d-%s")
export VERSION
all: build-ui build
proto:
protoc -I api/ --go_out=api/ --go_opt=paths=source_relative --go-grpc_out=api/ --go-grpc_opt=paths=source_relative data.proto service.proto
$(BIN_FOLDER):
mkdir -p $(BIN_FOLDER)
build: $(BIN_FOLDER)
$(GOBUILD) -ldflags '-X github.com/lnsp/sox/meta.Version=$(VERSION)' -o $(BIN_FOLDER)/$(SERVER_BINARY_NAME) -v ./cmd/server
$(GOBUILD) -ldflags '-X github.com/lnsp/sox/meta.Version=$(VERSION)' -o $(BIN_FOLDER)/$(CLIENT_BINARY_NAME) -v ./cmd/client
$(GOBUILD) -ldflags '-X github.com/lnsp/sox/meta.Version=$(VERSION)' -o $(BIN_FOLDER)/$(UI_BINARY_NAME) -v ./cmd/ui
install:
unlink $(PREFIX)/$(SERVER_BINARY_NAME); cp $(BIN_FOLDER)/$(SERVER_BINARY_NAME) $(PREFIX)/$(SERVER_BINARY_NAME)
unlink $(PREFIX)/$(CLIENT_BINARY_NAME); cp $(BIN_FOLDER)/$(CLIENT_BINARY_NAME) $(PREFIX)/$(CLIENT_BINARY_NAME)
unlink $(PREFIX)/$(UI_BINARY_NAME); cp $(BIN_FOLDER)/$(UI_BINARY_NAME) $(PREFIX)/$(UI_BINARY_NAME)
build-ui:
cd ui && $(YARNBUILD)
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
rm -f $(BIN_FOLDER)