Post-cleanup of F7 optimizations (#5729)
[betaflight.git] / make / targets.mk
blob9ec2481fedd3df5d98d467c3ae78e5925c8de200
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))
16 endif
18 UNSUPPORTED_TARGETS := \
19 AFROMINI \
20 ALIENFLIGHTF1 \
21 BEEBRAIN \
22 CC3D \
23 CC3D_OPBL \
24 CJMCU \
25 MICROSCISKY \
26 NAZE
28 SUPPORTED_TARGETS := $(filter-out $(UNSUPPORTED_TARGETS), $(VALID_TARGETS))
30 GROUP_1_TARGETS := \
31 AIORACERF3 \
32 AIR32 \
33 AIRBOTF4 \
34 AIRBOTF4SD \
35 AIRHEROF3 \
36 ALIENFLIGHTF3 \
37 ALIENFLIGHTF4 \
38 ALIENFLIGHTNGF7 \
39 ALIENWHOOPF4 \
40 ALIENWHOOPF7 \
41 ANYFCF7 \
42 BEEBRAIN_V2D \
43 BEEBRAIN_V2F \
44 BEEROTORF4 \
45 BETAFLIGHTF3 \
46 BETAFLIGHTF4 \
47 BLUEJAYF4 \
48 CHEBUZZF3 \
49 CLRACINGF4 \
50 COLIBRI \
51 COLIBRI_OPBL \
52 COLIBRI_RACE \
54 GROUP_2_TARGETS := \
55 DOGE \
56 DYSF4PRO \
57 EACHIF3 \
58 ELLE0 \
59 F4BY \
60 FISHDRONEF4 \
61 FLIP32F3OSD \
62 FF_ACROWHOOPSP \
63 FF_FORTINIF4 \
64 FF_KOMBINI \
65 FF_PIKOBLX \
66 FF_PIKOF4 \
67 FF_RADIANCE \
68 FPVM_BETAFLIGHTF7 \
69 FRSKYF3 \
70 FRSKYF4 \
71 FURYF3 \
72 FURYF3OSD \
73 FURYF4 \
74 FURYF4OSD \
75 FURYF7 \
76 IMPULSERCF3 \
77 IRCFUSIONF3 \
78 ISHAPEDF3 \
79 KAKUTEF4 \
80 KAKUTEF7 \
81 KISSCC \
82 KISSFC \
83 KIWIF4 \
84 KIWIF4V2 \
85 KROOZX
87 GROUP_3_TARGETS := \
88 LUX_RACE \
89 LUXV2_RACE \
90 LUXF4OSD \
91 MLTEMPF4 \
92 MLTYPHF4 \
93 MOTOLAB \
94 MULTIFLITEPICO \
95 NERO \
96 NUCLEOF7 \
97 OMNIBUS \
98 OMNIBUSF4 \
99 OMNIBUSF4SD \
100 OMNIBUSF7 \
101 OMNIBUSF7V2 \
102 PLUMF4 \
103 PODIUMF4 \
104 RACEBASE \
105 RCEXPLORERF3 \
106 RG_SSD_F3 \
107 REVO \
108 REVO_OPBL \
109 REVOLT \
110 REVONANO \
111 RMDO
113 GROUP_4_TARGETS := \
114 SINGULARITY \
115 SIRINFPV \
116 SOULF4 \
117 SPARKY \
118 SPARKY2 \
119 SPRACINGF3 \
120 SPRACINGF3EVO \
121 SPRACINGF3MINI \
122 SPRACINGF3MQ \
123 SPRACINGF3NEO \
124 SPRACINGF3OSD \
125 SPRACINGF4EVO \
126 SPRACINGF4NEO \
127 SPRACINGF7DUAL \
128 STM32F3DISCOVERY \
129 TINYBEEF3 \
130 TINYFISH \
131 VRRACE \
132 XRACERF4 \
133 X_RACERSPI \
134 ZCOREF3
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
141 else
142 BASE_TARGET := $(TARGET)
143 endif
145 ifeq ($(filter $(TARGET),$(OPBL_TARGETS)), $(TARGET))
146 OPBL = yes
147 endif
149 ifeq ($(filter $(TARGET),$(OSD_SLAVE_TARGETS)), $(TARGET))
150 # build an OSD SLAVE
151 OSD_SLAVE = yes
152 else
153 # build an FC
154 FC = yes
155 endif
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?)
165 endif
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?)
169 endif
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)))
181 TARGET_MCU := SITL
183 else ifeq ($(TARGET),$(filter $(TARGET), $(F1_TARGETS)))
184 TARGET_MCU := STM32F1
185 else
186 $(error Unknown target MCU specified.)
187 endif
189 ifneq ($(BASE_TARGET), $(TARGET))
190 TARGET_FLAGS := $(TARGET_FLAGS) -D$(BASE_TARGET)
191 endif
193 TARGET_FLAGS := $(TARGET_FLAGS) -D$(TARGET_MCU)