-
Notifications
You must be signed in to change notification settings - Fork 53
/
Makefile
56 lines (40 loc) · 1.46 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
.PHONY: all kube-dag genectl clean test e2e
PACKAGE=kubegene.io/kubegene/pkg/version
CURRENT_DIR=$(shell pwd)
VERSION=$(shell git describe --long --match='v*' --dirty)
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
override LDFLAGS += \
-X ${PACKAGE}.version=${VERSION} \
-X ${PACKAGE}.buildDate=${BUILD_DATE} \
-X ${PACKAGE}.gitCommit=${GIT_COMMIT} \
-X ${PACKAGE}.gitTreeState=${GIT_TREE_STATE}
ifneq (${GIT_TAG},)
override LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG}
endif
IMAGE_NAME=kube-dag
TAG=$(shell git rev-parse --short HEAD)
ifdef V
TESTARGS = -v -args -alsologtostderr -v 10
else
TESTARGS =
endif
all: kube-dag genectl
kube-dag:
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '${LDFLAGS} -extldflags "-static"' -o ./bin/kube-dag ./cmd/kube-dag
genectl:
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '${LDFLAGS} -extldflags "-static"' -o ./bin/genectl ./cmd/genectl
clean:
-rm -rf bin
docker: kube-dag
docker build -t $(IMAGE_NAME):$(TAG) .
test:
go test `go list ./... | grep -v -e 'vendor' -e 'test'` $(TESTARGS)
go vet `go list ./... | grep -v vendor`
e2e: KUBECONFIG?=$(HOME)/.kube/config
e2e:
./hack/e2e.sh $(IMAGE_NAME):$(TAG) $(KUBECONFIG) ./bin/genectl