| @@ -40,7 +40,7 @@ obj-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.o · 39 unmodified lines |
| 40 | ifdef CONFIG_RUST | 40 | ifdef CONFIG_RUST |
| 41 | | 41 | |
| 42 | # `$(rust_flags)` is passed in case the user added `--sysroot`. | 42 | # `$(rust_flags)` is passed in case the user added `--sysroot`. |
| 43 | rustc_sysroot := $(shell $(RUSTC) $(rust_flags) --print sysroot) | 43 | rustc_sysroot := $(shell MAKEFLAGS= $(RUSTC) $(rust_flags) --print sysroot) |
| 44 | rustc_host_target := $(shell $(RUSTC) --version --verbose | grep -F 'host: ' | cut -d' ' -f2) | 44 | rustc_host_target := $(shell $(RUSTC) --version --verbose | grep -F 'host: ' | cut -d' ' -f2) |
| 45 | RUST_LIB_SRC ?= $(rustc_sysroot)/lib/rustlib/src/rust/library | 45 | RUST_LIB_SRC ?= $(rustc_sysroot)/lib/rustlib/src/rust/library |
| 46 | | 46 | |
| @@ -108,14 +108,14 @@ rustdoc-macros: private rustdoc_host = yes · 61 unmodified lines |
| 108 | rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \ | 108 | rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \ |
| 109 | --extern proc_macro | 109 | --extern proc_macro |
| 110 | rustdoc-macros: $(src)/macros/lib.rs FORCE | 110 | rustdoc-macros: $(src)/macros/lib.rs FORCE |
| 111 | $(call if_changed,rustdoc) | 111 | +$(call if_changed,rustdoc) |
| 112 | | 112 | |
| 113 | rustdoc-core: private rustc_target_flags = $(core-cfgs) | 113 | rustdoc-core: private rustc_target_flags = $(core-cfgs) |
| 114 | rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE | 114 | rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE |
| 115 | $(call if_changed,rustdoc) | 115 | +$(call if_changed,rustdoc) |
| 116 | | 116 | |
| 117 | rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE | 117 | rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE |
| 118 | $(call if_changed,rustdoc) | 118 | +$(call if_changed,rustdoc) |
| 119 | | 119 | |
| 120 | # We need to allow `rustdoc::broken_intra_doc_links` because some | 120 | # We need to allow `rustdoc::broken_intra_doc_links` because some |
| 121 | # `no_global_oom_handling` functions refer to non-`no_global_oom_handling` | 121 | # `no_global_oom_handling` functions refer to non-`no_global_oom_handling` |
| @@ -124,7 +124,7 @@ rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE · 2 unmodified lines |
| 124 | rustdoc-alloc: private rustc_target_flags = $(alloc-cfgs) \ | 124 | rustdoc-alloc: private rustc_target_flags = $(alloc-cfgs) \ |
| 125 | -Arustdoc::broken_intra_doc_links | 125 | -Arustdoc::broken_intra_doc_links |
| 126 | rustdoc-alloc: $(src)/alloc/lib.rs rustdoc-core rustdoc-compiler_builtins FORCE | 126 | rustdoc-alloc: $(src)/alloc/lib.rs rustdoc-core rustdoc-compiler_builtins FORCE |
| 127 | $(call if_changed,rustdoc) | 127 | +$(call if_changed,rustdoc) |
| 128 | | 128 | |
| 129 | rustdoc-kernel: private rustc_target_flags = --extern alloc \ | 129 | rustdoc-kernel: private rustc_target_flags = --extern alloc \ |
| 130 | --extern build_error --extern macros=$(objtree)/$(obj)/libmacros.so \ | 130 | --extern build_error --extern macros=$(objtree)/$(obj)/libmacros.so \ |
| @@ -132,7 +132,7 @@ rustdoc-kernel: private rustc_target_flags = --extern alloc \ · 1 unmodified line |
| 132 | rustdoc-kernel: $(src)/kernel/lib.rs rustdoc-core rustdoc-macros \ | 132 | rustdoc-kernel: $(src)/kernel/lib.rs rustdoc-core rustdoc-macros \ |
| 133 | rustdoc-compiler_builtins rustdoc-alloc $(obj)/libmacros.so \ | 133 | rustdoc-compiler_builtins rustdoc-alloc $(obj)/libmacros.so \ |
| 134 | $(obj)/bindings.o FORCE | 134 | $(obj)/bindings.o FORCE |
| 135 | $(call if_changed,rustdoc) | 135 | +$(call if_changed,rustdoc) |
| 136 | | 136 | |
| 137 | quiet_cmd_rustc_test_library = RUSTC TL $< | 137 | quiet_cmd_rustc_test_library = RUSTC TL $< |
| 138 | cmd_rustc_test_library = \ | 138 | cmd_rustc_test_library = \ |
| @@ -146,18 +146,18 @@ quiet_cmd_rustc_test_library = RUSTC TL $< · 7 unmodified lines |
| 146 | --crate-name $(subst rusttest-,,$(subst rusttestlib-,,$@)) $< | 146 | --crate-name $(subst rusttest-,,$(subst rusttestlib-,,$@)) $< |
| 147 | | 147 | |
| 148 | rusttestlib-build_error: $(src)/build_error.rs rusttest-prepare FORCE | 148 | rusttestlib-build_error: $(src)/build_error.rs rusttest-prepare FORCE |
| 149 | $(call if_changed,rustc_test_library) | 149 | +$(call if_changed,rustc_test_library) |
| 150 | | 150 | |
| 151 | rusttestlib-macros: private rustc_target_flags = --extern proc_macro | 151 | rusttestlib-macros: private rustc_target_flags = --extern proc_macro |
| 152 | rusttestlib-macros: private rustc_test_library_proc = yes | 152 | rusttestlib-macros: private rustc_test_library_proc = yes |
| 153 | rusttestlib-macros: $(src)/macros/lib.rs rusttest-prepare FORCE | 153 | rusttestlib-macros: $(src)/macros/lib.rs rusttest-prepare FORCE |
| 154 | $(call if_changed,rustc_test_library) | 154 | +$(call if_changed,rustc_test_library) |
| 155 | | 155 | |
| 156 | rusttestlib-bindings: $(src)/bindings/lib.rs rusttest-prepare FORCE | 156 | rusttestlib-bindings: $(src)/bindings/lib.rs rusttest-prepare FORCE |
| 157 | $(call if_changed,rustc_test_library) | 157 | +$(call if_changed,rustc_test_library) |
| 158 | | 158 | |
| 159 | rusttestlib-uapi: $(src)/uapi/lib.rs rusttest-prepare FORCE | 159 | rusttestlib-uapi: $(src)/uapi/lib.rs rusttest-prepare FORCE |
| 160 | $(call if_changed,rustc_test_library) | 160 | +$(call if_changed,rustc_test_library) |
| 161 | | 161 | |
| 162 | quiet_cmd_rustdoc_test = RUSTDOC T $< | 162 | quiet_cmd_rustdoc_test = RUSTDOC T $< |
| 163 | cmd_rustdoc_test = \ | 163 | cmd_rustdoc_test = \ |
| @@ -189,7 +189,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $< · 25 unmodified lines |
| 189 | $(src)/kernel/lib.rs $(obj)/kernel.o \ | 189 | $(src)/kernel/lib.rs $(obj)/kernel.o \ |
| 190 | $(objtree)/scripts/rustdoc_test_builder \ | 190 | $(objtree)/scripts/rustdoc_test_builder \ |
| 191 | $(objtree)/scripts/rustdoc_test_gen FORCE | 191 | $(objtree)/scripts/rustdoc_test_gen FORCE |
| 192 | $(call if_changed,rustdoc_test_kernel) | 192 | +$(call if_changed,rustdoc_test_kernel) |
| 193 | | 193 | |
| 194 | # We cannot use `-Zpanic-abort-tests` because some tests are dynamic, | 194 | # We cannot use `-Zpanic-abort-tests` because some tests are dynamic, |
| 195 | # so for the moment we skip `-Cpanic=abort`. | 195 | # so for the moment we skip `-Cpanic=abort`. |
| @@ -254,21 +254,21 @@ quiet_cmd_rustsysroot = RUSTSYSROOT · 58 unmodified lines |
| 254 | $(objtree)/$(obj)/test/sysroot/lib/rustlib/$(rustc_host_target)/lib | 254 | $(objtree)/$(obj)/test/sysroot/lib/rustlib/$(rustc_host_target)/lib |
| 255 | | 255 | |
| 256 | rusttest-prepare: FORCE | 256 | rusttest-prepare: FORCE |
| 257 | $(call if_changed,rustsysroot) | 257 | +$(call if_changed,rustsysroot) |
| 258 | | 258 | |
| 259 | rusttest-macros: private rustc_target_flags = --extern proc_macro | 259 | rusttest-macros: private rustc_target_flags = --extern proc_macro |
| 260 | rusttest-macros: private rustdoc_test_target_flags = --crate-type proc-macro | 260 | rusttest-macros: private rustdoc_test_target_flags = --crate-type proc-macro |
| 261 | rusttest-macros: $(src)/macros/lib.rs rusttest-prepare FORCE | 261 | rusttest-macros: $(src)/macros/lib.rs rusttest-prepare FORCE |
| 262 | $(call if_changed,rustc_test) | 262 | +$(call if_changed,rustc_test) |
| 263 | $(call if_changed,rustdoc_test) | 263 | +$(call if_changed,rustdoc_test) |
| 264 | | 264 | |
| 265 | rusttest-kernel: private rustc_target_flags = --extern alloc \ | 265 | rusttest-kernel: private rustc_target_flags = --extern alloc \ |
| 266 | --extern build_error --extern macros --extern bindings --extern uapi | 266 | --extern build_error --extern macros --extern bindings --extern uapi |
| 267 | rusttest-kernel: $(src)/kernel/lib.rs rusttest-prepare \ | 267 | rusttest-kernel: $(src)/kernel/lib.rs rusttest-prepare \ |
| 268 | rusttestlib-build_error rusttestlib-macros rusttestlib-bindings \ | 268 | rusttestlib-build_error rusttestlib-macros rusttestlib-bindings \ |
| 269 | rusttestlib-uapi FORCE | 269 | rusttestlib-uapi FORCE |
| 270 | $(call if_changed,rustc_test) | 270 | +$(call if_changed,rustc_test) |
| 271 | $(call if_changed,rustc_test_library) | 271 | +$(call if_changed,rustc_test_library) |
| 272 | | 272 | |
| 273 | ifdef CONFIG_CC_IS_CLANG | 273 | ifdef CONFIG_CC_IS_CLANG |
| 274 | bindgen_c_flags = $(c_flags) | 274 | bindgen_c_flags = $(c_flags) |
| @@ -396,7 +396,7 @@ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@ · 121 unmodified lines |
| 396 | # Therefore, to get `libmacros.so` automatically recompiled when the compiler | 396 | # Therefore, to get `libmacros.so` automatically recompiled when the compiler |
| 397 | # version changes, we add `core.o` as a dependency (even if it is not needed). | 397 | # version changes, we add `core.o` as a dependency (even if it is not needed). |
| 398 | $(obj)/libmacros.so: $(src)/macros/lib.rs $(obj)/core.o FORCE | 398 | $(obj)/libmacros.so: $(src)/macros/lib.rs $(obj)/core.o FORCE |
| 399 | $(call if_changed_dep,rustc_procmacro) | 399 | +$(call if_changed_dep,rustc_procmacro) |
| 400 | | 400 | |
| 401 | quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L $@ | 401 | quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L $@ |
| 402 | cmd_rustc_library = \ | 402 | cmd_rustc_library = \ |
| @@ -435,36 +435,36 @@ $(obj)/core.o: private skip_flags = -Dunreachable_pub · 32 unmodified lines |
| 435 | $(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym)) | 435 | $(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym)) |
| 436 | $(obj)/core.o: private rustc_target_flags = $(core-cfgs) | 436 | $(obj)/core.o: private rustc_target_flags = $(core-cfgs) |
| 437 | $(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs scripts/target.json FORCE | 437 | $(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs scripts/target.json FORCE |
| 438 | $(call if_changed_dep,rustc_library) | 438 | +$(call if_changed_dep,rustc_library) |
| 439 | | 439 | |
| 440 | $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*' | 440 | $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*' |
| 441 | $(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE | 441 | $(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE |
| 442 | $(call if_changed_dep,rustc_library) | 442 | +$(call if_changed_dep,rustc_library) |
| 443 | | 443 | |
| 444 | $(obj)/alloc.o: private skip_clippy = 1 | 444 | $(obj)/alloc.o: private skip_clippy = 1 |
| 445 | $(obj)/alloc.o: private skip_flags = -Dunreachable_pub | 445 | $(obj)/alloc.o: private skip_flags = -Dunreachable_pub |
| 446 | $(obj)/alloc.o: private rustc_target_flags = $(alloc-cfgs) | 446 | $(obj)/alloc.o: private rustc_target_flags = $(alloc-cfgs) |
| 447 | $(obj)/alloc.o: $(src)/alloc/lib.rs $(obj)/compiler_builtins.o FORCE | 447 | $(obj)/alloc.o: $(src)/alloc/lib.rs $(obj)/compiler_builtins.o FORCE |
| 448 | $(call if_changed_dep,rustc_library) | 448 | +$(call if_changed_dep,rustc_library) |
| 449 | | 449 | |
| 450 | $(obj)/build_error.o: $(src)/build_error.rs $(obj)/compiler_builtins.o FORCE | 450 | $(obj)/build_error.o: $(src)/build_error.rs $(obj)/compiler_builtins.o FORCE |
| 451 | $(call if_changed_dep,rustc_library) | 451 | +$(call if_changed_dep,rustc_library) |
| 452 | | 452 | |
| 453 | $(obj)/bindings.o: $(src)/bindings/lib.rs \ | 453 | $(obj)/bindings.o: $(src)/bindings/lib.rs \ |
| 454 | $(obj)/compiler_builtins.o \ | 454 | $(obj)/compiler_builtins.o \ |
| 455 | $(obj)/bindings/bindings_generated.rs \ | 455 | $(obj)/bindings/bindings_generated.rs \ |
| 456 | $(obj)/bindings/bindings_helpers_generated.rs FORCE | 456 | $(obj)/bindings/bindings_helpers_generated.rs FORCE |
| 457 | $(call if_changed_dep,rustc_library) | 457 | +$(call if_changed_dep,rustc_library) |
| 458 | | 458 | |
| 459 | $(obj)/uapi.o: $(src)/uapi/lib.rs \ | 459 | $(obj)/uapi.o: $(src)/uapi/lib.rs \ |
| 460 | $(obj)/compiler_builtins.o \ | 460 | $(obj)/compiler_builtins.o \ |
| 461 | $(obj)/uapi/uapi_generated.rs FORCE | 461 | $(obj)/uapi/uapi_generated.rs FORCE |
| 462 | $(call if_changed_dep,rustc_library) | 462 | +$(call if_changed_dep,rustc_library) |
| 463 | | 463 | |
| 464 | $(obj)/kernel.o: private rustc_target_flags = --extern alloc \ | 464 | $(obj)/kernel.o: private rustc_target_flags = --extern alloc \ |
| 465 | --extern build_error --extern macros --extern bindings --extern uapi | 465 | --extern build_error --extern macros --extern bindings --extern uapi |
| 466 | $(obj)/kernel.o: $(src)/kernel/lib.rs $(obj)/alloc.o $(obj)/build_error.o \ | 466 | $(obj)/kernel.o: $(src)/kernel/lib.rs $(obj)/alloc.o $(obj)/build_error.o \ |
| 467 | $(obj)/libmacros.so $(obj)/bindings.o $(obj)/uapi.o FORCE | 467 | $(obj)/libmacros.so $(obj)/bindings.o $(obj)/uapi.o FORCE |
| 468 | $(call if_changed_dep,rustc_library) | 468 | +$(call if_changed_dep,rustc_library) |
| 469 | | 469 | |
| 470 | endif # CONFIG_RUST | 470 | endif # CONFIG_RUST |