From 4b9a7b43c124a40a9b8935d821d0b9de13f79442 Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Tue, 24 Jan 2023 10:37:20 +0100 Subject: [PATCH] :sparkles: (makefile): Add firmware target to build in parallel with global targets --- Makefile | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 4ad446837c..c03b2f8c0a 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,10 @@ GLOBAL_BUILD_DIR := $(ROOT_DIR)/_build TARGET_BOARD_BUILD_DIR := $(GLOBAL_BUILD_DIR)/${TARGET_BOARD} TARGET_BOARD_CMAKE_CONFIG_DIR := $(TARGET_BOARD_BUILD_DIR)/cmake_config +# Firmware = os + bootloader +FIRMWARE_BUILD_DIR := $(ROOT_DIR)/_build_firmware +FIRMWARE_CONFIG_DIR := $(FIRMWARE_BUILD_DIR)/cmake_config + # Unit tests UNIT_TESTS_BUILD_DIR := $(ROOT_DIR)/_build_unit_tests UNIT_TESTS_COVERAGE_DIR := $(UNIT_TESTS_BUILD_DIR)/_coverage @@ -111,17 +115,21 @@ tests_functional: cmake --build $(TARGET_BOARD_BUILD_DIR) -t tests_functional firmware: + @echo "" + @echo "๐Ÿ—๏ธ Building Firmware = LekaOS + Bootloader ๐Ÿค–" + cmake --build $(FIRMWARE_BUILD_DIR) -t bootloader LekaOS python3 tools/check_version.py ./config/os_version - ./tools/firmware/build_firmware.sh -r -v $(OS_VERSION) - -firmware_no_cleanup: - python3 tools/check_version.py ./config/os_version - ./tools/firmware/build_firmware.sh -v $(OS_VERSION) +# ./tools/firmware/build_firmware.sh -v $(OS_VERSION) # # MARK: - Config targets # ++config_all: + @$(MAKE) config + @$(MAKE) config_firmware + @$(MAKE) config_unit_tests_lite COVERAGE=ON + # Global config config: @$(MAKE) config_cmake_target @@ -137,6 +145,22 @@ config_cmake_build: mkdir_cmake_config @echo "๐Ÿƒ Running cmake configuration script for target $(TARGET_BOARD) ๐Ÿ“" @cmake -S . -B $(TARGET_BOARD_BUILD_DIR) -GNinja -DCMAKE_CONFIG_DIR="$(TARGET_BOARD_CMAKE_CONFIG_DIR)" -DTARGET_BOARD="$(TARGET_BOARD)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_LOG_DEBUG=$(ENABLE_LOG_DEBUG) -DENABLE_SYSTEM_STATS=$(ENABLE_SYSTEM_STATS) -DBUILD_TARGETS_TO_USE_WITH_BOOTLOADER=$(BUILD_TARGETS_TO_USE_WITH_BOOTLOADER) +# Firmware config +config_firmware: + @$(MAKE) config_firmware_target + @$(MAKE) config_firmware_build + +config_firmware_target: mkdir_firmware_config + @echo "" + @echo "๐Ÿƒ Running configuration script for firmware (os + bootloader) ๐Ÿ“" + python3 $(CMAKE_DIR)/scripts/configure_cmake_for_target.py $(TARGET_BOARD) -p $(FIRMWARE_CONFIG_DIR) -a $(ROOT_DIR)/config/mbed_app.json + +config_firmware_build: mkdir_firmware_config + @echo "" + @echo "๐Ÿƒ Running cmake configuration script for firmware (os + bootloader) ๐Ÿ“" + @cmake -S . -B $(FIRMWARE_BUILD_DIR) -GNinja -DCMAKE_CONFIG_DIR="$(FIRMWARE_CONFIG_DIR)" -DTARGET_BOARD="$(TARGET_BOARD)" -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_LOG_DEBUG=$(ENABLE_LOG_DEBUG) -DENABLE_SYSTEM_STATS=$(ENABLE_SYSTEM_STATS) -DBUILD_TARGETS_TO_USE_WITH_BOOTLOADER=ON + + # Tools config_tools: @$(MAKE) config_tools_target @@ -323,6 +347,9 @@ mcuboot_symlink_files: mkdir_cmake_config: @mkdir -p $(TARGET_BOARD_CMAKE_CONFIG_DIR) +mkdir_firmware_config: + @mkdir -p $(FIRMWARE_CONFIG_DIR) + mkdir_tools_config: @mkdir -p $(CMAKE_TOOLS_CONFIG_DIR) @@ -339,6 +366,7 @@ rm_build_all: @echo "" @echo "โš ๏ธ Cleaning up all build directories ๐Ÿงน" rm -rf $(GLOBAL_BUILD_DIR) + rm -rf $(FIRMWARE_BUILD_DIR) rm -rf $(CMAKE_TOOLS_BUILD_DIR) rm -rf ./compile_commands.json