-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.toml
240 lines (200 loc) · 7.53 KB
/
Makefile.toml
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# Copyright 2019 Steven Bosnick
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE-2.0 or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms
# This file extends the default cargo make Makefile.toml with three kinds of
# tasks: toplevel flows, build tasks and utility tasks.
#
# The build tasks are concerned with several variations of running "cargo xbuild"
# and with not running "cargo build" when "cargo xbuild" is what is called for.
# The differentiation between when to use "build" and when to use "xbuild" is
# done by whether or not the "XBUILD_TARGET" environment variable is set. The
# "XBUILD_TARGET" is also used as the "--target" parameter for "cargo xbuild".
#
# The toplevel flows are either development or CI flows that set "XBUILD_TARGET"
# then run the corresponding default development or CI flow.
#
# The utility tasks are concenred with installing the seL4 python dependencies,
# with init/end hooks that bracket parts of the log file, and with exporting the
# design documentation using "artifact".
#
# Developers running on their local machine are most likely interested in the
# following development flows:
# - dev-test-flow (from default Makefile.toml file)
# - dev-aarch64-test-flow
# - dev-arm7-test-flow
# - dev-x86_64-test-flow
#
# The tasks and flows from this Makefile.toml are extended or modified by the
# crate-specific Makefile.toml files in each of the crate directories. Those
# files may disable the xbuild tasks (i.e. elf-preload/Makefile.toml), or add
# another task to the CI flows. The sel4-plat-*/Makefile.toml files tie in one
# of the "xbuild" tasks defined in this file into the CI flow. The
# sel4-sys/Makefile.toml file, on the other hand, defines its own "xbuild" task
# and ties that into the CI flow.
#
# NOTE: If you are editing one of the Makefile.toml files please be very careful
# about the spelling of keywords. "cargo make" does not detect misspelled keywords
# and instead ignores them. This can lead to "carog make" appearing to work when it
# is really just skipping taks instead of running them which will make for a hard-to-
# diagnose problem. (This is based on experience.)
[env]
# Set the location for the targetspec files to the root of the project
RUST_TARGET_PATH = {script = ["git rev-parse --show-toplevel"]}
# Set the version of artifact to use
ARTIFACT_VERSION = "2.1.5"
# Set the directory to which to export the design documentation
ART_EXPORT_DIR = "target/design"
#####################
# Development Flows #
#####################
# Add development flows for the xbuild targets
[tasks.dev-aarch64-test-flow]
description = "Development testing flow for aarch64"
category = "Development"
env = { "XBUILD_TARGET" = "aarch64-unknown-none-elf" }
run_task = "dev-test-flow"
[tasks.dev-armv7-test-flow]
description = "Development testing flow for armv7"
category = "Development"
env = { "XBUILD_TARGET" = "armv7-unknown-none-eabi" }
run_task = "dev-test-flow"
[tasks.dev-x86_64-test-flow]
description = "Development testing flow for x86_64"
category = "Development"
env = { "XBUILD_TARGET" = "x86_64-unknown-none-elf" }
run_task = "dev-test-flow"
############
# CI Flows #
############
# Add CI flows for the xbuild targets
[tasks.workspace-ci-aarch64-flow]
description = "CI flow for aarch64"
category = "CI"
workspace = false
env = { "XBUILD_TARGET" = "aarch64-unknown-none-elf" }
run_task = "workspace-ci-flow"
[tasks.workspace-ci-armv7-flow]
description = "CI flow for armv7"
category = "CI"
workspace = false
env = { "XBUILD_TARGET" = "armv7-unknown-none-eabi" }
run_task = "workspace-ci-flow"
[tasks.workspace-ci-x86_64-flow]
description = "CI flow for x86_64"
category = "CI"
workspace = false
env = { "XBUILD_TARGET" = "x86_64-unknown-none-elf" }
run_task = "workspace-ci-flow"
###############
# Build Tasks #
###############
# Add the xbuild task and integrate it into the default flows through the hook tasks
[tasks.post-build]
run_task = [
{ name = "xbuild", condition = { env_false = ["CARGO_MAKE_CI"] } },
{ name = "ci-xbuild-flow", condition = { env_true = ["CARGO_MAKE_CI"] } }
]
[tasks.xbuild]
description = "Runs cargo xbuild command for a particular target"
category = "Build"
command = "cargo"
args = ["xbuild", "--target", "${XBUILD_TARGET}"]
condition = { env_set = ["XBUILD_TARGET"] }
dependencies = ["install-rust-src"]
[tasks.xbuild-verbose]
description = "Runs cargo xbuild command for a particular target with verbose output"
category = "Build"
command = "cargo"
args = ["xbuild", "--verbose", "--target", "${XBUILD_TARGET}"]
condition = { env_set = ["XBUILD_TARGET"] }
dependencies = ["install-rust-src"]
[tasks.xbuild-verbose-release]
description = "Runs cargo xbuild command for a particular target for release and with verbose output"
category = "Build"
command = "cargo"
args = ["xbuild", "--verbose", "--release", "--target", "${XBUILD_TARGET}"]
condition = { env_set = ["XBUILD_TARGET"] }
dependencies = ["install-rust-src"]
[tasks.xbuild-verified-class]
description = "Runs cargo xbuild command for a particular target with the verified-class feature"
category = "Build"
command = "cargo"
args = ["xbuild", "--verbose", "--features", "verified-class", "--target", "${XBUILD_TARGET}"]
condition = { env_set = ["XBUILD_TARGET"] }
dependencies = ["install-rust-src"]
[tasks.ci-xbuild-flow]
description = "Runs the pre/post hooks and the required xbuild tasks for CI"
category = "CI"
dependencies = [
"pre-xbuild",
"xbuild-verbose",
"xbuild-verbose-release",
"post-xbuild"
]
[tasks.pre-xbuild]
category = "Build"
[tasks.post-xbuild]
category = "Build"
[tasks.build]
condition = { env_not_set = ["XBUILD_TARGET"] }
args = ["build"]
[tasks.build-verbose]
condition = { env_not_set = ["XBUILD_TARGET"] }
args = ["build", "--verbose"]
[tasks-build-release]
condition = { env_not_set = ["XBUILD_TARGET"] }
args = ["build", "--release"]
[tasks.test]
condition = { env_not_set = ["XBUILD_TARGET"] }
args = ["test"]
[tasks.test-verbose]
condition = { env_not_set = ["XBUILD_TARGET"] }
args = ["test", "--verbose"]
#################
# Install Tasks #
#################
# Install seL4 build dependencies and hook into CI flow
[tasks.pre-workspace-ci-flow]
dependencies = ["install-sel4-deps"]
[tasks.install-sel4-deps]
install_script = ["pip install --user sel4-deps"]
#######################
# Documentation Tasks #
#######################
# Run art export and hook it into the CI flow
[tasks.post-workspace-ci-flow]
condition = { env_not_set = ["XBUILD_TARGET"] }
dependencies = ["art-export"]
[tasks.art-export]
description = "Runs art export to generate the design documentation."
category = "Documentation"
env = { ART_BIN = "${HOME}/.local/bin/art"}
command = "${ART_BIN}"
args = ["export", "html", "${ART_EXPORT_DIR}"]
install_script = [
'''
${ART_BIN} --version >/dev/null 2>&1 || {
install_prefix="${HOME}/.local/bin"
if [ ! -d "${install_prefix}" ]; then
mkdir "${install_prefix}"
fi
download_prefix="https://github.com/vitiral/artifact/releases/download"
download_suffix="x86_64-unknown-linux-gnu.tar.gz"
art_release="${download_prefix}/v${ARTIFACT_VERSION}/artifact-v${ARTIFACT_VERSION}-${download_suffix}"
wget -qO - "${art_release}" | tar xzv -C "${install_prefix}"
}
'''
]
######################
# Init and End Hooks #
######################
[tasks.init]
command = "echo"
args = ["Starting in ${CARGO_MAKE_WORKING_DIRECTORY}"]
[tasks.end]
command = "echo"
args = ["Ending in ${CARGO_MAKE_WORKING_DIRECTORY}"]