@@ -8,23 +8,22 @@ extra-$(CONFIG_RUST) += exports_kernel_generated.h
8
8
9
9
RUSTDOC = rustdoc
10
10
11
- rustdoc_flags = $(filter-out --emit=% --out-dir=% , $(rustc_flags ) )
12
-
13
11
quiet_cmd_rustdoc = RUSTDOC $<
14
12
cmd_rustdoc = \
15
13
RUST_BINDINGS_FILE=$(abspath $(objtree ) /rust/bindings_generated.rs) \
16
- $(RUSTDOC ) $(rustdoc_flags ) $(rustdoc_target_flags ) -L $(objtree ) /rust/ \
14
+ $(RUSTDOC ) $(filter-out --emit=% , $(rustc_flags ) ) \
15
+ $(rustdoc_target_flags ) -L $(objtree ) /rust/ \
17
16
--output $(objtree ) /rust/doc --crate-name $(subst rustdoc-,,$@ ) \
18
17
-Wmissing-docs @$(objtree ) /include/generated/rustc_cfg $<
19
18
20
19
rustdoc : rustdoc-module rustdoc-kernel
21
20
22
- rustdoc-module : rustdoc_target_flags = --crate-type proc-macro \
21
+ rustdoc-module : private rustdoc_target_flags = --crate-type proc-macro \
23
22
--extern proc_macro
24
23
rustdoc-module : $(srctree ) /rust/module.rs FORCE
25
24
$(call if_changed,rustdoc)
26
25
27
- rustdoc-kernel : rustdoc_target_flags = --extern alloc \
26
+ rustdoc-kernel : private rustdoc_target_flags = --extern alloc \
28
27
--extern module=$(objtree)/rust/libmodule.so
29
28
rustdoc-kernel : $(srctree ) /rust/kernel/lib.rs rustdoc-module \
30
29
$(objtree)/rust/libmodule.so $(objtree)/rust/bindings_generated.rs FORCE
@@ -74,23 +73,23 @@ quiet_cmd_exports = EXPORTS $@
74
73
| xargs -n1 -Isymbol \
75
74
echo 'EXPORT_SYMBOL$(exports_target_type ) (symbol);' > $@
76
75
77
- $(objtree ) /rust/exports_core_generated.h : exports_target_type := _RUST
76
+ $(objtree ) /rust/exports_core_generated.h : private exports_target_type := _RUST
78
77
$(objtree ) /rust/exports_core_generated.h : $(objtree ) /rust/core.o FORCE
79
78
$(call if_changed,exports)
80
79
81
- $(objtree ) /rust/exports_alloc_generated.h : exports_target_type := _RUST
80
+ $(objtree ) /rust/exports_alloc_generated.h : private exports_target_type := _RUST
82
81
$(objtree ) /rust/exports_alloc_generated.h : $(objtree ) /rust/alloc.o FORCE
83
82
$(call if_changed,exports)
84
83
85
- $(objtree ) /rust/exports_kernel_generated.h : exports_target_type := _RUST_GPL
84
+ $(objtree ) /rust/exports_kernel_generated.h : private exports_target_type := _RUST_GPL
86
85
$(objtree ) /rust/exports_kernel_generated.h : $(objtree ) /rust/kernel.o FORCE
87
86
$(call if_changed,exports)
88
87
89
88
# `-Cpanic=unwind -Cforce-unwind-tables=y` overrides `rustc_flags` in order to
90
89
# avoid the https://github.com/rust-lang/rust/issues/82320 rustc crash.
91
- quiet_cmd_rustc_procmacro = RUSTC P $@
90
+ quiet_cmd_rustc_procmacro = RUSTC P $( CLIPPY_QUIET_TAG ) $ @
92
91
cmd_rustc_procmacro = \
93
- $(RUSTC ) $(rustc_flags ) --emit=dep-info,link --extern proc_macro \
92
+ $(CLIPPY_DRIVER ) $( RUSTC ) $(rustc_flags ) --emit=dep-info,link --extern proc_macro \
94
93
-Cpanic=unwind -Cforce-unwind-tables=y \
95
94
--crate-type proc-macro --out-dir $(objtree ) /rust/ \
96
95
--crate-name $(patsubst lib% .so,% ,$(notdir $@ ) ) $< ; \
@@ -100,10 +99,11 @@ quiet_cmd_rustc_procmacro = RUSTC P $@
100
99
$(objtree ) /rust/libmodule.so : $(srctree ) /rust/module.rs FORCE
101
100
$(call if_changed_dep,rustc_procmacro)
102
101
103
- quiet_cmd_rustc_library = RUSTC L $@
102
+ quiet_cmd_rustc_library = RUSTC L $( if $( skip_clippy ) ,, $( CLIPPY_QUIET_TAG ) ) $ @
104
103
cmd_rustc_library = \
105
104
RUST_BINDINGS_FILE=$(abspath $(objtree ) /rust/bindings_generated.rs) \
106
- $(RUSTC ) $(rustc_flags ) $(rustc_cross_flags ) $(rustc_target_flags ) \
105
+ $(if $(skip_clippy ) ,,$(CLIPPY_DRIVER ) ) $(RUSTC ) $(rustc_flags ) \
106
+ $(rustc_cross_flags ) $(rustc_target_flags ) \
107
107
--crate-type rlib --out-dir $(objtree ) /rust/ -L $(objtree ) /rust/ \
108
108
--crate-name $(patsubst % .o,% ,$(notdir $@ ) ) $< ; \
109
109
mv $(objtree ) /rust/$(patsubst % .o,% ,$(notdir $@ ) ) .d $(depfile ) ; \
@@ -115,20 +115,22 @@ rustc_sysroot = $(shell $(RUSTC) $(rustc_flags) --print sysroot)
115
115
rustc_src = $(rustc_sysroot ) /lib/rustlib/src/rust
116
116
117
117
.SECONDEXPANSION :
118
+ $(objtree ) /rust/core.o : private skip_clippy = 1
118
119
$(objtree ) /rust/core.o : $$(rustc_src ) /library/core/src/lib.rs FORCE
119
120
$(call if_changed_dep,rustc_library)
120
121
121
- $(objtree ) /rust/compiler_builtins.o : rustc_objcopy = -w -W '__* '
122
+ $(objtree ) /rust/compiler_builtins.o : private rustc_objcopy = -w -W '__* '
122
123
$(objtree ) /rust/compiler_builtins.o : $(srctree ) /rust/compiler_builtins.rs \
123
124
$(objtree)/rust/core.o FORCE
124
125
$(call if_changed_dep,rustc_library)
125
126
127
+ $(objtree ) /rust/alloc.o : private skip_clippy = 1
126
128
$(objtree ) /rust/alloc.o : $$(rustc_src ) /library/alloc/src/lib.rs \
127
129
$(objtree)/rust/compiler_builtins.o FORCE
128
130
$(call if_changed_dep,rustc_library)
129
131
130
132
# ICE on `--extern module`: https://github.com/rust-lang/rust/issues/56935
131
- $(objtree ) /rust/kernel.o : rustc_target_flags = --extern alloc \
133
+ $(objtree ) /rust/kernel.o : private rustc_target_flags = --extern alloc \
132
134
--extern module=$(objtree)/rust/libmodule.so
133
135
$(objtree ) /rust/kernel.o : $(srctree ) /rust/kernel/lib.rs $(objtree ) /rust/alloc.o \
134
136
$(objtree)/rust/libmodule.so $(objtree)/rust/bindings_generated.rs FORCE
0 commit comments