-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
53 lines (43 loc) · 1.12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Go parameters
GOCMD=GO111MODULE=on go
GOBUILD=$(GOCMD) build
GOINSTALL=$(GOCMD) install
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
GOFMT=$(GOCMD) fmt
BIN_NAME=ftsb_redisearch
MODULE=ftsb_redisearch
DISTDIR = ./dist
.PHONY: ftsb_redisearch
all: get test ftsb_redisearch
# Build-time GIT variables
ifeq ($(GIT_SHA),)
GIT_SHA:=$(shell git rev-parse HEAD)
endif
ifeq ($(GIT_DIRTY),)
GIT_DIRTY:=$(shell git diff --no-ext-diff 2> /dev/null | wc -l)
endif
LDFLAGS = "-X 'main.GitSHA1=$(GIT_SHA)' -X 'main.GitDirty=$(GIT_DIRTY)'"
fmt:
$(GOFMT) ./...
ftsb_redisearch: test
$(GOBUILD) \
-ldflags=$(LDFLAGS) \
-o bin/$@ ./cmd/$@
get:
$(GOGET) ./...
test: get
release:
$(GOGET) github.com/mitchellh/gox
$(GOGET) github.com/tcnksm/ghr
GO111MODULE=on gox -osarch "linux/amd64 darwin/amd64" \
-ldflags=$(LDFLAGS) \
-output "${DISTDIR}/${BIN_NAME}_{{.OS}}_{{.Arch}}" ./cmd/ftsb_redisearch
publish: release
@for f in $(shell ls ${DISTDIR}); \
do \
echo "copying ${DISTDIR}/$${f}"; \
aws s3 cp ${DISTDIR}/$${f} s3://benchmarks.redislabs/${MODULE}/tools/${BIN_NAME}/$${f} --acl public-read; \
done