forked from seL4/rust-sel4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
188 lines (144 loc) · 4.3 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
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
#
# Copyright 2023, Colias Group, LLC
#
# SPDX-License-Identifier: BSD-2-Clause
#
ifeq ($(K),1)
keep_going_args := -k
endif
ifneq ($(J),)
jobs_args := -j$(J)
endif
ifneq ($(C),)
cores_args := --cores $(C)
endif
CLIPPY ?= 1
ifeq ($(CLIPPY),1)
nix_clippy_attr_prefix := withClippy.
endif
nix_args := $(keep_going_args) $(jobs_args) $(cores_args)
append_to_nix_config := NIX_CONFIG="$$(printf "%s\n" "$$NIX_CONFIG" && cat hacking/binary-cache/fragment.nix.conf)"
nix_build := $(append_to_nix_config) nix-build $(nix_args)
nix_shell := $(append_to_nix_config) nix-shell $(nix_args)
ifeq ($(IN_NIX_SHELL_FOR_MAKEFILE),)
run_in_nix_shell := $(nix_shell) -A shellForMakefile --run
else
run_in_nix_shell := $(SHELL) -c
endif
out := out
.PHONY: none
none:
.PHONY: clean
clean:
rm -rf $(out) target
$(out):
mkdir -p $@
.PHONY: shell
shell:
$(nix_shell) -A shellForHacking
.PHONY: update-generated-sources
update-generated-sources:
$(MAKE) -C hacking/cargo-manifest-management update
cargo update -w
.PHONY: check-generated-sources
check-generated-sources:
$(MAKE) -C hacking/cargo-manifest-management check
cargo update -w --locked
.PHONY: update-lockfile
update-lockfile:
cargo update -w
.PHONY: check-lockfile
check-lockfile:
cargo update -w --locked
.PHONY: fmt
fmt:
cargo fmt --all
.PHONY: check-fmt
check-fmt:
cargo fmt --all -- --check
.PHONY: check-generic-formatting
check-generic-formatting:
$(run_in_nix_shell) "sh hacking/scripts/check-generic-formatting.sh"
.PHONY: check-source
check-source: check-generated-sources check-fmt check-generic-formatting
.PHONY: check-licenses
check-licenses:
$(run_in_nix_shell) "reuse lint"
.PHONY: check-dependencies
check-dependencies:
lockfile=$$($(nix_build) -A pkgs.build.this.publicCratesCargoLock --no-out-link) && \
$(run_in_nix_shell) "cargo-audit audit -f $$lockfile"
rustc_target_spec_dir := support/targets
.PHONY: generate-target-specs
generate-target-specs:
rm -f $(rustc_target_spec_dir)/*.json && \
cargo run -p sel4-generate-target-specs -- write --target-dir $(rustc_target_spec_dir) --all
try_restore_terminal := tput smam 2> /dev/null || true
.PHONY: run-tests
run-tests:
script=$$($(nix_build) -A $(nix_clippy_attr_prefix)runTests --no-out-link) && $$script
$(try_restore_terminal)
.PHONY: run-sel4test-for
run-sel4test-for:
# use trailing period to catch empty variable
script=$$($(nix_build) -A sel4testInstances.$(SEL4TEST_ARCH). --no-out-link) && $$script
$(try_restore_terminal)
.PHONY: run-fast-tests
run-fast-tests:
script=$$($(nix_build) -A $(nix_clippy_attr_prefix)runFastTests --no-out-link) && $$script
$(try_restore_terminal)
.PHONY: witness-tests
witness-tests:
$(nix_build) -A $(nix_clippy_attr_prefix)witnessTests --no-out-link
$(try_restore_terminal)
.PHONY: witness-fast-tests
witness-fast-tests:
$(nix_build) -A $(nix_clippy_attr_prefix)witnessFastTests --no-out-link
$(try_restore_terminal)
.PHONY: check-kani-proofs
check-kani-proofs:
$(run_in_nix_shell) "\
cargo kani \
--enable-unstable \
--output-format=terse \
$(jobs_args) \
-p sel4-bitfield-ops \
"
.PHONY: everything-except-non-incremental
everything-except-non-incremental:
$(nix_build) -A $(nix_clippy_attr_prefix)everythingExceptNonIncremental --no-out-link
.PHONY: everything
everything:
$(nix_build) -A $(nix_clippy_attr_prefix)everything --no-out-link
.PHONY: everything-with-excess
everything-with-excess:
$(nix_build) -A $(nix_clippy_attr_prefix)everythingWithExcess --no-out-link
.PHONY: html-links
html-links:
$(nix_build) -A $(nix_clippy_attr_prefix)html -o $(out)/$@
.PHONY: html
html: | $(out)
src=$$($(nix_build) -A $(nix_clippy_attr_prefix)html --no-out-link) && \
dst=$(out)/html && \
rm -rf $$dst && \
cp -rL --no-preserve=owner,mode $$src $$dst
.PHONY: example
example:
script=$$($(nix_build) -A $@ --no-out-link) && $$script
.PHONY: example-rpi4-b-4gb
example-rpi4-b-4gb:
$(nix_build) -A $@ -o $(out)/$@
.PHONY: check-immediately
check-immediately: check-source check-licenses check-dependencies
.PHONY: check-quickly
check-quickly: check-immediately
$(MAKE) witness-fast-tests
$(MAKE) everything-except-non-incremental
.PHONY: check-exhaustively
check-exhaustively: check-immediately
$(MAKE) witness-tests
$(MAKE) everything-with-excess
.PHONY: check-oneshot
check-oneshot: check-immediately
$(MAKE) run-tests
$(MAKE) everything-with-excess