-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.makefile
116 lines (94 loc) · 3.43 KB
/
common.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
PROJ_DIR := $(shell git rev-parse --show-toplevel)
NPROC := $(shell nproc)
SCALE ?= 1
REMOTES ?=
DEBUG_WORKSPACEFS ?= 0
ITERATIONS ?= 10
DOCKER_OPTIONS ?=
TEST_OPTIONS ?=
TOOLS_IMAGE := masnagam/concc-tools
TOOLS_BUILD_OPTIONS ?=
TIME := /usr/bin/time
TIME_TOTAL := $(TIME) -p
TIME_CLIENT ?=
TIME_WORKER ?=
TIME_NONDIST ?=
TIME_ICECC ?=
METRICS_DIR := workspace/metrics
METRICS_JSON_PY := ../../scripts/metrics-json.py
METRICS_HTML_PY := ../../scripts/metrics-html.py
.PHONY: all
all: build
.PHONY: build
build: JOBS ?= $$(concc-worker-pool limit)
build: buildenv workspace workspace/workspacefs.override.yaml
@#sudo sh -c 'echo 3 >/proc/sys/vm/drop_caches'
concc-boot -C workspace -i $(BUILDENV) -s scripts -l concc -C src '$(CONFIGURE_CMD)'
concc-boot -C workspace -i $(BUILDENV) -s scripts -w '$(REMOTES)' $(TEST_OPTIONS) concc -C src '$(TIME_TOTAL) $(BUILD_CMD)'
.PHONY: nondist-build
nondist-build: JOBS ?= $(NPROC)
nondist-build: buildenv workspace
@#sudo sh -c 'echo 3 >/proc/sys/vm/drop_caches'
concc-boot -C workspace -i $(BUILDENV) -s scripts -l concc -C src '$(NONDIST_CONFIGURE_CMD)'
concc-boot -C workspace -i $(BUILDENV) -s scripts -l $(TEST_OPTIONS) concc -C src '$(TIME_TOTAL) $(NONDIST_BUILD_CMD)'
.PHONY: icecc-build
icecc-build: JOBS ?= 32
icecc-build: buildenv workspace
@#sudo sh -c 'echo 3 >/proc/sys/vm/drop_caches'
concc-boot -C workspace -i $(BUILDENV) -s scripts -l concc -C src '$(ICECC_CONFIGURE_CMD)'
concc-boot -C workspace -i $(BUILDENV) -s scripts --icecc -w '$(REMOTES)' $(TEST_OPTIONS) concc -C src -l '$(TIME_TOTAL) $(ICECC_BUILD_CMD)'
.PHONY: check
check: build
concc-boot -C workspace -i $(BUILDENV) -s scripts concc -C src '$(CHECK_CMD)'
METRICS_HTML_HBS := ../metrics.html.hbs
CONCC_METRICS_FILES := $(addprefix $(METRICS_DIR)/,client.json worker.json)
NONDIST_METRICS_FILES := $(addprefix $(METRICS_DIR)/,nondist.json)
METRICS_FILES := $(CONCC_METRICS_FILES) $(NONDIST_METRICS_FILES)
.PHONY: metrics
metrics: $(METRICS_DIR)/index.html
.PHONY: concc-metrics
concc-metrics: $(CONCC_METRICS_FILES)
.PHONY: nondist-metrics
nondist-metrics: $(NONDIST_METRICS_FILES)
$(METRICS_DIR)/index.html: $(METRICS_HTML_PY) $(METRICS_FILES)
cat $(METRICS_FILES) | python3 $(METRICS_HTML_PY) >$@
$(METRICS_DIR)/client.times $(METRICS_DIR)/worker.times: | $(METRICS_DIR)
@for i in $(shell seq $(ITERATIONS)); \
do \
$(MAKE) -e clean; \
$(MAKE) -e build \
TIME_CLIENT='$(TIME) -v -a -o /$(METRICS_DIR)/client.times' \
TIME_WORKER='$(TIME) -v -a -o /$(METRICS_DIR)/worker.times'; \
done
$(METRICS_DIR)/nondist.times: | $(METRICS_DIR)
@for i in $(shell seq $(ITERATIONS)); \
do \
$(MAKE) -e clean; \
$(MAKE) -e nondist-build \
TIME_NONDIST='$(TIME) -v -a -o /$(METRICS_DIR)/nondist.times'; \
done
$(METRICS_DIR)/%.json: $(METRICS_DIR)/%.times $(METRICS_JSON_PY)
cat $< | python3 $(METRICS_JSON_PY) $(basename $(notdir $<)) >$@
# You NEED to run `docker image prune` if you want to remove dangling images.
.PHONY: clean-all
clean-all: clean
rm -rf workspace
docker image rm -f $(BUILDENV)
$(MAKE) -C ../../docker clean
.PHONY: clean
clean: src-clean
concc-boot -C workspace -i $(BUILDENV) -w '$(REMOTES)' --clean
.PHONY: src-clean
src-clean:
-$(SRC_CLEAN_CMD)
.PHONY: metrics-clean
metrics-clean:
rm -rf workspace/metrics
.PHONY: buildenv
buildenv: images
docker buildx build -t $(BUILDENV) $(BUILDENV_BUILD_OPTIONS) .
.PHONY: images
images:
$(MAKE) -C ../../docker
workspace/metrics: | workspace
mkdir workspace/metrics