forked from helm/helm
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
103 lines (86 loc) · 2.08 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
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: info
info:
$(MAKE) -C $(ROOTFS) $@
.PHONY: gocheck
ifndef GOPATH
$(error No GOPATH set)
endif
GO_DIRS ?= $(shell glide nv -x )
GO_PKGS ?= $(shell glide nv)
.PHONY: build
build: gocheck
@scripts/build-go.sh
.PHONY: build-cross
build-cross: gocheck
@BUILD_CROSS=1 scripts/build-go.sh
.PHONY: all
all: build
.PHONY: clean
clean:
go clean -v $(GO_PKGS)
rm -rf bin
.PHONY: test
test: build test-style test-unit
ROOTFS := rootfs
.PHONY: push
push: all
$(MAKE) -C $(ROOTFS) $@
.PHONY: container
container: all
$(MAKE) -C $(ROOTFS) $@
.PHONY: test-unit
test-unit:
@echo Running tests...
go test -v $(GO_PKGS)
.PHONY: .test-style
test-style: lint vet
@if [[ -z $(shell gofmt -e -l -s $(GO_DIRS) | wc -l) ]]; then \
echo "gofmt check failed:"; gofmt -e -d -s $(GO_DIRS); exit 1; \
fi
.PHONY: lint
lint:
@echo Running golint...
@for i in $(GO_PKGS); do \
golint $$i; \
done
@echo -----------------
.PHONY: vet
vet:
@echo Running go vet...
@for i in $(GO_DIRS); do \
go tool vet $$i; \
done
@echo -----------------
HAS_GLIDE := $(shell command -v glide)
HAS_GOLINT := $(shell command -v golint)
HAS_GOVET := $(shell command -v go tool vet)
HAS_GOX := $(shell command -v gox)
.PHONY: bootstrap
bootstrap:
@echo Installing deps
ifndef HAS_GLIDE
go get github.com/Masterminds/glide
endif
ifndef HAS_GOLINT
go get -u github.com/golang/lint/golint
endif
ifndef HAS_GOVET
go get -u golang.org/x/tools/cmd/vet
endif
ifndef HAS_GOX
go get -u github.com/mitchellh/gox
endif
glide install