forked from spiffe/spire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (59 loc) · 1.88 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
ifeq ($(SPIRE_DEV_HOST), docker)
docker = docker run -v $(docker_volume) -it $(docker_image)
container = container
else
docker =
container =
endif
binary_dirs := $(shell find cmd/* functional/tools/* -maxdepth 0 -type d)
docker_volume := $(shell echo $${PWD%/src/*}):/root/go
docker_image = spire-dev:latest
gopath := $(shell go env GOPATH)
gittag := $(shell git tag --points-at)
gitdirty := $(shell git status -s)
# don't provide the git tag if the git status is dirty.
ifneq ($(gitdirty),)
gittag :=
endif
ldflags := '-X github.com/spiffe/spire/pkg/common/version.gittag=$(gittag)'
utils = github.com/golang/protobuf/protoc-gen-go \
github.com/grpc-ecosystem/grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
github.com/jteeuwen/go-bindata/go-bindata
.PHONY: all utils container-push cmd build test race-test clean functional
build: $(binary_dirs)
all: $(container) vendor build test
container: Dockerfile
docker build -t $(docker_image) --no-cache .
container-push:
docker tag $(docker_image) spiffe/$(docker_image)
docker push spiffe/$(docker_image)
cmd:
$(docker) /bin/bash
utils: $(utils)
$(utils): noop
# some sources do not contain buildable go, hence || true
$(docker) /bin/sh -c "cd vendor/$@; go get . || true"
$(docker) mkdir -p $(gopath)/src/$@
$(docker) cp -r vendor/$@/* $(gopath)/src/$@/
vendor: glide.yaml glide.lock
$(docker) glide --home .cache install
$(binary_dirs): noop
$(docker) /bin/sh -c "cd $@; go build -i -ldflags $(ldflags)"
artifact:
$(docker) ./build.sh artifact
test:
$(docker) go test -race -timeout 8m $$(glide novendor)
race-test:
$(docker) go test -race $$(glide novendor)
integration:
$(docker) script/e2e_test.sh
clean:
$(docker) go clean $$(glide novendor)
distclean: clean
rm -rf .cache
rm -rf vendor
functional:
$(MAKE) -C functional/ all
noop: