aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Leach <mike.leach@linaro.org>2024-01-23 16:00:09 +0000
committerMike Leach <mike.leach@linaro.org>2024-01-25 16:38:19 +0000
commit885e4230962ffa878daed5e802c2f8b9ef298431 (patch)
tree17587a664319a906081c95f0b7b9c9859c17fe2c
parentda63c051a39ae3c794c31e90bbb15fbeb4993b32 (diff)
build: Update to Makefile.cmake to help devicetree development
Adds new options to Makefile: Target:- generate: just do the generation stage of CMake - this is sufficient to compile the device trees Input Options: CPP_ONLY: Compile target but stop after C pre-processor stage. Allows examination of structures created by the devicetree macros BUILD_TARGET: Create only a single specified target for the product Signed-off-by: Mike Leach <mike.leach@linaro.org>
-rw-r--r--Makefile.cmake69
1 files changed, 64 insertions, 5 deletions
diff --git a/Makefile.cmake b/Makefile.cmake
index 6bea1d271d3d..c0909a9a7e78 100644
--- a/Makefile.cmake
+++ b/Makefile.cmake
@@ -146,7 +146,15 @@ ifneq ($(filter-out $(PRODUCT_INDEPENDENT_GOALS), $(MAKECMDGOALS)),)
$(error "$(PRODUCT) has been deprecated! Build terminated")
endif
- FIRMWARE_TARGETS := $(addprefix firmware-, $(BS_FIRMWARE_LIST))
+ ifeq ($(BUILD_TARGET),)
+ FIRMWARE_TARGETS := $(addprefix firmware-, $(BS_FIRMWARE_LIST))
+ else
+ ifneq ($(findstring $(BUILD_TARGET),$(BS_FIRMWARE_LIST)),)
+ FIRMWARE_TARGETS := $(addprefix firmware-, $(BUILD_TARGET))
+ else
+ $(error "Specific BUILD_TARGET $(BUILD_TARGET) not in valid target list: $(BS_FIRMWARE_LIST)")
+ endif
+ endif
ifndef PLATFORM_VARIANT
PRODUCT_BUILD_PATH := $(BUILD_PATH)/$(BS_PRODUCT_NAME)/$(TOOLCHAIN)/$(MODE)
@@ -154,12 +162,24 @@ else
PRODUCT_BUILD_PATH := $(BUILD_PATH)/$(BS_PRODUCT_NAME)/platform_variant_$(PLATFORM_VARIANT)/$(TOOLCHAIN)/$(MODE)
endif
+ GENERATE_PREFIXES := $(addprefix $(PRODUCT_BUILD_PATH)/, $(FIRMWARE_TARGETS))
+ GENERATE_TARGETS := $(addsuffix /CMakeCache.txt, $(GENERATE_PREFIXES))
+
+ ifneq ($(CPP_HALT),)
+ CPP_HALT_ARGS := -DSCP_BUILD_CPP_ONLY=1
+ endif
+
+ ifneq ($(USE_DT_BUILD),)
+ DT_BUILD_ARGS := -DSCP_USE_DT_BUILD=1
+ endif
+
define msg_start
================================================================
Arm SCP/MCP Software build System
Platform : $(BS_PRODUCT_NAME)
Mode : $(MODE)
Firmware(s) : $(BS_FIRMWARE_LIST)
+Targets(s) : $(FIRMWARE_TARGETS)
================================================================
endef
@@ -193,6 +213,8 @@ endif
CMAKE_COMMAND_OPTION += $(CMAKE_TOOL_LOG_LEVEL)
CMAKE_COMMAND_OPTION += $(CMAKE_SCP_LOG_LEVEL_OPTION)
CMAKE_COMMAND_OPTION += $(CMAKE_DEBUGGER_OPTION)
+CMAKE_COMMAND_OPTION += $(CPP_HALT_ARGS)
+CMAKE_COMMAND_OPTION += $(DT_BUILD_ARGS)
#
# Rules
@@ -208,6 +230,8 @@ help:
@echo "| Available Targets |"
@echo "--------------------------------------------------------------------"
@echo " all Build all firmware defined by PRODUCT=<product>"
+ @echo " generate Generate all CMake build trees defined by "
+ @echo " PRODUCT=<product>."
@echo " clean Remove all built products"
@echo " fwk_test Build and runs framework unit tests"
@echo " mod_test Build and runs module unit tests"
@@ -260,6 +284,12 @@ help:
@echo " Default: $(DEFAULT_BUILD_SYSTEM)"
@echo " Specify CMake to generate GNU Make or Ninja build system."
@echo ""
+ @echo " BUILD_TARGET"
+ @echo " Value: <Single firmware target variant valid for PRODUCT>"
+ @echo " Default: "
+ @echo " Specify a named firmware target for the build - otherwise will"
+ @echo " build all valid firmware targets for the selected PRODUCT"
+ @echo ""
@echo " TOOLCHAIN"
@echo " Value: <GNU|ArmClang|Clang>"
@echo " Default: $(DEFAULT_TOOLCHAIN)"
@@ -277,20 +307,49 @@ help:
@echo " Value: <cmake configuration parameters>"
@echo " Default: "
@echo " Pass extra arguments directly to cmake configuration stage."
- @echo " Multiplle extra args can be added with += or by passing the arguments as a string"
+ @echo " Multiple extra args can be added with += or by passing the arguments as a string"
@echo ""
@echo " EXTRA_BUILD_ARGS"
@echo " Value: <cmake build parameters>"
@echo " Default: "
@echo " Pass extra arguments directly to cmake build stage."
- @echo " Multiplle extra args can be added with += or by passing the arguments as a string"
+ @echo " Multiple extra args can be added with += or by passing the arguments as a string"
+ @echo ""
+ @echo " CPP_HALT"
+ @echo " Value: 1 "
+ @echo " Default: "
+ @echo " Halt after the C Pre-Processor stage - use to debug macro expansion"
+ @echo ""
+ @echo " USE_DT_BUILD"
+ @echo " Value: 1 "
+ @echo " Default: "
+ @echo " Use DT build if for modules and products that support it"
@echo ""
-
.SECONDEXPANSION:
.PHONY: all
-all: $(FIRMWARE_TARGETS)
+all: command_msg $(FIRMWARE_TARGETS)
+
+define msg_generate
+================================================================
+Generate only: $(GENERATE_TARGETS)
+================================================================
+endef
+
+.PHONY: generate
+generate: generate_msg $(GENERATE_TARGETS)
+
+generate_msg:
+ $(info $(msg_generate))
+
+
+define msg_cmd
+CMake Command options: $(CMAKE_COMMAND_OPTION) $(EXTRA_CONFIG_ARGS)
+endef
+
+command_msg:
+ $(info $(msg_cmd))
firmware-%: $(PRODUCT_BUILD_PATH)/$$@/CMakeCache.txt
$(CMAKE) --build $(<D)/ $(CMAKE_BUILD_VERBOSE_OPTION) $(EXTRA_BUILD_ARGS)