imposm3/Makefile

83 lines
2.0 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
PROTOFILES=$(shell find . -name \*.proto | grep -v vendor/ )
2013-08-29 18:57:16 +04:00
PBGOFILES=$(patsubst %.proto,%.pb.go,$(PROTOFILES))
GOFILES=$(shell find . \( -name \*.go ! -name version.go \) | grep -v .pb.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
ifdef LEVELDB_POST_121
GOTAGS=-tags="ldbpost121"
endif
2013-09-04 16:19:36 +04:00
BUILD_DATE=$(shell date +%Y%m%d)
BUILD_REV=$(shell git rev-parse --short HEAD)
BUILD_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
TAG=$(shell git name-rev --tags --name-only $(BUILD_REV))
ifeq ($(TAG),undefined)
BUILD_VERSION=$(BUILD_BRANCH)-$(BUILD_DATE)-$(BUILD_REV)
else
# use TAG but strip v of v1.2.3
BUILD_VERSION=$(TAG:v%=%)
endif
VERSION_LDFLAGS=-X github.com/omniscale/imposm3.Version=$(BUILD_VERSION)
2013-09-04 16:19:36 +04:00
2013-08-29 18:57:16 +04:00
all: build test
imposm: $(GOFILES)
2018-04-17 22:06:55 +03:00
$(GO) build $(GOTAGS) $(GOLDFLAGS) ./cmd/imposm
2013-08-29 18:57:16 +04:00
2018-04-17 22:06:55 +03:00
build: imposm
2013-08-29 18:57:16 +04:00
clean:
2018-04-17 22:06:55 +03:00
rm -f imposm
2013-09-02 14:07:15 +04:00
(cd test && make clean)
2013-08-29 18:57:16 +04:00
test: system-test-files
2018-06-07 21:31:54 +03:00
$(GO) test $(GOTAGS) -parallel 4 ./...
2013-10-29 17:08:39 +04:00
test-unit: system-test-files
$(GO) test $(GOTAGS) -test.short ./...
2013-10-29 17:08:39 +04:00
test-system: system-test-files
2018-06-07 21:31:54 +03:00
$(GO) test $(GOTAGS) -parallel 4 ./test
2013-08-29 18:57:16 +04:00
2016-01-15 18:21:44 +03:00
system-test-files:
(cd test && make files)
regen-protobuf: $(PBGOFILES)
2013-08-29 18:57:16 +04:00
%.pb.go: %.proto
2017-11-15 17:34:18 +03:00
protoc --proto_path=$(GOPATH)/src:$(GOPATH)/src/github.com/omniscale/imposm3/vendor/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
test-coverage:
$(GO) test -coverprofile imposm.coverprofile ./...
2016-12-06 18:17:30 +03:00
test-coverage-html: test-coverage
$(GO) tool cover -html imposm.coverprofile
2016-12-06 18:17:30 +03:00