-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
138 lines (125 loc) · 4.85 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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#
# Files and directories
#
WORKDIR ?= $(CURDIR)
IMPLDIR ?= $(WORKDIR)/impl
IMAGESDIR ?= $(WORKDIR)/images
RESULTSDIR ?= $(WORKDIR)/results
PLOT ?= $(WORKDIR)/$(notdir $(WORKDIR)).svg
#
# Arguments
#
NGINX_VERSION ?= 1.15.6
REDIS_VERSION ?= 5.0.6
KRAFT_IMAGE ?= unikraft/eurosys21-artifacts-kraft:latest
ARCH ?= x86_64
PLAT ?= kvm
#
# Tools
#
SNAKE ?= python3
DOCKER ?= docker
DRUN ?= $(DOCKER) run -it --rm \
-v $(1):/usr/src/unikraft/apps/app \
-w /usr/src/unikraft/apps/app $(KRAFT_IMAGE) $(2)
#
# Targets
#
.PHONY: all
all: prepare run plot
.PHONY: prepare
prepare: unikraft
$(DOCKER) pull olivierpierre/hermitux
$(DOCKER) pull nginx:$(NGINX_VERSION)-alpine
$(DOCKER) pull redis:$(REDIS_VERSION)-alpine
$(DOCKER) pull hlefeuvre/alpine-sqlite
$(DOCKER) pull hlefeuvre/rump
$(DOCKER) pull hlefeuvre/osv
.PHONY: unikraft
unikraft: unikraft-helloworld unikraft-nginx unikraft-redis unikraft-sqlite
.PHONY: unikraft-helloworld
unikraft-helloworld:
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft [email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v configure -m $(ARCH) -p $(PLAT) -F)
$(call DRUN,$(IMPLDIR)/$@,kraft build)
cp $(IMPLDIR)/$@/build/app_$(PLAT)-$(ARCH) $(IMAGESDIR)/$@
.PHONY: unikraft-nginx
unikraft-nginx:
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft [email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/pcre@5f7140e)
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v configure -m $(ARCH) -p $(PLAT) -F)
$(call DRUN,$(IMPLDIR)/$@,kraft build)
cp $(IMPLDIR)/$@/build/app_$(PLAT)-$(ARCH) $(IMAGESDIR)/$@
.PHONY: unikraft-redis
unikraft-redis:
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft [email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft [email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v configure -m $(ARCH) -p $(PLAT) -F)
$(call DRUN,$(IMPLDIR)/$@,kraft build)
cp $(IMPLDIR)/$@/build/app_$(PLAT)-$(ARCH) $(IMAGESDIR)/$@
.PHONY: unikraft-sqlite
unikraft-sqlite:
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft [email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v list pull -w .unikraft lib/[email protected])
$(call DRUN,$(IMPLDIR)/$@,kraft -v configure -m $(ARCH) -p $(PLAT) -F)
$(call DRUN,$(IMPLDIR)/$@,kraft build)
cp $(IMPLDIR)/$@/build/app_$(PLAT)-$(ARCH) $(IMAGESDIR)/$@
.PHONY: run
run:
mkdir -p $(RESULTSDIR)
$(IMPLDIR)/hermitux-light-size.sh
$(IMPLDIR)/hermitux-size.sh
$(IMPLDIR)/lupine-size.sh
$(IMPLDIR)/mirage-size.sh
$(IMPLDIR)/native-size.sh
$(IMPLDIR)/osv-size.sh
$(IMPLDIR)/rump-size.sh
$(IMPLDIR)/unikraft-size.sh
.PHONY: plot
plot:
PYTHONPATH=$(WORKDIR)/../common $(SNAKE) $(WORKDIR)/plot.py --data $(RESULTSDIR) --output $(PLOT)
.PHONY: clean
clean:
$(RM) -rf $(IMPLDIR)/mirage-helloworld/_build
$(RM) -rf $(IMPLDIR)/mirage-helloworld/.merlin
$(RM) -rf $(IMPLDIR)/mirage-helloworld/.mirage.config
$(RM) -rf $(IMPLDIR)/mirage-helloworld/dune
$(RM) -rf $(IMPLDIR)/mirage-helloworld/dune-project
$(RM) -rf $(IMPLDIR)/mirage-helloworld/dune.build
$(RM) -rf $(IMPLDIR)/mirage-helloworld/dune.config
$(RM) -rf $(IMPLDIR)/mirage-helloworld/key_gen.ml
$(RM) -rf $(IMPLDIR)/mirage-helloworld/main.ml
$(RM) -rf $(IMPLDIR)/mirage-helloworld/Makefile
$(RM) -rf $(IMPLDIR)/mirage-helloworld/*.opam
$(RM) -rf $(IMPLDIR)/mirage-helloworld/myocamlbuild.ml
$(RM) -rf $(IMPLDIR)/unikraft-helloworld/build
$(RM) -rf $(IMPLDIR)/unikraft-helloworld/.config
$(RM) -rf $(IMPLDIR)/unikraft-helloworld/.unikraft
$(RM) -rf $(IMPLDIR)/unikraft-nginx/build
$(RM) -rf $(IMPLDIR)/unikraft-nginx/.config
$(RM) -rf $(IMPLDIR)/unikraft-nginx/.unikraft
$(RM) -rf $(IMPLDIR)/unikraft-redis/build
$(RM) -rf $(IMPLDIR)/unikraft-redis/.config
$(RM) -rf $(IMPLDIR)/unikraft-redis/.unikraft
$(RM) -rf $(IMPLDIR)/unikraft-sqlite/build
$(RM) -rf $(IMPLDIR)/unikraft-sqlite/.config
$(RM) -rf $(IMPLDIR)/unikraft-sqlite/.unikraft
.PHONY: properclean
properclean:
$(DOCKER) rmi olivierpierre/hermitux
$(DOCKER) rmi nginx:$(NGINX_VERSION)-alpine
$(DOCKER) rmi redis:$(REDIS_VERSION)-alpine
$(DOCKER) rmi hlefeuvre/alpine-sqlite
$(DOCKER) rmi hlefeuvre/rump
$(DOCKER) rmi hlefeuvre/osv