imposm3/Makefile

47 lines
1005 B
Makefile
Raw Normal View History

2013-12-02 18:02:10 +04:00
.PHONY: test all build clean test test-system test-unit update_version
2013-08-29 18:57:16 +04:00
PROTOFILES=$(shell find . -name \*.proto)
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)
2013-09-04 17:23:16 +04:00
GOLDFLAGS=-ldflags '-r $${ORIGIN}/lib'
2013-08-29 18:57:16 +04:00
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)
2013-08-29 18:57:16 +04:00
all: build test
2013-12-02 18:02:10 +04:00
update_version:
@perl -p -i -e 's/buildVersion = ".*"/buildVersion = "$(BUILD_VERSION)"/' cmd/version.go
2013-12-02 18:02:10 +04:00
revert_version:
@perl -p -i -e 's/buildVersion = ".*"/buildVersion = ""/' cmd/version.go
2013-12-02 18:02:10 +04:00
2013-08-29 18:57:16 +04:00
imposm3: $(GOFILES) $(PROTOFILES)
2013-12-02 18:02:10 +04:00
$(MAKE) update_version
2013-08-29 18:57:16 +04:00
go build $(GOLDFLAGS)
2013-12-02 18:02:10 +04:00
$(MAKE) revert_version
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
2013-10-29 17:08:39 +04:00
test: test-unit test-system
test-unit: imposm3
2014-08-04 17:19:35 +04:00
go test ./... -i
go test ./...
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
%.pb.go: %.proto
protoc --go_out=. $^