2014-07-28 08:46:17 +04:00
|
|
|
INSTALL_PATH ?= $(CURDIR)
|
|
|
|
|
2014-08-27 10:31:46 +04:00
|
|
|
$(shell ./tools/build_config.sh build_config.mk $INSTALL_PATH)
|
2014-07-28 08:46:17 +04:00
|
|
|
|
|
|
|
include build_config.mk
|
|
|
|
|
|
|
|
export CGO_CFLAGS
|
|
|
|
export CGO_CXXFLAGS
|
|
|
|
export CGO_LDFLAGS
|
|
|
|
export LD_LIBRARY_PATH
|
|
|
|
export DYLD_LIBRARY_PATH
|
|
|
|
export GO_BUILD_TAGS
|
2020-04-23 12:00:20 +03:00
|
|
|
export GO111MODULE=on
|
2014-07-28 08:46:17 +04:00
|
|
|
|
2020-04-26 15:11:32 +03:00
|
|
|
PACKAGES ?= $(shell GO111MODULE=on go list -mod=vendor ./... | grep -v /vendor/)
|
2020-05-10 08:32:35 +03:00
|
|
|
DIST := bin
|
|
|
|
VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
|
|
|
|
LDFLAGS := $(LDFLAGS) -X "main.version=$(VERSION)" -X "main.buildTags=$(GO_BUILD_TAGS)"
|
2020-04-26 15:11:32 +03:00
|
|
|
|
2017-03-12 13:05:35 +03:00
|
|
|
all: build
|
2014-07-20 15:03:00 +04:00
|
|
|
|
2020-05-10 08:32:35 +03:00
|
|
|
build: build-ledis
|
|
|
|
|
|
|
|
build-ledis:
|
|
|
|
go build -mod=vendor -o $(DIST)/ledis -tags '$(GO_BUILD_TAGS)' -ldflags '-s -w $(LDFLAGS)' cmd/ledis/*.go
|
|
|
|
|
|
|
|
build-commands:
|
|
|
|
go build -mod=vendor -o $(DIST)/ledis-server -tags '$(GO_BUILD_TAGS)' -ldflags '-s -w $(LDFLAGS)' cmd/ledis-server/*.go
|
|
|
|
go build -mod=vendor -o $(DIST)/ledis-cli -tags '$(GO_BUILD_TAGS)' -ldflags '-s -w $(LDFLAGS)' cmd/ledis-cli/*.go
|
|
|
|
go build -mod=vendor -o $(DIST)/ledis-benchmark -tags '$(GO_BUILD_TAGS)' -ldflags '-s -w $(LDFLAGS)' cmd/ledis-benchmark/*.go
|
|
|
|
go build -mod=vendor -o $(DIST)/ledis-dump -tags '$(GO_BUILD_TAGS)' -ldflags '-s -w $(LDFLAGS)' cmd/ledis-dump/*.go
|
|
|
|
go build -mod=vendor -o $(DIST)/ledis-load -tags '$(GO_BUILD_TAGS)' -ldflags '-s -w $(LDFLAGS)' cmd/ledis-load/*.go
|
|
|
|
go build -mod=vendor -o $(DIST)/ledis-repair -tags '$(GO_BUILD_TAGS)' -ldflags '-s -w $(LDFLAGS)' cmd/ledis-repair/*.go
|
2017-03-12 13:05:35 +03:00
|
|
|
|
2020-05-10 13:17:39 +03:00
|
|
|
.PHONY: lint
|
|
|
|
lint:
|
|
|
|
@hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
|
|
|
cd /tmp && GO111MODULE=on go get -u -v golang.org/x/lint/golint; \
|
|
|
|
fi
|
|
|
|
golint $(PACKAGES)
|
|
|
|
|
2020-04-24 08:07:38 +03:00
|
|
|
vet:
|
|
|
|
go vet -mod=vendor -tags '$(GO_BUILD_TAGS)' ./...
|
|
|
|
|
2014-07-20 15:03:00 +04:00
|
|
|
test:
|
2020-04-26 15:11:32 +03:00
|
|
|
go test -mod=vendor --race -tags '$(GO_BUILD_TAGS)' -cover -coverprofile coverage.out -timeout 10m $(PACKAGES)
|
2015-02-05 04:39:18 +03:00
|
|
|
|
2015-03-12 06:32:33 +03:00
|
|
|
clean:
|
2020-05-10 13:17:39 +03:00
|
|
|
go clean -i $(PACKAGES)
|
2015-03-12 06:32:33 +03:00
|
|
|
|
2015-02-05 04:39:18 +03:00
|
|
|
fmt:
|
2017-11-24 04:11:56 +03:00
|
|
|
gofmt -w -s . 2>&1 | grep -vE 'vendor' | awk '{print} END{if(NR>0) {exit 1}}'
|
|
|
|
|
|
|
|
sync_vendor:
|
2020-04-23 12:00:20 +03:00
|
|
|
go mod tidy -v && go mod vendor
|
2016-05-01 18:33:02 +03:00
|
|
|
|
2020-04-23 12:00:20 +03:00
|
|
|
update_vendor: sync_vendor
|