1 Star 0 Fork 0

代号大灰狼/chaosblade-exec-cloud

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Makefile 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
camix 提交于 2023-07-15 11:18 . Update Makefile
.PHONY: build clean
BLADE_SRC_ROOT=$(shell pwd)
GO_ENV=CGO_ENABLED=1
GO_MODULE=GO111MODULE=on
GO=env $(GO_ENV) $(GO_MODULE) go
GO_FLAGS=-ldflags="-s -w"
UNAME := $(shell uname)
ifeq ($(BLADE_VERSION), )
BLADE_VERSION=1.7.3
endif
BUILD_TARGET=target
BUILD_TARGET_DIR_NAME=chaosblade-$(BLADE_VERSION)
BUILD_TARGET_PKG_DIR=$(BUILD_TARGET)/chaosblade-$(BLADE_VERSION)
BUILD_TARGET_BIN=$(BUILD_TARGET_PKG_DIR)/bin
BUILD_TARGET_YAML=$(BUILD_TARGET_PKG_DIR)/yaml
BUILD_IMAGE_PATH=build/image/blade
# cache downloaded file
BUILD_TARGET_CACHE=$(BUILD_TARGET)/cache
CLOUD_YAML_FILE_NAME=chaosblade-cloud-spec-$(BLADE_VERSION).yaml
CLOUD_YAML_FILE_PATH=$(BUILD_TARGET_YAML)/$(CLOUD_YAML_FILE_NAME)
ifeq ($(GOOS), linux)
GO_FLAGS=-ldflags="-linkmode external -extldflags -static -s -w"
endif
# build cloud
build: pre_build build_yaml build_cloud
pre_build:
rm -rf $(BUILD_TARGET_PKG_DIR) $(BUILD_TARGET_PKG_FILE_PATH)
mkdir -p $(BUILD_TARGET_BIN) $(BUILD_TARGET_YAML)
build_yaml: build/spec.go
$(GO) run $< $(CLOUD_YAML_FILE_PATH)
build_cloud: main.go
$(GO) build $(GO_FLAGS) -o $(BUILD_TARGET_BIN)/chaos_cloud $<
# build chaosblade linux version by docker image
build_linux:
docker build -f build/image/musl/Dockerfile -t chaosblade-cloud-build-musl:latest build/image/musl
docker run --rm \
-v $(shell echo -n ${GOPATH}):/go \
-v $(BLADE_SRC_ROOT):/chaosblade-exec-cloud \
-w /chaosblade-exec-cloud \
chaosblade-cloud-build-musl:latest
# test
test:
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
# clean all build result
clean:
go clean ./...
rm -rf $(BUILD_TARGET)
rm -rf $(BUILD_IMAGE_PATH)/$(BUILD_TARGET_DIR_NAME)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kissley/chaosblade-exec-cloud.git
git@gitee.com:kissley/chaosblade-exec-cloud.git
kissley
chaosblade-exec-cloud
chaosblade-exec-cloud
main

搜索帮助