-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
55 lines (48 loc) · 1.29 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
NAME := psql-streamer
MAINTAINER:= Igor Novgorodov <igor@novg.net>
DESCRIPTION := Service for streaming PostgreSQL events
LICENSE := MPLv2
GO ?= go
VERSION := $(shell cat VERSION)
OUT := .out
PACKAGE := github.com/blind-oracle/$(NAME)
all: build
build:
rm -rf $(OUT)
mkdir -p $(OUT)/root/etc/$(NAME)
cp $(NAME).toml $(OUT)/root/etc/$(NAME)
go test ./...
GOARCH=amd64 GOOS=linux $(GO) build -o $(OUT) -ldflags "-s -w -X main.version=$(VERSION)"
deb:
make build
make build-deb ARCH=amd64
rpm:
make build
make build-rpm ARCH=amd64
build-deb:
fpm -s dir -t deb -n $(NAME) -v $(VERSION) \
--deb-priority optional \
--category admin \
--force \
--url https://$(PACKAGE) \
--description "$(DESCRIPTION)" \
-m "$(MAINTAINER)" \
--license "$(LICENSE)" \
-a $(ARCH) \
$(OUT)/$(NAME)=/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).toml \
$(OUT)/$(NAME)=/usr/bin/$(NAME) \
deploy/$(NAME).service=/usr/lib/systemd/system/$(NAME).service \
$(OUT)/root/=/