-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (49 loc) · 1.7 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
EXTENSION ?=
DIST_DIR ?= dist/
GOOS ?= linux
ARCH ?= $(shell uname -m)
BUILDINFOSDET ?=
SOFT_NAME := 1035-deezer
SOFT_VERSION := $(shell git describe --tags $(git rev-list --tags --max-count=1))
VERSION_PKG := $(shell echo $(SOFT_VERSION) | sed 's/^v//g')
ARCH := x86_64
LICENSE := MIT
URL := https://github.com/outout14/1035-deezer/
DESCRIPTION := Display your current Deezer listening over DNS
BUILDINFOS := ($(shell date +%FT%T%z)$(BUILDINFOSDET))
LDFLAGS := '-X main.version=$(SOFT_VERSION) -X main.buildinfos=$(BUILDINFOS)'
OUTPUT_SOFT := $(DIST_DIR)1035deezer-$(SOFT_VERSION)-$(GOOS)-$(ARCH)$(EXTENSION)
.PHONY: vet
vet:
go vet
.PHONY: prepare
prepare:
mkdir -p $(DIST_DIR)
.PHONY: clean
clean:
rm -rf $(DIST_DIR)
.PHONY: build
build: prepare
go build -ldflags $(LDFLAGS) -o $(OUTPUT_SOFT)
.PHONY: package-deb
package-deb: prepare
fpm -s dir -t deb -n $(SOFT_NAME) -v $(VERSION_PKG) \
--description "$(DESCRIPTION)" \
--url "$(URL)" \
--architecture $(ARCH) \
--license "$(LICENSE)" \
--package $(DIST_DIR) \
$(OUTPUT_SOFT)=/usr/bin/1035-deezer \
extra/config.example.json=/etc/1035-deezer/config.json \
extra/1035-deezer.service=/usr/lib/systemd/system/1035-deezer.service
.PHONY: package-rpm
package-rpm: prepare
fpm -s dir -t rpm -n $(SOFT_NAME) -v $(VERSION_PKG) \
--description "$(DESCRIPTION)" \
--url "$(URL)" \
--architecture $(ARCH) \
--license "$(LICENSE) "\
--package $(DIST_DIR) \
$(OUTPUT_SOFT)=/usr/bin/1035-deezer \
extra/config.example.json=/etc/1035-deezer/config.json \
extra/1035-deezer.service=/usr/lib/systemd/system/1035-deezer.service