-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
46 lines (34 loc) · 1.1 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
.PHONY: build clean
GO_ENV=CGO_ENABLED=1
GO_MODULE=GO111MODULE=on
GO=env $(GO_ENV) $(GO_MODULE) go
UNAME := $(shell uname)
ifeq ($(BLADE_VERSION), )
BLADE_VERSION=1.7.4
endif
BUILD_TARGET=target
BUILD_TARGET_DIR_NAME=chaosblade-$(BLADE_VERSION)
BUILD_TARGET_PKG_DIR=$(BUILD_TARGET)/chaosblade-$(BLADE_VERSION)
BUILD_TARGET_YAML=$(BUILD_TARGET_PKG_DIR)/yaml
BUILD_IMAGE_PATH=build/image/blade
CRI_OS_YAML_FILE_NAME=chaosblade-cri-spec-$(BLADE_VERSION).yaml
CRI_OS_YAML_FILE_PATH=$(BUILD_TARGET_YAML)/$(CRI_OS_YAML_FILE_NAME)
CHAOSBLADE_PATH=build/cache/chaosblade
ifeq ($(GOOS), linux)
GO_FLAGS=-ldflags="-linkmode external -extldflags -static"
endif
build: pre_build build_yaml
build_linux: build
pre_build:
rm -rf $(BUILD_TARGET_PKG_DIR)
mkdir -p $(BUILD_TARGET_YAML)
build_yaml: build/spec.go
$(GO) run $< $(CRI_OS_YAML_FILE_PATH) cri $(CHAOSBLADE_PATH)/yaml/chaosblade-jvm-spec-$(BLADE_VERSION).yaml
# 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)