Merge pull request #11270 from haslinghuis/rename_attr
[betaflight.git] / make / targets.mk
blob883d5713da3bfa81f649c5bb29c2cae196fff391
1 include $(ROOT)/make/targets_list.mk
3 ifeq ($(filter $(TARGET),$(NOBUILD_TARGETS)), $(TARGET))
4 ALTERNATES := $(sort $(filter-out target, $(basename $(notdir $(wildcard $(ROOT)/src/main/target/$(TARGET)/*.mk)))))
5 $(error The target specified, $(TARGET), cannot be built. Use one of the ALT targets: $(ALTERNATES))
6 endif
8 BASE_TARGET := $(call get_base_target,$(TARGET))
9 # silently ignore if the file is not present. Allows for target specific.
10 -include $(ROOT)/src/main/target/$(BASE_TARGET)/$(TARGET).mk
12 ifeq ($(filter $(TARGET),$(OPBL_TARGETS)), $(TARGET))
13 OPBL = yes
14 endif
16 # silently ignore if the file is not present. Allows for target defaults.
17 -include $(ROOT)/src/main/target/$(BASE_TARGET)/target.mk
19 F4_TARGETS := $(F405_TARGETS) $(F411_TARGETS) $(F446_TARGETS)
20 F7_TARGETS := $(F7X2RE_TARGETS) $(F7X5XE_TARGETS) $(F7X5XG_TARGETS) $(F7X5XI_TARGETS) $(F7X6XG_TARGETS)
21 G4_TARGETS := $(G47X_TARGETS)
22 H7_TARGETS := $(H743xI_TARGETS) $(H750xB_TARGETS) $(H7A3xI_TARGETS) $(H7A3xIQ_TARGETS) $(H723xG_TARGETS) $(H725xG_TARGETS) $(H730xB_TARGETS)
24 ifeq ($(filter $(TARGET),$(VALID_TARGETS)),)
25 $(error Target '$(TARGET)' is not valid, must be one of $(VALID_TARGETS). Have you prepared a valid target.mk?)
26 endif
28 ifeq ($(filter $(TARGET),$(F1_TARGETS) $(F3_TARGETS) $(F4_TARGETS) $(F7_TARGETS) $(G4_TARGETS) $(H7_TARGETS) $(SITL_TARGETS)),)
29 $(error Target '$(TARGET)' has not specified a valid STM group, must be one of F1, F3, F405, F411, F446, F7X2RE, F7X5XE, F7X5XG, F7X5XI, F7X6XG, G47X or H7X3XI. Have you prepared a valid target.mk?)
30 endif
32 ifeq ($(TARGET),$(filter $(TARGET),$(F3_TARGETS)))
33 TARGET_MCU := STM32F3
35 else ifeq ($(TARGET),$(filter $(TARGET), $(F4_TARGETS)))
36 TARGET_MCU := STM32F4
38 else ifeq ($(TARGET),$(filter $(TARGET), $(F7_TARGETS)))
39 TARGET_MCU := STM32F7
41 else ifeq ($(TARGET),$(filter $(TARGET), $(G4_TARGETS)))
42 TARGET_MCU := STM32G4
44 else ifeq ($(TARGET),$(filter $(TARGET), $(H7_TARGETS)))
45 TARGET_MCU := STM32H7
47 else ifeq ($(TARGET),$(filter $(TARGET), $(SITL_TARGETS)))
48 TARGET_MCU := SITL
49 SIMULATOR_BUILD = yes
51 else ifeq ($(TARGET),$(filter $(TARGET), $(F1_TARGETS)))
52 TARGET_MCU := STM32F1
53 else
54 $(error Unknown target MCU specified.)
55 endif
57 ifneq ($(BASE_TARGET), $(TARGET))
58 TARGET_FLAGS := $(TARGET_FLAGS) -D$(BASE_TARGET)
59 endif
61 TARGET_FLAGS := $(TARGET_FLAGS) -D$(TARGET_MCU)