From 8d9a7fd22836de6aa16c9d208212092805fc5641 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 23 Feb 2023 10:14:04 +1100 Subject: [PATCH] stm32/Makefile: Clean up nested if-else to chained if-else-if. Makefile's support "else ifdef", so use it to make the logic clearer. Also dedent some associated lines for consistency. Signed-off-by: Damien George --- ports/stm32/Makefile | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index 5774f9de5b..1fd2757c4a 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -121,14 +121,12 @@ endif # Configure floating point support ifeq ($(MICROPY_FLOAT_IMPL),double) CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_DOUBLE -else -ifeq ($(MICROPY_FLOAT_IMPL),none) +else ifeq ($(MICROPY_FLOAT_IMPL),none) CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_NONE else CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT CFLAGS += -fsingle-precision-constant endif -endif LDFLAGS += -nostdlib -L $(LD_DIR) $(addprefix -T,$(LD_FILES)) -Wl,-Map=$(@:.elf=.map) -Wl,--cref LDFLAGS += -Wl,--defsym=_estack_reserve=8 @@ -369,8 +367,7 @@ CSUPEROPT = -Os # save some code space SRC_O += \ resethandler_m0.o \ shared/runtime/gchelper_thumb1.o -else -ifeq ($(MCU_SERIES),l1) +else ifeq ($(MCU_SERIES),l1) CFLAGS += -DUSE_HAL_DRIVER SRC_O += \ resethandler_m3.o \ @@ -381,7 +378,6 @@ SRC_O += \ resethandler.o \ shared/runtime/gchelper_thumb2.o endif -endif HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ hal.c \ @@ -442,21 +438,17 @@ HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ endif ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),g0 g4)) - HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_, hal_fdcan.c) +HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_, hal_fdcan.c) endif ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),STM32H743xx STM32H747xx STM32H750xx STM32H7A3xx STM32H7A3xxQ STM32H7B3xx STM32H7B3xxQ)) - HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_, hal_fdcan.c) -else -ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 f4 f7 h7)) - HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_, hal_can.c) -else -ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),l4)) +HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_, hal_fdcan.c) +else ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 f4 f7 h7)) +HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_, hal_can.c) +else ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),l4)) HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/Legacy/stm32$(MCU_SERIES)xx_, hal_can.c) $(BUILD)/$(STM32LIB_HAL_BASE)/Src/Legacy/stm32$(MCU_SERIES)xx_hal_can.o: CFLAGS += -Wno-error=cpp endif -endif -endif ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 f4 f7 g0 l0)) HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\