-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (54 loc) · 1.95 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
58
59
60
61
62
63
64
65
66
67
PREFIX=/opt/hooto/tracker
CC=go
CARGS=build
CFLAGS=""
PROTOC_CMD = protoc
PROTOC_ARGS = --proto_path=./hapi/ --go_opt=paths=source_relative --go_out=./hapi/ --go-grpc_out=./hapi/ ./hapi/stats.proto
BUILDCOLOR="\033[34;1m"
BINCOLOR="\033[37;1m"
ENDCOLOR="\033[0m"
ifndef V
QUIET_BUILD = @printf '%b %b\n' $(BUILDCOLOR)BUILD$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) 1>&2;
QUIET_INSTALL = @printf '%b %b\n' $(BUILDCOLOR)INSTALL$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) 1>&2;
endif
all: hooto-tracker
@echo ""
@echo "build complete"
@echo ""
install: install_init install_bin install_static install_systemd
@echo ""
@echo "install complete"
@echo ""
hooto-tracker:
$(QUIET_BUILD)$(PROTOC_CMD) $(PROTOC_ARGS) $(CCLINK)
$(QUIET_BUILD)$(CC) $(CARGS) -o ./bin/hooto-tracker ./cmd/server/main.go$(CCLINK)
burn:
$(QUIET_BUILD)$(CC) $(CARGS) -o ./bin/burn vendor/github.com/spiermar/burn/main.go$(CCLINK)
install_init:
# mkdir -p $(PREFIX)/{etc,bin,var/tracker_db,var/log,var/tmp,webui,misc,deps/FlameGraph}
mkdir -p $(PREFIX)/etc
mkdir -p $(PREFIX)/bin
mkdir -p $(PREFIX)/var/tracker_db
mkdir -p $(PREFIX)/var/log
mkdir -p $(PREFIX)/var/tmp
mkdir -p $(PREFIX)/webui
mkdir -p $(PREFIX)/misc
mkdir -p $(PREFIX)/deps/FlameGraph
install_bin:
$(QUIET_INSTALL)
install bin/hooto-tracker $(PREFIX)/bin/hooto-tracker$(CCLINK)
# install bin/burn $(PREFIX)/bin/burn
install_static:
$(QUIET_INSTALL)
rsync -av --include="*/" --include="*.js" --include="*.css" --include="*.tpl" --exclude="*" ./webui/ $(PREFIX)/webui/
rsync -av --include="*/" --include="*.png" --exclude="*" ./webui/htracker/img/ $(PREFIX)/webui/htracker/img/
sed -i 's/debug:\ true/debug:\ false/g' $(PREFIX)/webui/htracker/js/main.js
rsync -av misc/* $(PREFIX)/misc/
rsync -av deps/FlameGraph/*.pl $(PREFIX)/deps/FlameGraph/
install_systemd:
$(QUIET_INSTALL)
install misc/systemd/systemd.service /lib/systemd/system/hooto-tracker.service
systemctl daemon-reload
clean:
rm -f ./bin/hooto-tracker
# rm -f ./bin/burn