1TOOL?=vault-plugin-database-mongodbatlas 2TEST?=$$(go list ./... | grep -v /vendor/) 3VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr 4EXTERNAL_TOOLS=\ 5 github.com/mitchellh/gox 6BUILD_TAGS?=${TOOL} 7GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) 8 9default: dev 10 11# bin generates the releaseable binaries for this plugin 12bin: fmtcheck generate 13 @CGO_ENABLED=0 BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/build.sh'" 14 15# dev creates binaries for testing Vault locally. These are put 16# into ./bin/ as well as $GOPATH/bin. 17dev: fmtcheck generate 18 @CGO_ENABLED=0 BUILD_TAGS='$(BUILD_TAGS)' VAULT_DEV_BUILD=1 sh -c "'$(CURDIR)/scripts/build.sh'" 19 20# test runs the unit tests and vets the code 21test: fmtcheck generate 22 CGO_ENABLED=0 VAULT_TOKEN= VAULT_ACC= go test -v -tags='$(BUILD_TAGS)' $(TEST) $(TESTARGS) -count=1 -timeout=20m -parallel=4 23 24testcompile: fmtcheck generate 25 @for pkg in $(TEST) ; do \ 26 go test -v -c -tags='$(BUILD_TAGS)' $$pkg -parallel=4 ; \ 27 done 28 29# generate runs `go generate` to build the dynamically generated 30# source files. 31generate: 32 go generate $(go list ./... | grep -v /vendor/) 33 34# bootstrap the build by downloading additional tools 35bootstrap: 36 @for tool in $(EXTERNAL_TOOLS) ; do \ 37 echo "Installing/Updating $$tool" ; \ 38 go get -u $$tool; \ 39 done 40 41fmtcheck: 42 @sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" 43 44fmt: 45 gofmt -w $(GOFMT_FILES) 46 47proto: 48 protoc *.proto --go_out=plugins=grpc:. 49 50.PHONY: bin default generate test vet bootstrap fmt fmtcheck