forked from linkernetworks/network-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (51 loc) · 1.62 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
# Makefile templete reference
# https://gist.github.com/turtlemonvh/38bd3d73e61769767c35931d8c70ccb4
## network controller version
NETWORKCONTROLLER_VERSION = v0.4.9
BINARY = network-controller
VET_REPORT = vet.report
VERSION?=?
COMMIT=$(shell git rev-parse HEAD)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
# Symlink into GOPATH
GITHUB_USERNAME=vtxnetworks
BUILD_DIR=${GOPATH}/src/github.com/${GITHUB_USERNAME}/${BINARY}
CURRENT_DIR=$(shell pwd)
BUILD_DIR_LINK=$(shell readlink ${BUILD_DIR})
# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS = -ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=${COMMIT} -X main.BRANCH=${BRANCH}"
DOCKER_PATH="$(shell which docker)"
OVS_PATH="$(shell which ovs-vsctl)"
ifneq ($(DOCKER_PATH),"")
TEST_DOCKER=TEST_DOCKER=1
endif
ifneq ($(OVS_PATH),"")
TEST_OVS=TEST_OVS=1
endif
# Build the project
all: clean vet pb client server
pb:
protoc ./messages/messages.proto --go_out=plugins=grpc:.
server: pb
cd ${BUILD_DIR}/server; \
go build ${LDFLAGS} -o ${BINARY}-server . ; \
cd - >/dev/null
client: pb
cd ${BUILD_DIR}/client; \
go build ${LDFLAGS} -o ${BINARY}-client . ; \
cd - >/dev/null
vet: pb
go vet ./... > ${VET_REPORT} 2>&1 ;
clean:
-rm -f messages/messages.pb.go
-rm -f client/${BINARY}-*
-rm -f server/${BINARY}-*
-rm -f ${VET_REPORT}
test: pb client server
go clean -testcache
sudo -E env PATH=$$PATH TEST_VETH=1 $(TEST_OVS) $(TEST_DOCKER) go test -parallel=1 -v ./...
push.tag:
@echo "Current git tag version:"$(NETWORKCONTROLLER_VERSION)
git tag $(NETWORKCONTROLLER_VERSION)
git push --tags
.PHONY: server client vet test clean push.tag