-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
61 lines (53 loc) · 1.5 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
NAME := riemann-relay
MAINTAINER:= Igor Novgorodov <igor@novg.net>
DESCRIPTION := Service for relaying Riemann events to Riemann/Carbon destinations
LICENSE := MPLv2
GO ?= go
DEP ?= dep
VERSION := $(shell cat VERSION)
OUT := .out
PACKAGE := github.com/blind-oracle/$(NAME)
all: build
build:
$(DEP) ensure
$(GO) build $(PACKAGE)
gox-build:
rm -rf $(OUT)
mkdir -p $(OUT)
gox -os="linux" -arch="amd64" -output="$(OUT)/$(NAME)-{{.OS}}-{{.Arch}}" -ldflags "-s -w -X main.version=$(VERSION)" $(PACKAGE)
mkdir -p $(OUT)/root/etc/$(NAME)
cp riemann-relay.conf $(OUT)/root/etc/$(NAME)/$(NAME).conf
deb:
make gox-build
make build-deb ARCH=amd64
rpm:
make gox-build
make build-rpm ARCH=amd64
build-deb:
fpm -s dir -t deb -n $(NAME) -v $(VERSION) \
--deb-priority optional \
--category admin \
--force \
--deb-compression bzip2 \
--url https://$(PACKAGE) \
--description "$(DESCRIPTION)" \
-m "$(MAINTAINER)" \
--license "$(LICENSE)" \
-a $(ARCH) \
$(OUT)/$(NAME)-linux-$(ARCH)=/usr/bin/$(NAME) \
deploy/$(NAME).service=/usr/lib/systemd/system/$(NAME).service \
$(OUT)/root/=/
build-rpm:
fpm -s dir -t rpm -n $(NAME) -v $(VERSION) \
--force \
--rpm-compression bzip2 \
--rpm-os linux \
--url https://$(PACKAGE) \
--description "$(DESCRIPTION)" \
-m "$(MAINTAINER)" \
--license "$(LICENSE)" \
-a $(ARCH) \
--config-files /etc/$(NAME)/$(NAME).conf \
$(OUT)/$(NAME)-linux-$(ARCH)=/usr/bin/$(NAME) \
deploy/$(NAME).service=/usr/lib/systemd/system/$(NAME).service \
$(OUT)/root/=/