-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
66 lines (53 loc) · 1.5 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
BUILD_DIR = ./out/bin
INSTALL_DIR = /usr/local/bin
CMD_SOURCE_DIRS = cmd
SOURCE_DIRS = cmd pkg
SKPROXY_SRC = ./cmd/skproxy/skproxy.go
SKPROXY_OBJ = skproxy
SKCTL_SRC = ./cmd/skctl/skctl.go
SKCTL_OBJ = skctl
SKAGENT_SRC = ./cmd/skagent/skagent.go
SKAGENT_OBJ = skagent
SKPILOT_SRC = ./cmd/skpilot/skpilot.go
SKPILOT_OBJ = skpilot
PROTO_GEN_DIR = ./pkg/proto
PROTO_SCRIPT = kuberboat/scripts/proto_gen.sh
SCRIPTS_DIR = ./scripts
SHFMT_FLAG = shfmt
XARGS_FLAG = xargs
$(shell mkdir -p $(BUILD_DIR))
export GO111MODULE := on
export GOPROXY := https://mirrors.aliyun.com/goproxy/,direct
all: proto skproxy skctl skpilot skagent install
skproxy: $(SKPROXY_SRC)
@go build -o $(BUILD_DIR)/$(SKPROXY_OBJ) $(SKPROXY_SRC)
.PHONY: image
image:
$(SCRIPTS_DIR)/skproxy/build-image.sh
skctl: $(SKCTL_SRC)
@go build -o $(BUILD_DIR)/$(SKCTL_OBJ) $(SKCTL_SRC)
skpilot: $(SKPILOT_SRC)
@go build -o $(BUILD_DIR)/$(SKPILOT_OBJ) $(SKPILOT_SRC)
skagent: $(SKAGENT_SRC)
@go build -o $(BUILD_DIR)/$(SKAGENT_OBJ) $(SKAGENT_SRC)
.PHONY: install
install:
cp $(BUILD_DIR)/$(SKPROXY_OBJ) $(INSTALL_DIR)
cp $(BUILD_DIR)/$(SKCTL_OBJ) $(INSTALL_DIR)
cp $(BUILD_DIR)/$(SKAGENT_OBJ) $(INSTALL_DIR)
cp $(BUILD_DIR)/$(SKPILOT_OBJ) $(INSTALL_DIR)
cp $(SCRIPTS_DIR)/skafos-iptables.sh $(INSTALL_DIR)
.PHONY: proto
proto:
rm -rf $(PROTO_GEN_DIR)
./$(PROTO_SCRIPT)
.PHONY: fmt
fmt:
@gofmt -s -w $(SOURCE_DIRS)
$(SHFMT_FLAG) -f . | $(XARGS_FLAG) $(SHFMT_FLAG) -w
.PHONY: stop
stop:
$(SCRIPTS_DIR)/stop.sh
.PHONY: clean
clean:
rm -rf $(BUILD_DIR)