-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
51 lines (37 loc) · 1.01 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
.PHONY: all clean-all build cleand-deps deps ver
DATE := $(shell git log -1 --format="%cd" --date=short | sed s/-//g)
COUNT := $(shell git rev-list --count HEAD)
COMMIT := $(shell git rev-parse --short HEAD)
BINARYNAME := zabbix-agent-extension-kannel
CONFIG := ${BINARYNAME}.conf
VERSION := "${DATE}.${COUNT}_${COMMIT}"
LDFLAGS := "-X main.version=${VERSION}"
default: all
all: clean-all deps build
ver:
@echo ${VERSION}
clean-all: clean-deps
@echo Clean builded binaries
rm -rf .out/
@echo Done
build:
@echo Build
ln -s ${PWD}/vendor/ ${PWD}/vendor/src
GOPATH="${PWD}/vendor" go build -v -o .out/${BINARYNAME} -ldflags ${LDFLAGS} *.go
@echo Done
clean-deps:
@echo Clean dependencies
rm -rf vendor/*
deps:
@echo Fetch dependencies
git submodule update --init
install:
@echo Install
cp .out/${BINARYNAME} /usr/bin/${BINARYNAME}
cp ${CONFIG} /etc/zabbix/zabbix_agentd.conf.d/${CONFIG}
@echo Done
remove:
@echo Remove
rm /usr/bin/${BINARYNAME}
rm /etc/zabbix/zabbix_agentd.conf.d/${CONFIG}
@echo Done