COMPONENT_TARGETS = $(HARDWARE_INTEL_PC64)
COMPONENT_TARGETS += $(HARDWARE_BAIKAL_M1)
include ../../../build-system/constants.mk
# ======= __END_OF_REQUIRES__ =======
bin_src = main.cpp
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'-')
CXX := $(shell $(LLVM_CONFIG) --bindir)/clang++
SYSROOT := $(TOOLCHAIN_PATH)/$(TARGET)/sys-root
$(bin_target): $(bin_src)
@echo "======= Build the `basename $(bin_target)` executable: ======="
@$(CXX) --target=$(TARGET) \
-B $(CROSS_PREFIX)gcc \
--gcc-toolchain=$(TOOLCHAIN_PATH) \
--gcc-triple=$(TARGET) \
--sysroot=$(SYSROOT) \
-stdlib=libstdc++ \
-I$(SYSROOT)/usr/include \
-Wl,-rpath,/usr/lib \
$(bin_src) -o $(bin_target)
@touch $@
$(info_target): $(bin_target)
@echo "==================================="
@echo "======= Environment: ======="
@echo "==================================="
@echo "======= LLVM_CONFIG = '$(LLVM_CONFIG)'"
@echo "======= LLVM_PATH = '$(LLVM_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 $@