-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
111 lines (97 loc) · 2.41 KB
/
Makefile
File metadata and controls
111 lines (97 loc) · 2.41 KB
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
#
# Directories
#
WORKDIR ?= $(CURDIR)
#
# Parameters
#
KRAFT_TOKEN ?=
#
# General configuration
#
REG ?= ghcr.io
ORG ?= project-flexos
EXPS ?= fig-06_nginx-redis-perm \
fig-07_nginx-redis-normalized \
fig-08_config-poset \
fig-09_iperf-throughput \
fig-10_sqlite-exec-time \
fig-11_flexos-alloc-latency \
tab-01_porting-effort
IMAGES ?= flexos-base \
nginx \
redis \
flexos-ae-plot \
flexos-ae-base
TARGETS ?= prepare \
run \
plot \
clean \
properclean
#
# Utility vars
#
# Prefix each docker image with `docker-` so it has a unique phony target
DIMAGES := $(addprefix docker-,$(IMAGES))
Q ?= @
#
# Tools
#
DOCKER ?= docker
CURL ?= curl
#
# Find shortname for experiment
#
# Params:
# $1: The canonical name of the experiment, e.g. `fig-XX_short-desc`
# $2: The desired returning element, 1 for `fig-XX` and 2 for `short-desc`
#
underscore = $(word $(2),$(subst _, ,$(1)))
#
# Create a new experiment target
#
# Params:
# $1: The common API target, e.g. `prepare`
# $2: The canonical name of the experiment, e.g. `fig-XX_short-name`
#
define create-exp-target
.PHONY: $(1)
$(1): $(1)-$(2)
.PHONY: $(2)
$(2): $(1)
.PHONY: $(1)-$(2)
$$(call underscore,$(2),1): $(1)-$(2)
$(1)-$$(call underscore,$(2),1): $(1)-$(2)
$(1)-$(2):
$(Q)$(MAKE) -C $(WORKDIR)/experiments/$(2) $(1)
endef
#
# Targets
#
.PHONY: all
all: prepare run plot
.PHONY: prepare
prepare: docker
# Iterate over all experiments and all targets and provide an entrypoint for
# each, e.g. `prepare-fig-XX_short-desc` and `prepare-fig-XX`.
$(foreach EXP,$(EXPS), \
$(foreach TARGET,$(TARGETS),$(eval $(call create-exp-target,$(TARGET),$(EXP))) \
))
.PHONY: docker
docker: $(DIMAGES)
.PHONY: $(DIMAGES)
$(DIMAGES): TAG ?= latest
$(DIMAGES):
$(Q)$(DOCKER) build \
--tag $(REG)/$(ORG)/$(@:docker-%=%):$(TAG) \
--build-arg UK_KRAFT_GITHUB_TOKEN="$(KRAFT_TOKEN)" \
--file $(WORKDIR)/support/dockerfiles/Dockerfile.$(@:docker-%=%) \
$(WORKDIR)/support/dockerfiles
# Prepare the final Zenodo archive
zenodo:
mkdir -p $(WORKDIR)/repositories
# clone all repos in the flexos organization
cd $(WORKDIR)/repositories && \
$(CURL) -s https://github.com:@api.github.com/orgs/${ORG}/repos?per_page=200 | \
jq .[].ssh_url | xargs -n 1 git clone
tar -czf $(WORKDIR)/../flexos-asplos22-ae.tar.gz $(WORKDIR)