@@ -15,7 +15,7 @@ always-$(CONFIG_RUST) += libmacros.so
no-clean-files += libmacros.so
always-$(CONFIG_RUST) += bindings/bindings_generated.rs bindings/bindings_helpers_generated.rs
-obj-$(CONFIG_RUST) += alloc.o bindings.o hex.o kernel.o
+obj-$(CONFIG_RUST) += alloc.o bindings.o hex.o capnp.o kernel.o
always-$(CONFIG_RUST) += exports_alloc_generated.h exports_bindings_generated.h \
exports_kernel_generated.h
@@ -74,6 +74,16 @@ hex-flags := \
--edition=2018 \
-Amissing_docs
+capnp-skip_flags := \
+ -Drust_2018_idioms \
+ -Dunsafe_op_in_unsafe_fn \
+ -Dunreachable_pub
+
+capnp-flags := \
+ -Amissing_docs \
+ --cfg 'feature="kernel"' \
+ --cfg 'feature="sync_reader"'
+
quiet_cmd_rustdoc = RUSTDOC $(if $(rustdoc_host),H, ) $<
cmd_rustdoc = \
OBJTREE=$(abspath $(objtree)) \
@@ -470,11 +480,18 @@ $(obj)/hex.o: private rustc_target_flags = $(hex-flags)
$(obj)/hex.o: $(src)/hex/lib.rs $(obj)/compiler_builtins.o FORCE
$(call if_changed_dep,rustc_library)
+$(obj)/canpproto.o: private skip_clippy = 1
+$(obj)/capnp.o: private skip_flags = $(capnp-skip_flags)
+$(obj)/capnp.o: private rustc_target_flags = $(capnp-flags)
+$(obj)/capnp.o: $(src)/capnp/lib.rs $(obj)/compiler_builtins.o FORCE
+ $(call if_changed_dep,rustc_library)
+
$(obj)/kernel.o: private rustc_target_flags = --extern alloc \
--extern build_error --extern macros --extern bindings --extern uapi \
- --extern hex
+ --extern hex --extern capnp
$(obj)/kernel.o: $(src)/kernel/lib.rs $(obj)/alloc.o $(obj)/build_error.o \
- $(obj)/libmacros.so $(obj)/bindings.o $(obj)/uapi.o $(obj)/hex.o FORCE
+ $(obj)/libmacros.so $(obj)/bindings.o $(obj)/uapi.o $(obj)/hex.o \
+ $(obj)/capnp.o FORCE
$(call if_changed_dep,rustc_library)
endif # CONFIG_RUST
@@ -273,7 +273,7 @@ rust_common_cmd = \
-Zallow-features=$(rust_allowed_features) \
-Zcrate-attr=no_std \
-Zcrate-attr='feature($(rust_allowed_features))' \
- --extern alloc --extern kernel --extern hex \
+ --extern alloc --extern kernel --extern hex --extern capnp \
--crate-type rlib -L $(objtree)/rust/ \
--crate-name $(basename $(notdir $@)) \
--sysroot=/dev/null \
With all the new files in place for capnp, this patch adds support for it in the build system. Signed-off-by: Ariel Miculas <amiculas@cisco.com> --- rust/Makefile | 23 ++++++++++++++++++++--- scripts/Makefile.build | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-)