From 2d042dcd501e750a0fdf16b0c3e340b5d0e17703 Mon Sep 17 00:00:00 2001 From: CarlosEDP Date: Wed, 13 Mar 2019 18:04:19 -0300 Subject: [PATCH] Fix makefile to install utilities when not present --- Makefile | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index bd0befb..8829031 100644 --- a/Makefile +++ b/Makefile @@ -4,25 +4,23 @@ JB_BINARY:=$(GOPATH)/bin/jb .PHONY: generate vendor fmt manifests -all: generate +all: manifests -generate: manifests - -manifests: $(JSONNET) +manifests: jsonnet rm -rf manifests ./scripts/build.sh main.jsonnet update: jb update -vendor: $(JB_BINARY) jsonnetfile.json jsonnetfile.lock.json +vendor: jsonnet_bundler jsonnetfile.json jsonnetfile.lock.json rm -rf vendor $(JB_BINARY) install fmt: find . -name 'vendor' -prune -o -name '*.libsonnet' -o -name '*.jsonnet' -print | xargs -n 1 -- $(JSONNET_FMT) -i -deploy: +deploy: manifests kubectl apply -f ./manifests/ echo "Will wait 40 seconds to reapply manifests" sleep 40 @@ -35,9 +33,16 @@ tar: manifests rm -rf manifests.tar tar -cf manifests.tar manifests -$(JB_BINARY): - go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb +jsonnet_bundler: +ifeq (, $(shell which jb)) + @echo "Installing jsonnet-bundler" + @go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb + @go get github.com/brancz/gojsontoyaml +endif -$(JSONNET): - go get github.com/google/go-jsonnet/jsonnet - go get github.com/brancz/gojsontoyaml +jsonnet: +ifeq (, $(shell which jsonnet)) + @echo "Installing jsonnet" + @go get github.com/google/go-jsonnet/jsonnet + @go get github.com/brancz/gojsontoyaml +endif \ No newline at end of file