diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include index 53ff35c3d4..944d406533 100644 --- a/boards/native/Makefile.include +++ b/boards/native/Makefile.include @@ -77,9 +77,10 @@ endif EEPROM_FILE ?= $(BINDIR)/native.eeprom # set the eeprom file flags only when the periph_eeprom feature is used. -# NOTE: This can be turned into normal conditional syntax once #9913 is fixed -EEPROM_FILE_FLAGS = $(if $(filter periph_eeprom,$(FEATURES_USED)),--eeprom $(EEPROM_FILE),) -TERMFLAGS += $(EEPROM_FILE_FLAGS) +ifneq (,$(filter periph_eeprom,$(FEATURES_USED))) + EEPROM_FILE_FLAGS = --eeprom $(EEPROM_FILE) + TERMFLAGS += $(EEPROM_FILE_FLAGS) +endif TERMFLAGS += $(PORT) diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include index e81e688225..15030091d4 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -43,8 +43,10 @@ INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/esp32/include INCLUDES += -I$(ESP32_SDK_DIR)/components/soc/include INCLUDES += -I$(RIOTCPU)/$(CPU) -INCLUDES += $(if $(filter esp_eth,$(USEMODULE)),-I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet) -INCLUDES += $(if $(filter esp_eth,$(USEMODULE)),-I$(ESP32_SDK_DIR)/components/ethernet/include) +ifneq (,$(filter esp_eth,$(USEMODULE))) + INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet + INCLUDES += -I$(ESP32_SDK_DIR)/components/ethernet/include +endif CFLAGS += -DSDK_NOT_USED -DCONFIG_FREERTOS_UNICORE=1 -DESP_PLATFORM CFLAGS += -DLOG_TAG_IN_BRACKETS @@ -58,18 +60,20 @@ LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp32.rom.nanofmt.ld LINKFLAGS += -nostdlib -lgcc -Wl,-gc-sections # Baselibs needed when using esp_wifi_any pseudomodule -_ESP_WIFI_ANY_BASELIBS = -lcore -lrtc -lnet80211 -lpp -lcoexist -lwps -lwpa -lwpa2 -_ESP_WIFI_ANY_BASELIBS += -lphy -lstdc++ +ifneq (,$(filter esp_wifi_any,$(USEMODULE))) + BASELIBS += -lcore -lrtc -lnet80211 -lpp -lcoexist -lwps -lwpa -lwpa2 + BASELIBS += -lphy -lstdc++ +endif # Baselibs needed when using esp_now module -_ESP_NOW_BASELIBS = -lespnow -lmesh +ifneq (,$(filter esp_now,$(USEMODULE))) + BASELIBS += -lespnow -lmesh +endif -# NOTE: These checks can be turned into a normal conditional when #9913 is fixed -BASELIBS += $(if $(filter esp_wifi_any,$(USEMODULE)),$(_ESP_WIFI_ANY_BASELIBS)) -BASELIBS += $(if $(filter esp_now,$(USEMODULE)),$(_ESP_NOW_BASELIBS)) - -UNDEF += $(if $(filter cpp,$(FEATURES_USED)),$(BINDIR)/esp_cxx/cxa_guard.o) -BASELIBS += $(if $(filter cpp,$(FEATURES_USED)),-lstdc++) +ifneq (,$(filter cpp,$(FEATURES_USED))) + UNDEF += $(BINDIR)/esp_cxx/cxa_guard.o + BASELIBS += -lstdc++ +endif # additional flasher configuration for ESP32 QEMU ifneq (,$(filter esp_qemu,$(USEMODULE))) diff --git a/cpu/esp8266/Makefile.include b/cpu/esp8266/Makefile.include index 1bbf335991..09e2fbbf5c 100644 --- a/cpu/esp8266/Makefile.include +++ b/cpu/esp8266/Makefile.include @@ -48,11 +48,15 @@ INCLUDES += -I$(ESP8266_RTOS_SDK_DIR)/components/spi_flash/include CFLAGS += -D__ESP_FILE__=__FILE__ -# NOTE: These can be turned into normal conditionals after #9913 is fixed -GDBSTUB_DIR ?= $(if $(filter esp_gdbstub,$(USEMODULE)),$(RIOTCPU)/$(CPU)/vendor/esp-gdbstub) -CFLAGS += $(if $(filter esp_gdbstub,$(USEMODULE)),-DGDBSTUB_BREAK_ON_INIT=1) -INCLUDES += $(if $(filter esp_gdbstub,$(USEMODULE)),-I$(GDBSTUB_DIR)) -BASELIBS += $(if $(filter esp_now, $(USEMODULE)), -lespnow) +ifneq (,$(filter esp_gdbstub,$(USEMODULE))) + GDBSTUB_DIR ?= $(RIOTCPU)/$(CPU)/vendor/esp-gdbstub + CFLAGS += -DGDBSTUB_BREAK_ON_INIT=1) + INCLUDES += -I$(GDBSTUB_DIR) +endif + +ifneq (,$(filter esp_now,$(USEMODULE))) + BASELIBS += -lespnow +endif BASELIBS += -lgcc -lwpa -lcore -lnet80211 -lphy -lpp -lstdc++ diff --git a/cpu/esp_common/Makefile.include b/cpu/esp_common/Makefile.include index b52f0c4617..cfdcf34125 100644 --- a/cpu/esp_common/Makefile.include +++ b/cpu/esp_common/Makefile.include @@ -42,7 +42,11 @@ ARFLAGS = rcs CFLAGS_DBG ?= -ggdb -g3 # override default CFLAGS_OPT in case module esp_gdb is enabled -CFLAGS_OPT ?= $(if $(filter esp_gdb,$(USEMODULE)),-Og,-Os) +ifneq (,$(filter esp_gdb,$(USEMODULE))) + CFLAGS_OPT ?= -Og +else + CFLAGS_OPT ?= -Os +endif CFLAGS += $(CFLAGS_OPT) $(CFLAGS_DBG) @@ -51,9 +55,10 @@ ifneq (,$(filter esp_qemu,$(USEMODULE))) CFLAGS += -DQEMU endif -# NOTE: These checks can be turned into normal conditionals when #9913 is fixed # use 32 priority levels if any WiFi interface or the ETH interface is used -CFLAGS += $(if $(filter esp_wifi_any esp_eth,$(USEMODULE)),-DSCHED_PRIO_LEVELS=32) +ifneq (,$(filter esp_wifi_any esp_eth,$(USEMODULE))) + CFLAGS += -DSCHED_PRIO_LEVELS=32 +endif # The threads for handling the ESP hardware have the priorities from 2 to 4. # The priority of lwIP TCPIP thread should be lower than these priorities. @@ -62,9 +67,12 @@ ifneq (,$(filter lwip,$(USEMODULE))) endif # if SPI RAM is enabled, the qout flash mode has to be used -# NOTE: These checks can be turned into normal conditionals when #9913 is fixed _FLASH_MODE_PREV := $(FLASH_MODE) -FLASH_MODE = $(if $(filter esp_spi_ram,$(USEMODULE)),qout,$(_FLASH_MODE_PREV)) +ifneq (,$(filter esp_spi_ram,$(USEMODULE))) + FLASH_MODE = qout +else + FLASH_MODE = $(_FLASH_MODE_PREV) +endif # set CFLAG for the correspondant FLASH_MODE CFLAGS += $(if $(findstring qout,$(FLASH_MODE)),-DFLASH_MODE_QOUT=1) @@ -82,9 +90,12 @@ LINKFLAGS += -nostdlib -Wl,-gc-sections -Wl,-static # LINKFLAGS += -Wl,--verbose # LINKFLAGS += -Wl,--print-gc-sections -# NOTE: These checks can be turned into normal conditionals when #9913 is fixed -BOOTLOADER_COLOR = $(if $(filter esp_log_colored,$(USEMODULE)),_colors) -BOOTLOADER_INFO = $(if $(filter esp_log_startup,$(USEMODULE)),_info) +ifneq (,$(filter esp_log_colored,$(USEMODULE))) + BOOTLOADER_COLOR = _colors +endif +ifneq (,$(filter esp_log_startup,$(USEMODULE))) + BOOTLOADER_INFO = _info +endif BOOTLOADER_BIN = bootloader$(BOOTLOADER_COLOR)$(BOOTLOADER_INFO).bin @@ -132,7 +143,8 @@ else FFLAGS += 0x10000 $(FLASHFILE).bin endif -# NOTE: These checks can be turned into normal conditionals when #9913 is fixed # increase the test timeout for file system tests that use the SPI flash drive -RIOT_TEST_TIMEOUT = $(if $(filter spiffs littlefs,$(USEMODULE)),120) -$(call target-export-variables,test,RIOT_TEST_TIMEOUT) +ifneq (,$(filter spiffs littlefs,$(USEMODULE))) + RIOT_TEST_TIMEOUT = 20 + $(call target-export-variables,test,RIOT_TEST_TIMEOUT) +endif diff --git a/cpu/mips32r2_common/Makefile.include b/cpu/mips32r2_common/Makefile.include index bc0a62e75f..96008117de 100644 --- a/cpu/mips32r2_common/Makefile.include +++ b/cpu/mips32r2_common/Makefile.include @@ -1,5 +1,6 @@ INCLUDES += -I$(RIOTCPU)/mips32r2_common/include -# NOTE: This can be turned into normal conditional syntax once #9913 is fixed -CFLAGS += $(if $(filter newlib_syscalls_mips_uhi,$(USEMODULE)),-DHAVE_HEAP_STATS,) -LINKFLAGS += $(if $(filter newlib_syscalls_mips_uhi,$(USEMODULE)),-luhi,) +ifneq (,$(filter newlib_syscalls_mips_uhi,$(USEMODULE))) + CFLAGS += -DHAVE_HEAP_STATS + LINKFLAGS += -luhi +endif diff --git a/makefiles/arch/cortexm.inc.mk b/makefiles/arch/cortexm.inc.mk index 72977c948a..2751389fad 100644 --- a/makefiles/arch/cortexm.inc.mk +++ b/makefiles/arch/cortexm.inc.mk @@ -70,8 +70,11 @@ ifneq (llvm, $(TOOLCHAIN)) endif endif # Add soft or hard FPU CFLAGS depending on the module -# NOTE: This can be turned into normal conditional syntax once #9913 is fixed -CFLAGS_FPU ?= $(if $(filter cortexm_fpu,$(USEMODULE)),$(_CORTEX_HW_FPU_CFLAGS),-mfloat-abi=soft) +ifneq (,$(filter cortexm_fpu,$(USEMODULE))) + CFLAGS_FPU ?= $(_CORTEX_HW_FPU_CFLAGS) +else + CFLAGS_FPU ?= -mfloat-abi=soft +endif ifeq ($(CPU_CORE),cortex-m4f) MCPU = cortex-m4