COMPONENT_TARGETS = $(HARDWARE_INTEL_PC64)
COMPONENT_TARGETS += $(HARDWARE_BAIKAL_M1)
include ../../../build-system/constants.mk
# ======= __END_OF_REQUIRES__ =======
bin_src = main.rs
bin_target = $(TARGET_BUILD_DIR)/main
info_target = $(TARGET_BUILD_DIR)/.info-done
BUILD_TARGETS = $(bin_target) $(info_target)
#
# The user may reject the sysroot usage. For this the user have to declare
# the USE_TARGET_DEST_DIR_SYSROOT variable with value 'no':
#
# USE_TARGET_DEST_DIR_SYSROOT = no
#
USE_TARGET_DEST_DIR_SYSROOT = no
include ../../../build-system/core.mk
ARCH = $(shell echo $(TARGET) | cut -f1 -d'-')
$(bin_target): $(bin_src)
@echo "======= Build the `basename $(bin_target)` executable: ======="
@$(RUSTC) --target $(TARGET) -C linker=$(CROSS_PREFIX)gcc $(bin_src) -o $(bin_target)
@touch $@
$(info_target): $(bin_target)
@echo "==================================="
@echo "======= Environment: ======="
@echo "==================================="
@echo "======= RUST_TOOLCHAIN = '$(RUST_TOOLCHAIN)'"
@echo "======= CARGO_HOME = '$(CARGO_HOME)'"
@echo "======= RUSTUP_HOME = '$(RUSTUP_HOME)'"
@echo "======= RUSTC = '$(RUSTC)'"
@echo "======= RUSTDOC = '$(RUSTDOC)'"
@echo "======= RUSTFMT = '$(RUSTFMT)'"
@echo "======= CBINDGEN = '$(CBINDGEN)'"
@echo "======= RUST_PATH = '$(RUST_PATH)'"
@echo ""
@echo "#"
@echo "# Please find the `basename $(bin_target)` executable in the $(TARGET_BUILD_DIR)/ directory."
@echo "#"
@echo "# Run the `basename $(bin_target)` executable:"
@echo ""
@$(BUILDSYSTEM)/usr/bin/qemu-$(ARCH) \
$(TOOLCHAIN_PATH)/$(TARGET)/sys-root/$(shell $(PATCHELF) --print-interpreter $(bin_target) | sed 's,^\/,,') \
--library-path $(TOOLCHAIN_PATH)/$(TARGET)/lib:$(TOOLCHAIN_PATH)/$(TARGET)/sys-root/lib:$(TOOLCHAIN_PATH)/$(TARGET)/sys-root/usr/lib \
$(bin_target)
@echo ""
@touch $@