github.com/dawnbass68/maddcash@v0.0.0-20201001105353-c91c12cb36e5/build/docker/bin/Makefile (about) 1 SHELL = /bin/bash 2 UPDATE_VENDOR ?= 1 3 VERSION ?= devel 4 GITCOMMIT = $(shell cd /src && git describe --always --dirty) 5 BUILDTIME = $(shell date --iso-8601=seconds) 6 LDFLAGS := -X blockbook/common.version=$(VERSION) -X blockbook/common.gitcommit=$(GITCOMMIT) -X blockbook/common.buildtime=$(BUILDTIME) 7 BLOCKBOOK_SRC := $(GOPATH)/src/blockbook 8 ARGS ?= 9 10 all: build tools 11 12 build: prepare-sources generate-data 13 cd $(BLOCKBOOK_SRC) && go build -o $(CURDIR)/blockbook -ldflags="-s -w $(LDFLAGS)" $(ARGS) 14 cp $(CURDIR)/blockbook /out/blockbook 15 chown $(PACKAGER) /out/blockbook 16 17 build-debug: prepare-sources generate-data 18 cd $(BLOCKBOOK_SRC) && go build -o $(CURDIR)/blockbook -ldflags="$(LDFLAGS)" $(ARGS) 19 cp $(CURDIR)/blockbook /out/blockbook 20 chown $(PACKAGER) /out/blockbook 21 22 tools: 23 cp $(CURDIR)/{ldb,sst_dump} /out 24 chown $(PACKAGER) /out/{ldb,sst_dump} 25 26 test: prepare-sources generate-data 27 cd $(BLOCKBOOK_SRC) && go test -tags unittest `go list ./... | grep -vP '^blockbook/(contrib|tests)'` $(ARGS) 28 29 test-integration: prepare-sources generate-data 30 cd $(BLOCKBOOK_SRC) && go test -tags integration `go list blockbook/tests/...` $(ARGS) 31 32 test-all: prepare-sources generate-data 33 cd $(BLOCKBOOK_SRC) && go test -tags 'unittest integration' `go list ./... | grep -v '^blockbook/contrib'` $(ARGS) 34 35 prepare-sources: 36 @ [ -n "`ls /src 2> /dev/null`" ] || (echo "/src doesn't exist or is empty" 1>&2 && exit 1) 37 rm -rf $(BLOCKBOOK_SRC) 38 cp -r /src $(BLOCKBOOK_SRC) 39 $(MAKE) prepare-vendor 40 41 prepare-vendor: 42 @ if [ "$(UPDATE_VENDOR)" -eq 1 ]; then \ 43 echo "Updating vendor"; \ 44 cd $(BLOCKBOOK_SRC) && rm -rf vendor* && cp -r /build/vendor . && dep ensure -vendor-only ; \ 45 else \ 46 echo "Update of vendor not demanded, keeping version from src" ; \ 47 fi 48 49 generate-data: 50 cd $(BLOCKBOOK_SRC) && packr clean && packr