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