From 6e0855c296594f644d714227e940133685d732f3 Mon Sep 17 00:00:00 2001 From: Steve Evans Date: Sun, 28 Jul 2024 23:29:45 +0100 Subject: [PATCH] Allow change of debug flags without forcing complete rebuild (#13708) --- Makefile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 11ffbcf8f33..bab6e70c743 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ CUSTOM_DEFAULTS_EXTENDED ?= no # Debugger optons: # empty - ordinary build with all optimizations enabled -# INFO - ordinary build with debug symbols and all optimizations enabled +# INFO - ordinary build with debug symbols and all optimizations enabled. Only builds touched files. # GDB - debug build with minimum number of optimizations DEBUG ?= @@ -142,6 +142,15 @@ EXTRA_LD_FLAGS := # # Default Tool options - can be overridden in {mcu}.mk files. # +DEBUG_MIXED = no + +ifeq ($(DEBUG),INFO) +DEBUG_MIXED = yes +endif +ifeq ($(DEBUG),GDB) +DEBUG_MIXED = yes +endif + ifeq ($(DEBUG),GDB) OPTIMISE_DEFAULT := -Og @@ -336,7 +345,12 @@ TARGET_MAP = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET_NAME).map TARGET_EXST_HASH_SECTION_FILE = $(TARGET_OBJ_DIR)/exst_hash_section.bin +ifeq ($(DEBUG_MIXED),yes) +TARGET_EF_HASH := $(shell echo -n -- "$(EXTRA_FLAGS)" "$(OPTIONS)" "$(DEVICE_FLAGS)" "$(TARGET_FLAGS)" | openssl dgst -md5 -r | awk '{print $$1;}') +else TARGET_EF_HASH := $(shell echo -n -- "$(EXTRA_FLAGS)" "$(OPTIONS)" "$(DEBUG_FLAGS)" "$(DEVICE_FLAGS)" "$(TARGET_FLAGS)" | openssl dgst -md5 -r | awk '{print $$1;}') +endif + TARGET_EF_HASH_FILE := $(TARGET_OBJ_DIR)/.efhash_$(TARGET_EF_HASH) CLEAN_ARTIFACTS := $(TARGET_BIN)