forked from gvengel/exim_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (29 loc) · 932 Bytes
/
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
.PHONY: all fmt vet test build build-deb clean
all: fmt vet test build build-deb
GOOS ?= linux
ARCH ?= amd64
TAGS ?= systemd
VERSION = $(shell dpkg-parsechangelog --show-field Version)
REVISION = $(shell git rev-parse --short HEAD)
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
LDFLAGS = -X github.com/prometheus/common/version.Version=$(VERSION) \
-X github.com/prometheus/common/version.Revision=$(REVISION) \
-X github.com/prometheus/common/version.Branch=$(BRANCH)
TMP_DIR := $(shell mktemp -d)
BUILD_DIR := $(TMP_DIR)/build
fmt:
go fmt .
vet:
go vet .
test:
go test -v .
build:
GOOS=$(GOOS) GOARCH=$(ARCH) go build -v -o exim_exporter -tags $(TAGS) -ldflags "$(LDFLAGS)" .
build-deb:
mkdir $(BUILD_DIR)
cp exim_exporter $(BUILD_DIR)/prometheus-exim-exporter
cp -r debian/ $(BUILD_DIR)
cd $(BUILD_DIR); debuild -us -uc
cp $(TMP_DIR)/*.deb .
clean:
rm -f exim_exporter prometheus-exim-exporter_*.deb