github.com/sgoings/helm@v2.0.0-alpha.2.0.20170406211108-734e92851ac3+incompatible/Makefile (about) 1 DOCKER_REGISTRY ?= gcr.io 2 IMAGE_PREFIX ?= kubernetes-helm 3 SHORT_NAME ?= tiller 4 TARGETS = darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le windows/amd64 5 DIST_DIRS = find * -type d -exec 6 APP = helm 7 8 # go option 9 GO ?= go 10 PKG := $(shell glide novendor) 11 TAGS := 12 TESTS := . 13 TESTFLAGS := 14 LDFLAGS := 15 GOFLAGS := 16 BINDIR := $(CURDIR)/bin 17 BINARIES := helm tiller 18 19 # Required for globs to work correctly 20 SHELL=/bin/bash 21 22 .PHONY: all 23 all: build 24 25 .PHONY: build 26 build: 27 GOBIN=$(BINDIR) $(GO) install $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/... 28 29 # usage: make clean build-cross dist APP=helm|tiller VERSION=v2.0.0-alpha.3 30 .PHONY: build-cross 31 build-cross: LDFLAGS += -extldflags "-static" 32 build-cross: 33 CGO_ENABLED=0 gox -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/$(APP) 34 35 .PHONY: dist 36 dist: 37 ( \ 38 cd _dist && \ 39 $(DIST_DIRS) cp ../LICENSE {} \; && \ 40 $(DIST_DIRS) cp ../README.md {} \; && \ 41 $(DIST_DIRS) tar -zcf helm-${VERSION}-{}.tar.gz {} \; && \ 42 $(DIST_DIRS) zip -r helm-${VERSION}-{}.zip {} \; \ 43 ) 44 45 .PHONY: checksum 46 checksum: 47 for f in _dist/*.{gz,zip} ; do \ 48 shasum -a 256 "$${f}" | awk '{print $$1}' > "$${f}.sha256" ; \ 49 done 50 51 .PHONY: check-docker 52 check-docker: 53 @if [ -z $$(which docker) ]; then \ 54 echo "Missing \`docker\` client which is required for development"; \ 55 exit 2; \ 56 fi 57 58 .PHONY: docker-binary 59 docker-binary: BINDIR = ./rootfs 60 docker-binary: GOFLAGS += -a -installsuffix cgo 61 docker-binary: 62 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) build -o $(BINDIR)/tiller $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/tiller 63 64 .PHONY: docker-build 65 docker-build: check-docker docker-binary 66 docker build --rm -t ${IMAGE} rootfs 67 docker tag ${IMAGE} ${MUTABLE_IMAGE} 68 69 .PHONY: test 70 test: build 71 test: TESTFLAGS += -race -v 72 test: test-style 73 test: test-unit 74 75 .PHONY: test-unit 76 test-unit: 77 HELM_HOME=/no/such/dir $(GO) test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS) 78 79 .PHONY: test-style 80 test-style: 81 @scripts/validate-go.sh 82 @scripts/validate-license.sh 83 84 .PHONY: protoc 85 protoc: 86 $(MAKE) -C _proto/ all 87 88 .PHONY: docs 89 docs: build 90 @mkdir -p docs/helm docs/man/man1 91 bin/helm docs --dir ./docs/helm 92 bin/helm docs --dir ./docs/man/man1 --type man 93 bin/helm docs --dir ./scripts --type bash 94 scripts/docs-clean-home.sh 95 96 .PHONY: clean 97 clean: 98 @rm -rf $(BINDIR) ./rootfs/tiller ./_dist 99 100 .PHONY: coverage 101 coverage: 102 @scripts/coverage.sh 103 104 HAS_GLIDE := $(shell command -v glide;) 105 HAS_GOX := $(shell command -v gox;) 106 HAS_GIT := $(shell command -v git;) 107 108 .PHONY: bootstrap 109 bootstrap: 110 ifndef HAS_GLIDE 111 go get -u github.com/Masterminds/glide 112 endif 113 ifndef HAS_GOX 114 go get -u github.com/mitchellh/gox 115 endif 116 117 ifndef HAS_GIT 118 $(error You must install Git) 119 endif 120 glide install --strip-vendor 121 go build -o bin/protoc-gen-go ./vendor/github.com/golang/protobuf/protoc-gen-go 122 123 include versioning.mk