1 OFFICIAL_TARGETS
= ALIENFLIGHTF3 ALIENFLIGHTF4 ANYFCF7 BETAFLIGHTF3 BLUEJAYF4 FURYF4 REVO SIRINFPV SPARKY SPRACINGF3 SPRACINGF3EVO SPRACINGF3NEO SPRACINGF4EVO SPRACINGF7DUAL STM32F3DISCOVERY
2 SKIP_TARGETS
:= ALIENWHOOP MOTOLABF4
3 ALT_TARGETS
= $(sort $(filter-out target
, $(basename $(notdir $(wildcard $(ROOT
)/src
/main
/target
/*/*.mk
)))))
4 OPBL_TARGETS
= $(filter %_OPBL
, $(ALT_TARGETS
))
5 OSD_SLAVE_TARGETS
= SPRACINGF3OSD
7 VALID_TARGETS
= $(dir $(wildcard $(ROOT
)/src
/main
/target
/*/target.mk
))
8 VALID_TARGETS
:= $(subst /,, $(subst .
/src
/main
/target
/,, $(VALID_TARGETS
)))
9 VALID_TARGETS
:= $(VALID_TARGETS
) $(ALT_TARGETS
)
10 VALID_TARGETS
:= $(sort $(VALID_TARGETS
))
11 VALID_TARGETS
:= $(filter-out $(SKIP_TARGETS
), $(VALID_TARGETS
))
13 ifeq ($(filter $(TARGET
),$(SKIP_TARGETS
)), $(TARGET
))
14 ALTERNATES
:= $(sort $(filter-out target
, $(basename $(notdir $(wildcard $(ROOT
)/src
/main
/target
/$(TARGET
)/*.mk
)))))
15 $(error The target specified
, $(TARGET
), cannot be built. Use one of the ALT targets
: $(ALTERNATES
))
18 UNSUPPORTED_TARGETS
:= \
28 SUPPORTED_TARGETS
:= $(filter-out $(UNSUPPORTED_TARGETS
), $(VALID_TARGETS
))
136 GROUP_OTHER_TARGETS
:= $(filter-out $(GROUP_1_TARGETS
) $(GROUP_2_TARGETS
) $(GROUP_3_TARGETS
) $(GROUP_4_TARGETS
), $(SUPPORTED_TARGETS
))
138 ifeq ($(filter $(TARGET
),$(ALT_TARGETS
)), $(TARGET
))
139 BASE_TARGET
:= $(firstword $(subst /,, $(subst .
/src
/main
/target
/,, $(dir $(wildcard $(ROOT
)/src
/main
/target
/*/$(TARGET
).mk
)))))
140 include $(ROOT
)/src
/main
/target
/$(BASE_TARGET
)/$(TARGET
).mk
142 BASE_TARGET
:= $(TARGET
)
145 ifeq ($(filter $(TARGET
),$(OPBL_TARGETS
)), $(TARGET
))
149 ifeq ($(filter $(TARGET
),$(OSD_SLAVE_TARGETS
)), $(TARGET
))
157 # silently ignore if the file is not present. Allows for target specific.
158 -include $(ROOT
)/src
/main
/target
/$(BASE_TARGET
)/target.mk
160 F4_TARGETS
:= $(F405_TARGETS
) $(F411_TARGETS
) $(F446_TARGETS
)
161 F7_TARGETS
:= $(F7X2RE_TARGETS
) $(F7X5XE_TARGETS
) $(F7X5XG_TARGETS
) $(F7X5XI_TARGETS
) $(F7X6XG_TARGETS
)
163 ifeq ($(filter $(TARGET
),$(VALID_TARGETS
)),)
164 $(error Target
'$(TARGET)' is not valid
, must be one of
$(VALID_TARGETS
). Have you prepared a valid target.mk?
)
167 ifeq ($(filter $(TARGET
),$(F1_TARGETS
) $(F3_TARGETS
) $(F4_TARGETS
) $(F7_TARGETS
) $(SITL_TARGETS
)),)
168 $(error Target
'$(TARGET)' has not specified a valid STM group
, must be one of F1
, F3
, F405
, F411 or F7x5. Have you prepared a valid target.mk?
)
171 ifeq ($(TARGET
),$(filter $(TARGET
),$(F3_TARGETS
)))
172 TARGET_MCU
:= STM32F3
174 else ifeq ($(TARGET
),$(filter $(TARGET
), $(F4_TARGETS
)))
175 TARGET_MCU
:= STM32F4
177 else ifeq ($(TARGET
),$(filter $(TARGET
), $(F7_TARGETS
)))
178 TARGET_MCU
:= STM32F7
180 else ifeq ($(TARGET
),$(filter $(TARGET
), $(SITL_TARGETS
)))
183 else ifeq ($(TARGET
),$(filter $(TARGET
), $(F1_TARGETS
)))
184 TARGET_MCU
:= STM32F1
186 $(error Unknown target MCU specified.
)
189 ifneq ($(BASE_TARGET
), $(TARGET
))
190 TARGET_FLAGS
:= $(TARGET_FLAGS
) -D
$(BASE_TARGET
)
193 TARGET_FLAGS
:= $(TARGET_FLAGS
) -D
$(TARGET_MCU
)