Skip to content

Commit

Permalink
Updates on top of patches
Browse files Browse the repository at this point in the history
  • Loading branch information
Javagedes committed Aug 16, 2023
1 parent d7af5dd commit 1249f80
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 deletions.
16 changes: 9 additions & 7 deletions BaseTools/Conf/build_rule.template
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,9 @@
$(OUTPUT_DIR)(+)$(MODULE_NAME)rust.lib

<Command>
$(CARGO) $(CARGOMAKE_BUILD) $(MODULE_NAME)
$(CP) $(CARGO_BINDIR)(+)*.a $(OUTPUT_DIR)(+)$(MODULE_NAME)rust.lib
$(CARGO) make $(CARGOMAKE_FLAGS) -e RUSTFLAGS="-C link-arg=/MAP:$(DEBUG_DIR)(+)$(MODULE_NAME).map $(RUST_FLAGS)" build $(MODULE_NAME)
$(CP) $(DEBUG_DIR)(+)$(TARGET_TRIPLE)(+)$(RUST_TARGET)(+)*.a $(DEBUG_DIR)(+)$(MODULE_NAME)rust.lib
$(CP) $(DEBUG_DIR)(+)$(TARGET_TRIPLE)(+)$(RUST_TARGET)(+)*.a $(OUTPUT_DIR)(+)$(MODULE_NAME)rust.lib

[Toml-File.RUST_MODULE]
<InputFile>
Expand All @@ -293,11 +294,12 @@
<Command>
# Temporary_Rust_Todo - Remove .efi files to better support Rust incremental build for now.
$(RM) $(OUTPUT_DIR)(+)*.efi
$(CARGO) $(CARGOMAKE_BUILD) $(MODULE_NAME)
"$(GENFW)" -e $(MODULE_TYPE) -o $(CARGO_BINDIR)(+)$(MODULE_NAME).efi $(CARGO_BINDIR)(+)$(MODULE_NAME).efi $(GENFW_FLAGS)
$(CP) $(CARGO_BINDIR)(+)$(MODULE_NAME).map $(OUTPUT_DIR)(+)$(MODULE_NAME).map
$(CP) $(CARGO_BINDIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
$(CP) $(CARGO_BINDIR)(+)$(MODULE_NAME).efi $(BIN_DIR)(+)$(MODULE_NAME).efi
$(CARGO) make $(CARGOMAKE_FLAGS) -e RUSTFLAGS="-C link-arg=/MAP:$(DEBUG_DIR)(+)$(MODULE_NAME).map $(RUST_FLAGS)" build $(MODULE_NAME)
"$(GENFW)" -e $(MODULE_TYPE) -o $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(DEBUG_DIR)(+)$(TARGET_TRIPLE)(+)$(RUST_TARGET)(+)$(MODULE_NAME).efi $(GENFW_FLAGS)
$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).map $(OUTPUT_DIR)(+)$(MODULE_NAME).map
$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
$(CP) $(OUTPUT_DIR)(+)$(MODULE_NAME).efi $(BIN_DIR)(+)$(MODULE_NAME).efi

[Static-Library-File.RUST_MODULE]
<InputFile>
*.lib
Expand Down
39 changes: 17 additions & 22 deletions BaseTools/Conf/tools_def.template
Original file line number Diff line number Diff line change
Expand Up @@ -3338,34 +3338,29 @@ RELEASE_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -Os -W
# MU_CHANGE [BEGIN] - Add Rust build support

##################
# RUSTC definitions
# RUST definitions
##################
*_*_X64_TARGET_TRIPLE = x86_64-unknown-uefi
*_*_IA32_TARGET_TRIPLE = i686-unknown-uefi
*_*_AARCH64_TARGET_TRIPLE = aarch64-unknown-uefi
*_*_X64_TARGET_TRIPLE = x86_64-unknown-uefi
*_*_IA32_TARGET_TRIPLE = i686-unknown-uefi
*_*_AARCH64_TARGET_TRIPLE = aarch64-unknown-uefi

*_*_*_RUSTC_PATH = rustc
DEBUG_*_*_RUSTC_FLAGS = --edition=2018 --target $(TARGET_TRIPLE) -C debuginfo=2 --crate-type staticlib
RELEASE_*_*_RUSTC_FLAGS = --edition=2018 --target $(TARGET_TRIPLE) -C debuginfo=3 --crate-type staticlib
DEBUG_*_*_RUST_TARGET = debug
RELEASE_*_*_RUST_TARGET = release
NOOPT_*_*_RUST_TARGET = debug

*_*_*_RUST_FLAGS =

####################
# CARGO defintions #
####################
*_*_*_CARGO_PATH = cargo

##########################
# CARGO MAKE definitions #
##########################
*_*_*_CARGOMAKE_RUSTFLAGS = "-C link-arg=/MAP:$(CARGO_BINDIR)\$(MODULE_NAME).map"

DEBUG_*_*_CARGOMAKE_BUILD = make --cwd ENV(WORKSPACE) -p development -e TARGET_TRIPLE=$(TARGET_TRIPLE) -e RUSTFLAGS=$(CARGOMAKE_RUSTFLAGS) build
RELEASE_*_*_CARGOMAKE_BUILD = make --cwd ENV(WORKSPACE) -p release -e TARGET_TRIPLE=$(TARGET_TRIPLE) -e RUSTFLAGS=$(CARGOMAKE_RUSTFLAGS) build

##################
# CARGO definitions
##################
# The path to where cargo generated binaries are placed (.efi, .a, .d,)
DEBUG_*_*_CARGO_BINDIR = ENV(WORKSPACE)\target\$(TARGET_TRIPLE)\debug
RELEASE_*_*_CARGO_BINDIR = ENV(WORKSPACE)\target\$(TARGET_TRIPLE)\release



*_*_*_CARGO_PATH = cargo
DEBUG_*_*_CARGOMAKE_FLAGS = --cwd ENV(WORKSPACE) -e CARGO_TARGET_DIR=$(DEBUG_DIR) -p development -e TARGET_TRIPLE=$(TARGET_TRIPLE)
RELEASE_*_*_CARGOMAKE_FLAGS = --cwd ENV(WORKSPACE) -e CARGO_TARGET_DIR=$(DEBUG_DIR) -p release -e TARGET_TRIPLE=$(TARGET_TRIPLE)
NOOPT_*_*_CARGOMAKE_FLAGS = --cwd ENV(WORKSPACE) -e CARGO_TARGET_DIR=$(DEBUG_DIR) -p development -e TARGET_TRIPLE=$(TARGET_TRIPLE)

# MU_CHANGE [END] - Add Rust build support

Expand Down

0 comments on commit 1249f80

Please sign in to comment.