forked from portworx/openstorage
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
107 lines (85 loc) · 2.15 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
TAGS := daemon btrfs_noversion
PKGS := $(shell go list ./... | grep -v 'github.com/libopenstorage/openstorage/vendor')
ifeq ($(BUILD_TYPE),debug)
BUILDFLAGS := -gcflags "-N -l"
endif
export GO15VENDOREXPERIMENT=1
all: test install
deps:
GO15VENDOREXPERIMENT=0 go get -d -v $(PKGS)
update-deps:
GO15VENDOREXPERIMENT=0 go get -d -v -u -f $(PKGS)
test-deps:
GO15VENDOREXPERIMENT=0 go get -d -v -t $(PKGS)
update-test-deps:
GO15VENDOREXPERIMENT=0 go get -d -v -t -u -f $(PKGS)
vendor:
go get -v github.com/tools/godep
rm -rf Godeps
rm -rf vendor
# TODO: when godep fixes downloading all tags, remove the custom package
# https://github.com/tools/godep/issues/271
godep save $(PKGS) github.com/docker/docker/pkg/chrootarchive
rm -rf Godeps
build:
go build -tags "$(TAGS)" $(BUILDFLAGS) $(PKGS)
install:
go install -tags "$(TAGS)" $(PKGS)
lint:
go get -v github.com/golang/lint/golint
$(foreach pkg,$(PKGS),golint $(pkg);)
vet:
go vet $(PKGS)
errcheck:
go get -v github.com/kisielk/errcheck
errcheck $(PKGS)
pretest: lint vet errcheck
test:
go test -tags "$(TAGS)" $(PKGS)
docker-build:
docker build -t openstorage/osd-dev -f Dockerfile.osd-dev .
docker-test: docker-build
docker run \
--privileged \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
-v /var/run/docker.sock:/var/run/docker.sock \
openstorage/osd-dev \
make test
docker-build-osd-internal:
rm -rf _tmp
mkdir -p _tmp
go build -a -tags "$(TAGS)" -o _tmp/osd cmd/osd/main.go
docker build -t openstorage/osd -f Dockerfile.osd .
docker-build-osd: docker-build
docker run -v /var/run/docker.sock:/var/run/docker.sock openstorage/osd-dev make docker-build-osd-internal
launch: docker-build-osd
docker run \
--privileged \
-v $(shell pwd):/etc \
-v /usr/share/docker/plugins:/usr/share/docker/plugins \
-v /var/lib/osd/driver:/var/lib/osd/driver \
-v /mnt:/mnt \
openstorage/osd -d -f /etc/config.yaml
clean:
go clean -i $(PKGS)
.PHONY: \
all \
deps \
update-deps \
test-deps \
update-test-deps \
vendor \
build \
install \
lint \
vet \
errcheck \
pretest \
test \
docker-build \
docker-test \
docker-build-osd-internal \
docker-build-osd \
launch \
clean