"Benno Lossin" <benno.lossin@xxxxxxxxx> writes: > From: Miguel Ojeda <ojeda@xxxxxxxxxx> > > Add infrastructure for moving the initialization API to its own crate. > Covers all make targets such as `rust-analyzer` and `rustdoc`. The tests > of pin-init are not added to `rusttest`, as they are already tested in > the user-space repository [1]. If it's not too much hassle, why not add them in the kernel as well? I would rather not have to go fetch the user space repo from github, in the event that I ever need to patch pin-init. > > Link: https://github.com/Rust-for-Linux/pin-init [1] > Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx> > Co-developed-by: Benno Lossin <benno.lossin@xxxxxxxxx> > Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx> > --- > rust/Makefile | 75 +++++++++++++++++++++++------- > rust/pin-init/internal/src/_lib.rs | 3 ++ > rust/pin-init/internal/src/lib.rs | 4 ++ > rust/pin-init/src/_lib.rs | 5 ++ > scripts/Makefile.build | 2 +- > scripts/generate_rust_analyzer.py | 17 ++++++- > 6 files changed, 86 insertions(+), 20 deletions(-) > create mode 100644 rust/pin-init/internal/src/_lib.rs > create mode 100644 rust/pin-init/src/_lib.rs > > diff --git a/rust/Makefile b/rust/Makefile > index ea3849eb78f6..90310f0620eb 100644 > --- a/rust/Makefile > +++ b/rust/Makefile [...] > @@ -110,11 +113,24 @@ rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE > rustdoc-ffi: $(src)/ffi.rs rustdoc-core FORCE > +$(call if_changed,rustdoc) > > -rustdoc-kernel: private rustc_target_flags = --extern ffi \ > +rustdoc-pin_init_internal: private rustdoc_host = yes > +rustdoc-pin_init_internal: private rustc_target_flags = --cfg kernel \ > + --extern proc_macro --crate-type proc-macro > +rustdoc-pin_init_internal: $(src)/pin-init/internal/src/_lib.rs FORCE > + +$(call if_changed,rustdoc) > + > +rustdoc-pin_init: private rustdoc_host = yes > +rustdoc-pin_init: private rustc_target_flags = --extern pin_init_internal \ > + --extern macros --extern alloc --cfg kernel --cfg feature=\"alloc\" > +rustdoc-pin_init: $(src)/pin-init/src/_lib.rs rustdoc-pin_init_internal \ > + rustdoc-macros FORCE > + +$(call if_changed,rustdoc) Is it possible to do some code sharing here, such that when we add a crate, it's just a matter of putting the path/name on a list somewhere? Best regards, Andreas Hindborg