imposm3/Makefile

87 lines
2.3 KiB
Makefile
Raw Normal View History

2015-05-07 17:41:06 +03:00
.PHONY: test all build clean test test-system test-unit update_version docs
2013-08-29 18:57:16 +04:00
2017-11-15 16:18:48 +03:00
PROTOFILES=$(shell find . -name \*.proto -not -path ./vendor/\*)
2013-08-29 18:57:16 +04:00
PBGOFILES=$(patsubst %.proto,%.pb.go,$(PROTOFILES))
2013-09-04 16:19:36 +04:00
GOFILES=$(shell find . \( -name \*.go ! -name version.go \) )
2013-08-29 18:57:16 +04:00
# for protoc-gen-go
export PATH := $(GOPATH)/bin:$(PATH)
2016-11-28 11:41:20 +03:00
GOLDFLAGS=-ldflags '-r $${ORIGIN}/lib $(VERSION_LDFLAGS)'
2013-08-29 18:57:16 +04:00
2017-11-15 16:22:02 +03:00
GO:=go
2013-09-04 16:19:36 +04:00
BUILD_DATE=$(shell date +%Y%m%d)
BUILD_REV=$(shell git rev-parse --short HEAD)
BUILD_VERSION=dev-$(BUILD_DATE)-$(BUILD_REV)
2016-11-28 11:41:20 +03:00
VERSION_LDFLAGS=-X github.com/omniscale/imposm3.buildVersion=$(BUILD_VERSION)
2013-09-04 16:19:36 +04:00
2013-08-29 18:57:16 +04:00
all: build test
imposm3: $(PBGOFILES) $(GOFILES)
2016-11-25 15:53:58 +03:00
$(GO) build $(GOLDFLAGS) ./cmd/imposm3
2013-08-29 18:57:16 +04:00
build: imposm3
clean:
rm -f imposm3
2013-09-02 14:07:15 +04:00
(cd test && make clean)
2013-08-29 18:57:16 +04:00
2016-01-15 18:21:44 +03:00
test: imposm3 system-test-files
$(GO) test ./... -i
$(GO) test `$(GO) list ./... | grep -Ev '/vendor'`
2013-10-29 17:08:39 +04:00
test-unit: imposm3
2014-10-10 18:12:01 +04:00
$(GO) test ./... -i
$(GO) test `$(GO) list ./... | grep -Ev '/test|/vendor'`
2013-10-29 17:08:39 +04:00
test-system: imposm3
2013-09-02 14:07:15 +04:00
(cd test && make test)
2013-08-29 18:57:16 +04:00
2016-01-15 18:21:44 +03:00
system-test-files:
(cd test && make files)
2013-08-29 18:57:16 +04:00
%.pb.go: %.proto
2017-11-15 15:57:30 +03:00
protoc --proto_path=$(GOPATH)/src:$(GOPATH)/src/github.com/gogo/protobuf/protobuf:. --gogofaster_out=. $^
2015-05-07 17:41:06 +03:00
docs:
(cd docs && make html)
2016-11-10 16:39:08 +03:00
REMOTE_DOC_LOCATION = omniscale.de:/opt/www/imposm.org/docs/imposm3
2015-05-07 17:41:06 +03:00
DOC_VERSION = 3.0.0
upload-docs: docs
rsync -a -v -P -z docs/_build/html/ $(REMOTE_DOC_LOCATION)/$(DOC_VERSION)
2015-08-27 10:50:07 +03:00
build-license-deps:
rm LICENSE.deps
find ./vendor -iname license\* -exec bash -c '\
dep=$${1#./vendor/}; \
2015-08-27 10:50:07 +03:00
(echo -e "========== $$dep ==========\n"; cat $$1; echo -e "\n\n") \
| fold -s -w 80 \
>> LICENSE.deps \
2016-11-28 11:41:20 +03:00
' _ {} \;
2016-12-06 18:17:30 +03:00
comma:= ,
empty:=
space:= $(empty) $(empty)
COVER_IGNORE:='/vendor|/cmd'
COVER_PACKAGES:= $(shell $(GO) list ./... | grep -Ev $(COVER_IGNORE))
COVER_PACKAGES_LIST:=$(subst $(space),$(comma),$(COVER_PACKAGES))
test-coverage:
mkdir -p .coverprofile
rm -f .coverprofile/*
$(GO) list -f '{{if gt (len .TestGoFiles) 0}}"$(GO) test -covermode count -coverprofile ./.coverprofile/{{.Name}}-$$$$.coverprofile -coverpkg $(COVER_PACKAGES_LIST) {{.ImportPath}}"{{end}}' ./... \
| grep -Ev $(COVER_IGNORE) \
| xargs -n 1 bash -c
$(GOPATH)/bin/gocovmerge .coverprofile/*.coverprofile > overalls.coverprofile
rm -rf .coverprofile
test-coverage-html: test-coverage
$(GO) tool cover -html overalls.coverprofile