Skip to content

Commit

Permalink
Add RUST_LIB_SRC make argument for nix builds
Browse files Browse the repository at this point in the history
This can also used in an other non rustup context to improve usability.

Signed-off-by: Finn Behrens <[email protected]>
  • Loading branch information
kloenk committed Apr 25, 2021
1 parent d4bf48b commit 3f46885
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@ else
endif
export RUSTC_OR_CLIPPY_QUIET RUSTC_OR_CLIPPY

ifdef RUST_LIB_SRC
export RUST_LIB_SRC
endif

export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC RUSTC BINDGEN
export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
Expand Down
6 changes: 3 additions & 3 deletions rust/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L

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

.SECONDEXPANSION:
$(objtree)/rust/core.o: private skip_clippy = 1
$(objtree)/rust/core.o: $$(rustc_src)/library/core/src/lib.rs FORCE
$(objtree)/rust/core.o: $$(RUST_LIB_SRC)/core/src/lib.rs FORCE
$(call if_changed_dep,rustc_library)

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

$(objtree)/rust/alloc.o: private skip_clippy = 1
$(objtree)/rust/alloc.o: $$(rustc_src)/library/alloc/src/lib.rs \
$(objtree)/rust/alloc.o: $$(RUST_LIB_SRC)/alloc/src/lib.rs \
$(objtree)/rust/compiler_builtins.o FORCE
$(call if_changed_dep,rustc_library)

Expand Down

0 comments on commit 3f46885

Please sign in to comment.