-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (88 loc) · 3.4 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
# This needs to be constant so that rust_riotmodules can be pulled in
RIOTBASE = ./RIOT
# just to make the build tools happy
APPLICATION = documentation
# pick one on which all the required modules can actually be enabled
BOARD = nrf52840dongle
TOOLCHAIN = llvm
DEVELHELP = 1
# Compared to modules known to riot-wrappers, this is missing microbit,
# periph_dac and pthread. Ideally we'd have all modules in, but building
# documentation requires the underlying steps to build successfully.
USEMODULE += gnrc
USEMODULE += gnrc_ipv6
USEMODULE += gcoap
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
USEMODULE += saul_default
USEMODULE += ztimer_usec
USEMODULE += ztimer_msec
USEMODULE += ztimer_sec
USEMODULE += ztimer_periodic
USEMODULE += bluetil_ad
USEMODULE += suit_transport_coap
USEMODULE += sock_tcp
USEMODULE += sock_udp
USEMODULE += sock_async
USEMODULE += core_thread_flags
USEMODULE += vfs
USEMODULE += prng_sha256prng
USEMODULE += tiny_strerror
FEATURES_REQUIRED += periph_adc
FEATURES_REQUIRED += periph_gpio
FEATURES_REQUIRED += periph_i2c
FEATURES_REQUIRED += periph_spi
FEATURES_REQUIRED += periph_uart
USEPKG += nimble
# to populate CFLAGS and INCLUDES, which is all we need the RIOT build system for here
include $(RIOTBASE)/Makefile.include
.DEFAULT_GOAL := rustdoc-all
# This causes full slow rebuilds of riot-sys. This is a workaround -- the
# proper fix is probably to start opting in to -D flags and to not go through
# compile_commands.
export RIOT_CHACHA_PRNG_DEFAULT = 0x0
rustdoc-all: build-cargo-docs upload
build-cargo-tests:
$(MAKE) cargo-command CARGO_COMMAND="cargo test --doc --package riot-wrappers -Z doctest-xcompile"
run-cargo-check:
$(MAKE) cargo-command CARGO_COMMAND="cargo check"
build-cargo-docs:
# Even with dependencies documented, private items and layout are only
# documented in explicitly listed packages.
RUSTDOCFLAGS="-Zunstable-options --show-type-layout" \
$(MAKE) \
cargo-command \
CARGO_COMMAND="cargo doc \
-Z unstable-options \
-Z rustdoc-scrape-examples \
--document-private-items \
--package riot-doc-helpers \
--package riot-sys \
--package riot-wrappers \
--package riot-shell-commands \
--package riot-coap-handler-demos \
--package embassy-executor-riot \
--package rust_riotmodules \
"
# Huge numbers of files that just make transfers take long
find bin/${BOARD}/target/${RUST_TARGET}/doc/riot_sys -name 'constant.RIOT_PP_*.html' -delete
# Remove some huge crates that we don't use directly
#
# The alternative would be to pass --no-deps and a lot of --package
# that we *do* care about to `cargo doc`, but that is impractical for
# two reasons:
#
# * It won't capture all the dependencies of rust_riotmodules (granted,
# those are enumerated anyway in Cargo.toml until _all works)
# * We'd have to pass in RUSTDOCFLAGS="-Z unstable-options
# --extern-html-root-url embedded_hal=https://example.com/" and that
# has no option to just send *everything* to docs.rs (well except for
# embassy where we'd need to explicitly give embassy.dev URIs)
rm -r bin/${BOARD}/target/${RUST_TARGET}/doc/typenum \
bin/${BOARD}/target/${RUST_TARGET}/doc/digest
build-json-docs:
# Experimental.
# Might be neat to get the doc(alias) data out and use it to augment the RIOT docs.
$(MAKE) cargo-command CARGO_COMMAND="cargo doc -Z unstable-options -Z rustdoc-scrape-examples --output-format=json"
.PHONY: rustdoc-all build-cargo-docs upload