forked from contiv/ofnet
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
executable file
·52 lines (40 loc) · 1.26 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
# go options
GO ?= go
LDFLAGS :=
GOFLAGS :=
BINDIR := $(CURDIR)/bin
GO_FILES := $(shell find . -type d -name '.cache' -prune -o -type f -name '*.go' -print)
GOPATH ?= $$(go env GOPATH)
DOCKER_CACHE := $(CURDIR)/.cache
.PHONY: all build
all: build
build:
$(GO) build ./...
vet:
$(GO) vet ./...
fmt:
$(GO) fmt ./...
test:
$(GO) test -v -timeout 30m ./...
DOCKER_ENV := \
@docker run --rm -u $$(id -u):$$(id -g) \
-e "GOCACHE=/tmp/gocache" \
-e "GOPATH=/tmp/gopath" \
-w /usr/src/github.com/smartxworks/ofnet \
-v $(DOCKER_CACHE)/gopath:/tmp/gopath \
-v $(DOCKER_CACHE)/gocache:/tmp/gocache \
-v $(CURDIR):/usr/src/github.com/smartxworks/ofnet \
ofnet/build
$(DOCKER_CACHE):
@mkdir -p $@/gopath
@mkdir -p $@/gocache
docker-image:
@docker build -f build/images/Dockerfile.build.ubuntu -t ofnet/build . --load
@docker build -f build/images/Dockerfile.test.ubuntu -t ofnet/test . --load
docker-build: $(DOCKER_CACHE) docker-image
$(DOCKER_ENV) make build
docker-test: $(DOCKER_CACHE) docker-image
docker-compose \
-f deploy/docker-compose/docker-compose.ovs.yaml \
-f deploy/docker-compose/docker-compose.test.yaml \
up --build --remove-orphans --abort-on-container-exit --exit-code-from test