-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (39 loc) · 1.31 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
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
.PHONY: mtop climber mctl
all: mtop climber mctl
export GIT_COMMIT=$(shell git rev-list -1 HEAD)
GOFLAGS=-ldflags "-X github.com/wikylyu/mtop/config.PREFIX=$(PREFIX) -X main.AppCommit=$(GIT_COMMIT)"
mtop:
CGO_ENABLED=0 go build $(GOFLAGS) -o bin/mtop
climber:
CGO_ENABLED=0 go build $(GOFLAGS) -o bin/climber climber/main.go
mctl:
CGO_ENABLED=0 go build $(GOFLAGS) -o bin/mctl mctl/main.go
dist: mtop climber mctl
tar -C bin/ -jcvf dist/mtop_linux64.tar.bz2 .
install-mtop:
mkdir -p $(PREFIX)/bin/
mkdir -p $(PREFIX)/etc/mtop/
install bin/mtop $(PREFIX)/bin/
install bin/mctl $(PREFIX)/bin/
cp -n script/mtop.yaml $(PREFIX)/etc/mtop/
install-climber:
mkdir -p $(PREFIX)/bin/
mkdir -p $(PREFIX)/etc/climber/
install bin/climber $(PREFIX)/bin/
cp -n script/climber.yaml $(PREFIX)/etc/climber/
uninstall-mtop:
rm $(PREFIX)/bin/mtop
rm $(PREFIX)/bin/mctl
rm -r $(PREFIX)/etc/mtop/
uninstall-climber:
rm $(PREFIX)/bin/climber
rm -r $(PREFIX)/etc/climber/
install-mtop-systemd:
cat script/mtop.service | MTOP_PATH=$(PREFIX)/bin/mtop envsubst > /etc/systemd/system/mtop.service
systemctl daemon-reload
install-climber-systemd:
cat script/climber.service | CLIMBER_PATH=$(PREFIX)/bin/climber envsubst > /etc/systemd/system/climber.service
systemctl daemon-reload