Skip to content

Commit 064c560

Browse files
committed
Add RUST_LIB_SRC make argument for nix builds
This can also used in an other non rustup context to improve usability. Signed-off-by: Finn Behrens <me@kloenk.de>
1 parent d4bf48b commit 064c560

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
542542

543543
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
544544
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
545-
export KBUILD_RUSTCFLAGS RUSTCFLAGS_KERNEL RUSTCFLAGS_MODULE
545+
export KBUILD_RUSTCFLAGS RUSTCFLAGS_KERNEL RUSTCFLAGS_MODULE RUST_LIB_SRC
546546
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
547547
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_RUSTCFLAGS_MODULE KBUILD_LDFLAGS_MODULE
548548
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL KBUILD_RUSTCFLAGS_KERNEL

rust/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
127127

128128
# `$(rustc_flags)` is passed in case the user added `--sysroot`.
129129
rustc_sysroot = $(shell $(RUSTC) $(rustc_flags) --print sysroot)
130-
rustc_src = $(rustc_sysroot)/lib/rustlib/src/rust
130+
RUST_LIB_SRC ?= $(rustc_sysroot)/lib/rustlib/src/rust/library
131131

132132
.SECONDEXPANSION:
133133
$(objtree)/rust/core.o: private skip_clippy = 1
134-
$(objtree)/rust/core.o: $$(rustc_src)/library/core/src/lib.rs FORCE
134+
$(objtree)/rust/core.o: $$(RUST_LIB_SRC)/core/src/lib.rs FORCE
135135
$(call if_changed_dep,rustc_library)
136136

137137
$(objtree)/rust/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
@@ -140,7 +140,7 @@ $(objtree)/rust/compiler_builtins.o: $(srctree)/rust/compiler_builtins.rs \
140140
$(call if_changed_dep,rustc_library)
141141

142142
$(objtree)/rust/alloc.o: private skip_clippy = 1
143-
$(objtree)/rust/alloc.o: $$(rustc_src)/library/alloc/src/lib.rs \
143+
$(objtree)/rust/alloc.o: $$(RUST_LIB_SRC)/alloc/src/lib.rs \
144144
$(objtree)/rust/compiler_builtins.o FORCE
145145
$(call if_changed_dep,rustc_library)
146146

0 commit comments

Comments
 (0)