1 Star 0 Fork 0

林永吉/falcon-plus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Makefile 3.35 KB
一键复制 编辑 原始数据 按行查看 历史
CMD = agent aggregator graph hbs judge nodata transfer gateway api alarm
TARGET = open-falcon
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
GOFMT ?= gofmt "-s"
VERSION := $(shell cat VERSION)
all: $(CMD) $(TARGET)
.PHONY: misspell-check
misspell-check:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go get -u github.com/client9/misspell/cmd/misspell; \
fi
misspell -error $(GOFILES)
.PHONY: misspell
misspell:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go get -u github.com/client9/misspell/cmd/misspell; \
fi
misspell -w $(GOFILES)
install:
@hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go get -u github.com/kardianos/govendor; \
fi
govendor sync
vet:
go vet $(PACKAGES)
fmt:
$(GOFMT) -w $(GOFILES)
.PHONY: fmt-check
fmt-check:
# get all go files and run go fmt on them
@diff=$$($(GOFMT) -d $(GOFILES)); \
if [ -n "$$diff" ]; then \
echo "Please run 'make fmt' and commit the result:"; \
echo "$${diff}"; \
exit 1; \
fi;
$(CMD):
if [ $@ = "gateway" ]; then \
go build -ldflags "-X main.BinaryName=gateway -X main.GitCommit=`git rev-parse --short HEAD` -X main.Version=$(VERSION)" \
-o bin/gateway/falcon-gateway ./modules/transfer ; \
else \
go build -ldflags "-X main.BinaryName=$@ -X main.GitCommit=`git rev-parse --short HEAD` -X main.Version=$(VERSION)" \
-o bin/$@/falcon-$@ ./modules/$@ ; \
fi
.PHONY: $(TARGET)
$(TARGET): $(GOFILES)
go build -ldflags "-X main.BinaryName=Open-Falcon -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)
@(cd ./out && mkdir -p ./agent/plugin && ln -s ./agent/plugin/ ./plugin)
@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
pack4docker: 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)
@(cd ./out && mkdir -p ./agent/plugin && ln -s ./agent/plugin/ ./plugin)
@cp -r ./modules/api/data ./out/api/
@mkdir out/graph/data
@bash ./docker/confgen4docker.sh
@cp ./docker/ctrl.sh ./out/ && chmod +x ./out/ctrl.sh
@cp $(TARGET) ./out/$(TARGET)
tar -C out -zcf open-falcon-v$(VERSION).tar.gz .
@rm -rf out
.PHONY: test
test:
@go test ./modules/api/test
clean:
@rm -rf ./bin
@rm -rf ./out
@rm -rf ./$(TARGET)
@rm -rf open-falcon-v$(VERSION).tar.gz
.PHONY: clean all agent aggregator graph hbs judge nodata transfer gateway api alarm
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/yulifu/falcon-plus.git
git@gitee.com:yulifu/falcon-plus.git
yulifu
falcon-plus
falcon-plus
master

搜索帮助