forked from open-falcon/falcon-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (41 loc) · 1.51 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
SHELL := /bin/bash
TARGET_SOURCE = $(shell find main.go g cmd common -name '*.go')
CMD = agent aggregator graph hbs judge nodata transfer gateway api alarm
TARGET = open-falcon
VERSION := $(shell cat VERSION)
all: trash $(CMD) $(TARGET)
$(CMD):
go get ./modules/$@
go build -o bin/$@/falcon-$@ ./modules/$@
$(TARGET): $(TARGET_SOURCE)
go build -ldflags "-X main.GitCommit=`git rev-parse --short HEAD` -X main.Version=$(VERSION)" -o open-falcon
checkbin: bin/ config/ open-falcon
pack: checkbin
@if [ -e out ] ; then rm -rf out; fi
@mkdir out
@$(foreach var,$(CMD),mkdir -p ./out/$(var)/bin;)
@$(foreach var,$(CMD),mkdir -p ./out/$(var)/config;)
@$(foreach var,$(CMD),mkdir -p ./out/$(var)/logs;)
@$(foreach var,$(CMD),cp ./config/$(var).json ./out/$(var)/config/cfg.json;)
@$(foreach var,$(CMD),cp ./bin/$(var)/falcon-$(var) ./out/$(var)/bin;)
@cp -r ./modules/agent/public ./out/agent/
@(cd ./out && ln -s ./agent/public/ ./public)
@cp -r ./modules/agent/plugins ./out/agent/
@(cd ./out && ln -s ./agent/plugins/ ./plugins)
@cp -r ./modules/api/data ./out/api/
@mkdir out/graph/data
@bash ./config/confgen.sh
@cp $(TARGET) ./out/$(TARGET)
tar -C out -zcf open-falcon-v$(VERSION).tar.gz .
@rm -rf out
clean:
@rm -rf ./bin
@rm -rf ./out
@rm -rf ./$(TARGET)
@rm -rf ./package_cache_tmp
@rm -rf ./vendor
@rm -rf open-falcon-v$(VERSION).tar.gz
trash:
go get -u github.com/rancher/trash
trash -k -cache package_cache_tmp
.PHONY: trash clean all agent aggregator graph hbs judge nodata transfer gateway api alarm