forked from Cepave/open-falcon-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (41 loc) · 1.57 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
SHELL := /bin/bash
TARGET_SOURCE = $(shell find main.go g commands -name '*.go')
CMD = aggregator graph hbs judge nodata query sender task transfer fe alarm agent
TARGET = open-falcon
VERSION?=$(shell awk -F\" '/^const Version/ { print $$2; exit }' ./g/version.go)
all: $(CMD) $(TARGET)
$(CMD):
go build -o bin/$@/falcon-$@ ./modules/$@
$(TARGET): $(TARGET_SOURCE)
go build -o open-falcon
# dev creates binaries for testing locally - these are put into ./bin and $GOPATH
dev: format
@CONSUL_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"
test: format
@./scripts/test.sh
format:
@echo "--> Running go fmt"
@go fmt `go list ./...`
checkbin: bin/ config/ open-falcon cfg.json
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/query/js ./modules/query/conf/lambdaSetup.json ./out/query/config
@cp -r ./modules/fe/{static,views,scripts} ./out/fe/bin
@cp -r ./modules/alarm/{static,views} ./out/alarm/bin
@cp -r ./modules/agent/public ./out/agent/bin
@cp cfg.json ./out/cfg.json
@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 open-falcon-v$(VERSION).tar.gz
.PHONY: clean all aggregator graph hbs judge nodata query sender task transfer fe