/
Makefile
74 lines (58 loc) · 2.11 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
BINARY_CLI_NAME := glambda
APP_BIN_CLI_PATH := $(CURDIR)/bin/$(BINARY_CLI_NAME)
APP_CLI_SRC_PATH := $(CURDIR)/cmd/cli
ifneq ($(OS),Windows_NT)
UNAME_S := $(shell uname -s)
endif
run:
go run $(APP_CONTAINER_SRC_PATH)/main.go
all: cli
cli:
ifeq ($(OS),Windows_NT)
set GOARCH=amd64& set GOOS=windows& go build -o $(APP_BIN_CLI_PATH).exe ${APP_CLI_SRC_PATH}/main.go
else
ifeq ($(UNAME_S),Linux)
GOARCH=amd64 GOOS=linux go build -o $(APP_BIN_CLI_PATH) ${APP_CLI_SRC_PATH}/main.go
endif
endif
runs:
./${APP_BIN_CLI_PATH}
build_and_run: build run
clean:
go clean
ifeq ($(OS),Windows_NT)
rm ${APP_BIN_CLI_PATH}-windows
else
ifeq ($(UNAME_S),Linux)
rm ${APP_BIN_CLI_PATH}-linux
endif
ifeq ($(UNAME_S),Darwin)
rm ${APP_BIN_CLI_PATH}-darwin
endif
endif
test:
go test ./...
test_coverage:
go test ./... -coverprofile=coverage.out
dep:
go mod download
vet:
go vet
lint:
golangci-lint run --enable-all
ROOT :+$(dir $(abspath $(lastword $(ROOT))))
DIR = $(ROOT)/dir
COPYDIR = $(ROOT)/copydir
install :
if [! -d $(DIR)]; then mkdir $(NEWDIR); fi
cp -r $(DIR)/ $(COPYDIR)/
protoc:
protoc --go_out=./pkg/proto/rpc --go_opt=paths=source_relative \
--go-grpc_out=./pkg/proto/rpc --go-grpc_opt=paths=source_relative -I ./pkg/proto/ptypes -I ./pkg/proto/rpc controls.proto
protoc --go_out=./pkg/proto/ptypes --go_opt=paths=source_relative -I ./pkg/proto/ptypes block.proto
protoc --go_out=./pkg/proto/ptypes --go_opt=paths=source_relative -I ./pkg/proto/ptypes transaction.proto
protoc --go_out=./pkg/proto/ptypes --go_opt=paths=source_relative -I ./pkg/proto/ptypes user.proto
protoc --go_out=./pkg/proto/packets --go_opt=paths=source_relative -I ./pkg/proto/ptypes -I ./pkg/proto/packets masternet_packet.proto
protoc --go_out=./pkg/proto/packets --go_opt=paths=source_relative -I ./pkg/proto/ptypes -I ./pkg/proto/packets block_packet.proto
protoc --go_out=./pkg/proto/packets --go_opt=paths=source_relative -I ./pkg/proto/ptypes -I ./pkg/proto/packets common_packet.proto
protoc --go_out=./pkg/proto/packets --go_opt=paths=source_relative -I ./pkg/proto/ptypes -I ./pkg/proto/packets file_packet.proto