github.com/whamcloud/lemur@v0.0.0-20190827193804-4655df8a52af/vendor/Makefile (about) 1 export PATH := $(GOPATH)/bin:$(PATH) 2 GVT_BIN = $(shell PATH=$(PATH); if which gvt 2>/dev/null; then true; else echo get-gvt; fi) 3 GO_SOURCES := $(shell find $(dir $(CURDIR)) -name '*.go' -and -not -path '*vendor*' -and -not -path '*output*') 4 GO_SRC_DIRS := $(addprefix .,$(sort $(subst $(dir $(CURDIR)),,$(dir $(GO_SOURCES))))) 5 IMPORT_PATH := $(subst $(GOPATH)/src/,,$(dir $(CURDIR))) 6 7 # Explicit repo imports which need to be added because they can't be inferred 8 # from imports of repo subdirs. These are needed for slurp. 9 EXPLICIT_IMPORTS := 10 11 # These patterns match imports which we don't need to ship, and therefore 12 # don't want to include in the vendor tree. 13 define EXCLUDES 14 camlistore.org # golang.org/x/net/http2/h2demo/h2demo.go 15 go4.org # golang.org/x/net/http2/h2demo/h2demo.go 16 cloud.google.com 17 google.golang.org/appengine 18 google.golang.org/api 19 github.com/BurntSushi # gopkg.in/urfave/cli.v1/altsrc 20 github.com/urfave # gopkg.in/urfave/cli.v1/altsrc 21 github.com/stathat # github.com/rcrowley/go-metrics/stathat/stathat.go 22 github.com/intel-hpdd/logging/applog 23 github.com/fatih # github.com/intel-hpdd/logging/applog 24 github.com/mattn # github.com/intel-hpdd/logging/applog 25 github.com/briandowns # github.com/intel-hpdd/logging/applog 26 endef 27 export EXCLUDES 28 29 define IMPORT_LIST_FN 30 $$(deps=; for dep in $$(go list -f '{{ join .Deps "\n" }}' $(GO_SRC_DIRS) | sort | uniq); do if localdep=$$(go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' $$dep 2>/dev/null); then deps="$$deps\n$$localdep"; else deps="$$deps\n$$dep"; fi; done; echo $$deps | egrep -v "($$EXCLUDE_LIST$(IMPORT_PATH)|vendor)" | sort | uniq) 31 endef 32 export IMPORT_LIST_FN 33 34 manifest: $(GVT_BIN) $(GO_SOURCES) 35 @pushd .. >/dev/null; \ 36 echo "Building list of dependencies in $(GO_SRC_DIRS) and checking for missing vendors..."; \ 37 EXCLUDE_LIST=$$(echo $$"$$EXCLUDES" | sed -e 's/[[:space:]]*#.*$$//' | tr '\n' '|'); \ 38 IMPORT_LIST="$$(if [ '$(EXPLICIT_IMPORTS)' != "" ]; then echo '$(EXPLICIT_IMPORTS) '; fi)$(IMPORT_LIST_FN)"; \ 39 while [ "$$IMPORT_LIST" != "" ]; do \ 40 echo "Vendoring $$(echo $$IMPORT_LIST | wc -w) dependencies."; \ 41 for import in $$IMPORT_LIST; do \ 42 $(GVT_BIN) fetch -no-recurse $$import; \ 43 done; \ 44 IMPORT_LIST=$(IMPORT_LIST_FN); \ 45 done; \ 46 echo "Done."; \ 47 popd >/dev/null; \ 48 touch $@ 49 50 get-gvt: 51 go get -u github.com/FiloSottile/gvt