forked from go-graphite/graphite-clickhouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (68 loc) · 2.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
NAME:=graphite-clickhouse
MAINTAINER:="Roman Lomonosov <[email protected]>"
DESCRIPTION:="Graphite cluster backend with ClickHouse support"
MODULE:=github.com/lomik/graphite-clickhouse
GO ?= go
export GOPATH := $(CURDIR)/_vendor
TEMPDIR:=$(shell mktemp -d)
DEVEL ?= 0
ifeq ($(DEVEL), 0)
VERSION:=$(shell sh -c 'grep "const Version" $(NAME).go | cut -d\" -f2')
else
VERSION:=$(shell sh -c 'git describe --always --tags | sed -e "s/^v//i"')
endif
all: $(NAME)
$(NAME):
$(GO) build $(MODULE)
test:
$(GO) test $(MODULE)/helper/clickhouse
$(GO) test $(MODULE)/helper/pickle
$(GO) test $(MODULE)/helper/point
$(GO) test $(MODULE)/helper/rollup
$(GO) test $(MODULE)/pkg/dry
$(GO) test $(MODULE)/pkg/reverse
$(GO) test $(MODULE)/pkg/where
$(GO) test $(MODULE)/config
$(GO) test $(MODULE)/find
$(GO) test $(MODULE)/render
$(GO) test $(MODULE)/finder
gox-build:
rm -rf out
mkdir -p out
gox -os="linux" -arch="amd64" -arch="386" -output="out/$(NAME)-{{.OS}}-{{.Arch}}" github.com/lomik/$(NAME)
ls -la out/
mkdir -p out/root/etc/$(NAME)/
./out/$(NAME)-linux-amd64 -config-print-default > out/root/etc/$(NAME)/$(NAME).conf
fpm-deb:
make fpm-build-deb ARCH=amd64
make fpm-build-deb ARCH=386
fpm-rpm:
make fpm-build-rpm ARCH=amd64
make fpm-build-rpm ARCH=386
fpm-build-deb:
fpm -s dir -t deb -n $(NAME) -v $(VERSION) \
--deb-priority optional --category admin \
--force \
--deb-compression bzip2 \
--url https://github.com/lomik/$(NAME) \
--description $(DESCRIPTION) \
-m $(MAINTAINER) \
--license "MIT" \
-a $(ARCH) \
--config-files /etc/$(NAME)/$(NAME).conf \
out/$(NAME)-linux-$(ARCH)=/usr/bin/$(NAME) \
deploy/systemd/$(NAME).service=/usr/lib/systemd/system/$(NAME).service \
out/root/=/
fpm-build-rpm:
fpm -s dir -t rpm -n $(NAME) -v $(VERSION) \
--force \
--rpm-compression bzip2 --rpm-os linux \
--url https://github.com/lomik/$(NAME) \
--description $(DESCRIPTION) \
-m $(MAINTAINER) \
--license "MIT" \
-a $(ARCH) \
--config-files /etc/$(NAME)/$(NAME).conf \
out/$(NAME)-linux-$(ARCH)=/usr/bin/$(NAME) \
deploy/systemd/$(NAME).service=/usr/lib/systemd/system/$(NAME).service \
out/root/=/