Cleanup of defines for motor protocols (#11993)
[betaflight.git] / make / targets.mk
blob72319c271d3ae76244d031a557004d0be026a243
1 BASE_TARGETS = $(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(ROOT)/src/main/target/*/target.mk)))))
2 VALID_TARGETS = $(sort $(BASE_TARGETS))
4 CI_TARGETS := $(VALID_TARGETS)
6 # silently ignore if the file is not present. Allows for target defaults.
7 -include $(ROOT)/src/main/target/$(TARGET)/target.mk
9 F4_TARGETS := $(F405_TARGETS) $(F411_TARGETS) $(F446_TARGETS)
10 F7_TARGETS := $(F7X2RE_TARGETS) $(F7X5XE_TARGETS) $(F7X5XG_TARGETS) $(F7X5XI_TARGETS) $(F7X6XG_TARGETS)
11 G4_TARGETS := $(G47X_TARGETS)
12 H7_TARGETS := $(H743xI_TARGETS) $(H750xB_TARGETS) $(H7A3xI_TARGETS) $(H7A3xIQ_TARGETS) $(H723xG_TARGETS) $(H725xG_TARGETS) $(H730xB_TARGETS)
14 ifeq ($(filter $(TARGET),$(VALID_TARGETS)),)
15 $(error Target '$(TARGET)' is not valid, must be one of $(VALID_TARGETS). Have you prepared a valid target.mk?)
16 endif
18 ifeq ($(filter $(TARGET), $(F4_TARGETS) $(F7_TARGETS) $(G4_TARGETS) $(H7_TARGETS) $(SITL_TARGETS)),)
19 $(error Target '$(TARGET)' has not specified a valid STM group, must be one of F405, F411, F446, F7X2RE, F7X5XE, F7X5XG, F7X5XI, F7X6XG, G47X or H7X3XI. Have you prepared a valid target.mk?)
20 endif
22 ifeq ($(TARGET),$(filter $(TARGET), $(F4_TARGETS)))
23 TARGET_MCU := STM32F4
25 else ifeq ($(TARGET),$(filter $(TARGET), $(F7_TARGETS)))
26 TARGET_MCU := STM32F7
28 else ifeq ($(TARGET),$(filter $(TARGET), $(G4_TARGETS)))
29 TARGET_MCU := STM32G4
31 else ifeq ($(TARGET),$(filter $(TARGET), $(H7_TARGETS)))
32 TARGET_MCU := STM32H7
34 else ifeq ($(TARGET),$(filter $(TARGET), $(SITL_TARGETS)))
35 TARGET_MCU := SITL
36 SIMULATOR_BUILD = yes
38 else
39 $(error Unknown target MCU specified.)
40 endif
42 TARGET_FLAGS := $(TARGET_FLAGS) -D$(TARGET_MCU)