Skip to content

Commit ad6c64e

Browse files
committed
Makefile: move ifdef block inside rust/Makefile
This also makes it so that we enter `rust` on `clean`. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 60524bc commit ad6c64e

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,11 +1162,7 @@ export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
11621162
ifeq ($(KBUILD_EXTMOD),)
11631163
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
11641164
core-$(CONFIG_BLOCK) += block/
1165-
1166-
# Keep this one as an `ifdef` block since its `Makefile` runs `rustc`.
1167-
ifdef CONFIG_RUST
1168-
core-y += rust/
1169-
endif
1165+
core-$(CONFIG_RUST) += rust/
11701166

11711167
vmlinux-dirs := $(patsubst %/,%,$(filter %/, \
11721168
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
@@ -1584,7 +1580,7 @@ MRPROPER_FILES += include/config include/generated \
15841580
certs/x509.genkey \
15851581
vmlinux-gdb.py \
15861582
*.spec \
1587-
rust/*_generated.h rust/*_generated.rs rust/libmacros.so
1583+
rust/libmacros.so
15881584

15891585
# clean - Delete most, but leave enough to build external modules
15901586
#

rust/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ endif
1717

1818
obj-$(CONFIG_RUST) += exports.o
1919

20+
# Avoids running `$(RUSTC)` for the sysroot when it may not be available.
21+
ifdef CONFIG_RUST
22+
2023
ifeq ($(quiet),silent_)
2124
cargo_quiet=-q
2225
rust_test_quiet=-q
@@ -346,3 +349,5 @@ $(objtree)/rust/core.o: $$(RUST_LIB_SRC)/core/src/lib.rs FORCE
346349
rustdoc-core: private rustc_target_flags = $(core-cfgs)
347350
rustdoc-core: $$(RUST_LIB_SRC)/core/src/lib.rs FORCE
348351
$(call if_changed,rustdoc)
352+
353+
endif # CONFIG_RUST

0 commit comments

Comments
 (0)