Handle a lack of trailing newline in config file. (#8942)
[betaflight.git] / make / source.mk
blobc248b3b36ae15e8ae8cb9b4c3d34260e1c20ad4d
1 COMMON_SRC = \
2 build/build_config.c \
3 build/debug.c \
4 build/version.c \
5 $(TARGET_DIR_SRC) \
6 main.c \
7 $(addprefix pg/,$(notdir $(wildcard $(SRC_DIR)/pg/*.c))) \
8 $(addprefix common/,$(notdir $(wildcard $(SRC_DIR)/common/*.c))) \
9 $(addprefix config/,$(notdir $(wildcard $(SRC_DIR)/config/*.c))) \
10 cli/cli.c \
11 cli/settings.c \
12 drivers/adc.c \
13 drivers/dshot.c \
14 drivers/dshot_dpwm.c \
15 drivers/dshot_command.c \
16 drivers/buf_writer.c \
17 drivers/bus.c \
18 drivers/bus_i2c_config.c \
19 drivers/bus_i2c_busdev.c \
20 drivers/bus_i2c_soft.c \
21 drivers/bus_quadspi.c \
22 drivers/bus_spi.c \
23 drivers/bus_spi_config.c \
24 drivers/bus_spi_pinconfig.c \
25 drivers/buttons.c \
26 drivers/display.c \
27 drivers/dma_reqmap.c \
28 drivers/exti.c \
29 drivers/io.c \
30 drivers/light_led.c \
31 drivers/mco.c \
32 drivers/motor.c \
33 drivers/pinio.c \
34 drivers/pin_pull_up_down.c \
35 drivers/resource.c \
36 drivers/rcc.c \
37 drivers/serial.c \
38 drivers/serial_pinconfig.c \
39 drivers/serial_uart.c \
40 drivers/serial_uart_pinconfig.c \
41 drivers/sound_beeper.c \
42 drivers/stack_check.c \
43 drivers/system.c \
44 drivers/timer_common.c \
45 drivers/timer.c \
46 drivers/transponder_ir_arcitimer.c \
47 drivers/transponder_ir_ilap.c \
48 drivers/transponder_ir_erlt.c \
49 fc/board_info.c \
50 fc/config.c \
51 fc/dispatch.c \
52 fc/hardfaults.c \
53 fc/tasks.c \
54 fc/runtime_config.c \
55 fc/stats.c \
56 io/beeper.c \
57 io/piniobox.c \
58 io/serial.c \
59 io/smartaudio_protocol.c \
60 io/statusindicator.c \
61 io/tramp_protocol.c \
62 io/transponder_ir.c \
63 io/usb_cdc_hid.c \
64 io/usb_msc.c \
65 msp/msp.c \
66 msp/msp_box.c \
67 msp/msp_serial.c \
68 scheduler/scheduler.c \
69 sensors/adcinternal.c \
70 sensors/battery.c \
71 sensors/current.c \
72 sensors/voltage.c \
73 target/config_helper.c \
74 fc/init.c \
75 fc/controlrate_profile.c \
76 drivers/camera_control.c \
77 drivers/accgyro/gyro_sync.c \
78 drivers/pwm_esc_detect.c \
79 drivers/pwm_output.c \
80 drivers/rx/rx_spi.c \
81 drivers/rx/rx_xn297.c \
82 drivers/rx/rx_pwm.c \
83 drivers/serial_softserial.c \
84 fc/core.c \
85 fc/rc.c \
86 fc/rc_adjustments.c \
87 fc/rc_controls.c \
88 fc/rc_modes.c \
89 flight/position.c \
90 flight/failsafe.c \
91 flight/gps_rescue.c \
92 flight/gyroanalyse.c \
93 flight/imu.c \
94 flight/interpolated_setpoint.c \
95 flight/mixer.c \
96 flight/mixer_tricopter.c \
97 flight/pid.c \
98 flight/rpm_filter.c \
99 flight/servos.c \
100 flight/servos_tricopter.c \
101 io/serial_4way.c \
102 io/serial_4way_avrootloader.c \
103 io/serial_4way_stk500v2.c \
104 rx/ibus.c \
105 rx/jetiexbus.c \
106 rx/msp.c \
107 rx/pwm.c \
108 rx/rx.c \
109 rx/rx_spi.c \
110 rx/rx_spi_common.c \
111 rx/crsf.c \
112 rx/sbus.c \
113 rx/sbus_channels.c \
114 rx/spektrum.c \
115 rx/srxl2.c \
116 io/spektrum_vtx_control.c \
117 io/spektrum_rssi.c \
118 rx/sumd.c \
119 rx/sumh.c \
120 rx/xbus.c \
121 rx/fport.c \
122 sensors/acceleration.c \
123 sensors/boardalignment.c \
124 sensors/compass.c \
125 sensors/gyro.c \
126 sensors/initialisation.c \
127 blackbox/blackbox.c \
128 blackbox/blackbox_encoding.c \
129 blackbox/blackbox_io.c \
130 cms/cms.c \
131 cms/cms_menu_blackbox.c \
132 cms/cms_menu_builtin.c \
133 cms/cms_menu_failsafe.c \
134 cms/cms_menu_gps_rescue.c\
135 cms/cms_menu_imu.c \
136 cms/cms_menu_ledstrip.c \
137 cms/cms_menu_misc.c \
138 cms/cms_menu_osd.c \
139 cms/cms_menu_power.c \
140 cms/cms_menu_saveexit.c \
141 cms/cms_menu_vtx_rtc6705.c \
142 cms/cms_menu_vtx_smartaudio.c \
143 cms/cms_menu_vtx_tramp.c \
144 drivers/display_ug2864hsweg01.c \
145 drivers/light_ws2811strip.c \
146 drivers/rangefinder/rangefinder_hcsr04.c \
147 drivers/rangefinder/rangefinder_lidartf.c \
148 drivers/serial_escserial.c \
149 drivers/vtx_common.c \
150 drivers/vtx_table.c \
151 io/dashboard.c \
152 io/displayport_max7456.c \
153 io/displayport_msp.c \
154 io/displayport_oled.c \
155 io/displayport_srxl.c \
156 io/displayport_crsf.c \
157 io/displayport_hott.c \
158 io/rcdevice_cam.c \
159 io/rcdevice.c \
160 io/gps.c \
161 io/ledstrip.c \
162 io/pidaudio.c \
163 osd/osd.c \
164 osd/osd_elements.c \
165 sensors/barometer.c \
166 sensors/rangefinder.c \
167 telemetry/telemetry.c \
168 telemetry/crsf.c \
169 telemetry/srxl.c \
170 telemetry/frsky_hub.c \
171 telemetry/hott.c \
172 telemetry/jetiexbus.c \
173 telemetry/smartport.c \
174 telemetry/ltm.c \
175 telemetry/mavlink.c \
176 telemetry/msp_shared.c \
177 telemetry/ibus.c \
178 telemetry/ibus_shared.c \
179 sensors/esc_sensor.c \
180 io/vtx.c \
181 io/vtx_rtc6705.c \
182 io/vtx_smartaudio.c \
183 io/vtx_tramp.c \
184 io/vtx_control.c
186 COMMON_DEVICE_SRC = \
187 $(CMSIS_SRC) \
188 $(DEVICE_STDPERIPH_SRC)
190 COMMON_SRC := $(COMMON_SRC) $(COMMON_DEVICE_SRC)
192 ifeq ($(EXST),yes)
193 TARGET_FLAGS := -DUSE_EXST $(TARGET_FLAGS)
194 endif
196 ifeq ($(RAM_BASED),yes)
197 TARGET_FLAGS := -DUSE_EXST -DCONFIG_IN_RAM -DRAMBASED $(TARGET_FLAGS)
198 endif
200 ifeq ($(SIMULATOR_BUILD),yes)
201 TARGET_FLAGS := -DSIMULATOR_BUILD $(TARGET_FLAGS)
202 endif
204 SPEED_OPTIMISED_SRC := ""
205 SIZE_OPTIMISED_SRC := ""
207 ifneq ($(TARGET),$(filter $(TARGET),$(F1_TARGETS)))
208 SPEED_OPTIMISED_SRC := $(SPEED_OPTIMISED_SRC) \
209 common/encoding.c \
210 common/filter.c \
211 common/maths.c \
212 common/typeconversion.c \
213 drivers/accgyro/accgyro_fake.c \
214 drivers/accgyro/accgyro_mpu.c \
215 drivers/accgyro/accgyro_mpu3050.c \
216 drivers/accgyro/accgyro_mpu6050.c \
217 drivers/accgyro/accgyro_mpu6500.c \
218 drivers/accgyro/accgyro_spi_bmi160.c \
219 drivers/accgyro/accgyro_spi_icm20689.c \
220 drivers/accgyro/accgyro_spi_mpu6000.c \
221 drivers/accgyro/accgyro_spi_mpu6500.c \
222 drivers/accgyro/accgyro_spi_mpu9250.c \
223 drivers/accgyro_legacy/accgyro_adxl345.c \
224 drivers/accgyro_legacy/accgyro_bma280.c \
225 drivers/accgyro_legacy/accgyro_l3g4200d.c \
226 drivers/accgyro_legacy/accgyro_l3gd20.c \
227 drivers/accgyro_legacy/accgyro_lsm303dlhc.c \
228 drivers/accgyro_legacy/accgyro_mma845x.c \
229 drivers/adc.c \
230 drivers/buf_writer.c \
231 drivers/bus.c \
232 drivers/bus_quadspi.c \
233 drivers/bus_spi.c \
234 drivers/exti.c \
235 drivers/io.c \
236 drivers/pwm_output.c \
237 drivers/rcc.c \
238 drivers/serial.c \
239 drivers/serial_uart.c \
240 drivers/system.c \
241 drivers/timer.c \
242 fc/core.c \
243 fc/tasks.c \
244 fc/rc.c \
245 fc/rc_controls.c \
246 fc/runtime_config.c \
247 flight/gyroanalyse.c \
248 flight/imu.c \
249 flight/mixer.c \
250 flight/pid.c \
251 flight/rpm_filter.c \
252 rx/ibus.c \
253 rx/rx.c \
254 rx/rx_spi.c \
255 rx/crsf.c \
256 rx/sbus.c \
257 rx/sbus_channels.c \
258 rx/spektrum.c \
259 rx/srxl2.c \
260 rx/sumd.c \
261 rx/xbus.c \
262 rx/fport.c \
263 scheduler/scheduler.c \
264 sensors/acceleration.c \
265 sensors/boardalignment.c \
266 sensors/gyro.c \
267 $(CMSIS_SRC) \
268 $(DEVICE_STDPERIPH_SRC) \
270 SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
271 bus_bst_stm32f30x.c \
272 cli/cli.c \
273 cli/settings.c \
274 drivers/barometer/barometer_bmp085.c \
275 drivers/barometer/barometer_bmp280.c \
276 drivers/barometer/barometer_fake.c \
277 drivers/barometer/barometer_ms5611.c \
278 drivers/barometer/barometer_lps.c \
279 drivers/barometer/barometer_qmp6988.c \
280 drivers/bus_i2c_config.c \
281 drivers/bus_spi_config.c \
282 drivers/bus_spi_pinconfig.c \
283 drivers/compass/compass_ak8963.c \
284 drivers/compass/compass_ak8975.c \
285 drivers/compass/compass_fake.c \
286 drivers/compass/compass_hmc5883l.c \
287 drivers/compass/compass_qmc5883l.c \
288 drivers/compass/compass_lis3mdl.c \
289 drivers/display_ug2864hsweg01.c \
290 drivers/inverter.c \
291 drivers/light_ws2811strip.c \
292 drivers/light_ws2811strip_hal.c \
293 drivers/light_ws2811strip_stdperiph.c \
294 drivers/serial_escserial.c \
295 drivers/serial_pinconfig.c \
296 drivers/serial_tcp.c \
297 drivers/serial_uart_init.c \
298 drivers/serial_uart_pinconfig.c \
299 drivers/serial_usb_vcp.c \
300 drivers/transponder_ir_io_hal.c \
301 drivers/transponder_ir_io_stdperiph.c \
302 drivers/vtx_rtc6705_soft_spi.c \
303 drivers/vtx_rtc6705.c \
304 drivers/vtx_common.c \
305 fc/init.c \
306 fc/board_info.c \
307 config/config_eeprom.c \
308 config/feature.c \
309 config/config_streamer.c \
310 i2c_bst.c \
311 io/dashboard.c \
312 io/serial.c \
313 io/serial_4way.c \
314 io/serial_4way_avrootloader.c \
315 io/serial_4way_stk500v2.c \
316 io/transponder_ir.c \
317 io/usb_cdc_hid.c \
318 msp/msp_serial.c \
319 cms/cms.c \
320 cms/cms_menu_blackbox.c \
321 cms/cms_menu_builtin.c \
322 cms/cms_menu_failsafe.c \
323 cms/cms_menu_gps_rescue.c\
324 cms/cms_menu_imu.c \
325 cms/cms_menu_ledstrip.c \
326 cms/cms_menu_misc.c \
327 cms/cms_menu_osd.c \
328 cms/cms_menu_power.c \
329 cms/cms_menu_saveexit.c \
330 cms/cms_menu_vtx_rtc6705.c \
331 cms/cms_menu_vtx_smartaudio.c \
332 cms/cms_menu_vtx_tramp.c \
333 io/vtx.c \
334 io/vtx_rtc6705.c \
335 io/vtx_smartaudio.c \
336 io/vtx_tramp.c \
337 io/vtx_control.c \
338 io/spektrum_vtx_control.c \
339 osd/osd.c \
340 osd/osd_elements.c \
341 pg/pg.h
343 # F4 and F7 optimizations
344 ifneq ($(TARGET),$(filter $(TARGET),$(F3_TARGETS)))
345 SPEED_OPTIMISED_SRC := $(SPEED_OPTIMISED_SRC) \
346 drivers/bus_i2c_hal.c \
347 drivers/bus_spi_ll.c \
348 drivers/max7456.c \
349 drivers/pwm_output_dshot.c \
350 drivers/pwm_output_dshot_shared.c \
351 drivers/pwm_output_dshot_hal.c
352 endif #!F3
353 endif #!F1
355 # check if target.mk supplied
356 SRC := $(STARTUP_SRC) $(MCU_COMMON_SRC) $(TARGET_SRC) $(VARIANT_SRC)
358 # Files that should not be optimized, useful for debugging IMPRECISE cpu faults.
359 # Specify FULL PATH, e.g. "./lib/main/STM32F7/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_sdmmc.c"
360 NOT_OPTIMISED_SRC := $(NOT_OPTIMISED_SRC) \
362 ifneq ($(DSP_LIB),)
364 INCLUDE_DIRS += $(DSP_LIB)/Include
366 SRC += $(DSP_LIB)/Source/BasicMathFunctions/arm_mult_f32.c
367 SRC += $(DSP_LIB)/Source/TransformFunctions/arm_rfft_fast_f32.c
368 SRC += $(DSP_LIB)/Source/TransformFunctions/arm_cfft_f32.c
369 SRC += $(DSP_LIB)/Source/TransformFunctions/arm_rfft_fast_init_f32.c
370 SRC += $(DSP_LIB)/Source/TransformFunctions/arm_cfft_radix8_f32.c
371 SRC += $(DSP_LIB)/Source/CommonTables/arm_common_tables.c
373 SRC += $(DSP_LIB)/Source/ComplexMathFunctions/arm_cmplx_mag_f32.c
374 SRC += $(DSP_LIB)/Source/StatisticsFunctions/arm_max_f32.c
376 SRC += $(wildcard $(DSP_LIB)/Source/*/*.S)
377 endif
379 ifneq ($(filter ONBOARDFLASH,$(FEATURES)),)
380 SRC += \
381 drivers/flash.c \
382 drivers/flash_m25p16.c \
383 drivers/flash_w25n01g.c \
384 drivers/flash_w25m.c \
385 io/flashfs.c \
386 pg/flash.c \
387 $(MSC_SRC)
388 endif
390 SRC += $(COMMON_SRC)
392 #excludes
393 SRC := $(filter-out $(MCU_EXCLUDES), $(SRC))
395 ifneq ($(filter SDCARD_SPI,$(FEATURES)),)
396 SRC += \
397 drivers/sdcard.c \
398 drivers/sdcard_spi.c \
399 drivers/sdcard_standard.c \
400 io/asyncfatfs/asyncfatfs.c \
401 io/asyncfatfs/fat_standard.c \
402 $(MSC_SRC)
403 endif
405 ifneq ($(filter SDCARD_SDIO,$(FEATURES)),)
406 SRC += \
407 drivers/sdcard.c \
408 drivers/sdcard_sdio_baremetal.c \
409 drivers/sdcard_standard.c \
410 io/asyncfatfs/asyncfatfs.c \
411 io/asyncfatfs/fat_standard.c \
412 pg/sdio.c \
413 $(MSC_SRC)
414 endif
416 ifneq ($(filter VCP,$(FEATURES)),)
417 SRC += $(VCP_SRC)
418 endif
420 ifneq ($(filter MSC,$(FEATURES)),)
421 SRC += $(MSC_SRC)
422 endif
423 # end target specific make file checks
425 # Search path and source files for the ST stdperiph library
426 VPATH := $(VPATH):$(STDPERIPH_DIR)/src