1#
2# Platform Makefile
3#
4
5include $(CHRE_PREFIX)/external/flatbuffers/flatbuffers.mk
6
7# Common Compiler Flags ########################################################
8
9# Include paths.
10COMMON_CFLAGS += -Iplatform/include
11
12# SLPI-specific Compiler Flags #################################################
13
14# Include paths.
15SLPI_CFLAGS += -I$(SLPI_PREFIX)/build/ms
16SLPI_CFLAGS += -I$(SLPI_PREFIX)/build/cust
17SLPI_CFLAGS += -I$(SLPI_PREFIX)/core/api/debugtools
18SLPI_CFLAGS += -I$(SLPI_PREFIX)/core/api/services
19SLPI_CFLAGS += -I$(SLPI_PREFIX)/core/api/kernel/devcfg
20SLPI_CFLAGS += -I$(SLPI_PREFIX)/core/api/kernel/qurt
21SLPI_CFLAGS += -I$(SLPI_PREFIX)/core/api/dal
22SLPI_CFLAGS += -I$(SLPI_PREFIX)/core/api/mproc
23SLPI_CFLAGS += -I$(SLPI_PREFIX)/core/api/systemdrivers
24SLPI_CFLAGS += -I$(SLPI_PREFIX)/platform/inc
25SLPI_CFLAGS += -I$(SLPI_PREFIX)/platform/inc/HAP
26SLPI_CFLAGS += -I$(SLPI_PREFIX)/platform/inc/a1std
27SLPI_CFLAGS += -I$(SLPI_PREFIX)/platform/inc/stddef
28SLPI_CFLAGS += -I$(SLPI_PREFIX)/platform/rtld/inc
29
30SLPI_CFLAGS += -Iplatform/shared/include
31SLPI_CFLAGS += -Iplatform/slpi/include
32
33# We use FlatBuffers in the SLPI platform layer
34SLPI_CFLAGS += $(FLATBUFFERS_CFLAGS)
35
36# SLPI/SEE-specific Compiler Flags #############################################
37
38# Include paths.
39SLPI_SEE_CFLAGS += -I$(SLPI_PREFIX)/chre/chre/src/system/chre/platform/slpi
40SLPI_SEE_CFLAGS += -I$(SLPI_PREFIX)/core/api/kernel/libstd/stringl
41SLPI_SEE_CFLAGS += -I$(SLPI_PREFIX)/qmimsgs/common/api
42SLPI_SEE_CFLAGS += -I$(SLPI_PREFIX)/ssc_api/pb
43SLPI_SEE_CFLAGS += -I$(SLPI_PREFIX)/ssc/framework/cm/inc
44SLPI_SEE_CFLAGS += -I$(SLPI_PREFIX)/ssc/goog/api
45SLPI_SEE_CFLAGS += -I$(SLPI_PREFIX)/ssc/inc
46SLPI_SEE_CFLAGS += -I$(SLPI_PREFIX)/ssc/inc/internal
47SLPI_SEE_CFLAGS += -I$(SLPI_PREFIX)/ssc/inc/utils/nanopb
48
49SLPI_SEE_CFLAGS += -Iplatform/slpi/see/include
50
51SLPI_SEE_CFLAGS += -DCHRE_SLPI_SEE
52
53# Needed to define __SIZEOF_ATTR_THREAD in sns_osa_thread.h, included in
54# sns_memmgr.h.
55SLPI_SEE_CFLAGS += -DSSC_TARGET_HEXAGON
56
57# Defined in slpi_proc/ssc/build/ssc.scons
58SLPI_SEE_CFLAGS += -DPB_FIELD_16BIT
59
60ifeq ($(IMPORT_CHRE_UTILS), true)
61SLPI_SEE_CFLAGS += -DIMPORT_CHRE_UTILS
62endif
63
64# Enable accel calibration and ASH debug dump by default unless overridden
65# explicitly by the environment.
66ifneq ($(CHRE_ENABLE_ACCEL_CAL), false)
67SLPI_SEE_CFLAGS += -DCHRE_ENABLE_ACCEL_CAL
68endif
69
70ifneq ($(CHRE_ENABLE_ASH_DEBUG_DUMP), false)
71SLPI_SEE_CFLAGS += -DCHRE_ENABLE_ASH_DEBUG_DUMP
72endif
73
74# SLPI/QSH-specific Compiler Flags #############################################
75
76# Include paths.
77SLPI_QSH_CFLAGS += -I$(SLPI_PREFIX)/config/cust
78SLPI_QSH_CFLAGS += -I$(SLPI_PREFIX)/qsh/qsh_nanoapp/inc
79SLPI_QSH_CFLAGS += -Iplatform/slpi/see/include
80
81ifeq ($(CHRE_USE_BUFFERED_LOGGING), true)
82SLPI_QSH_CFLAGS += -DCHRE_USE_BUFFERED_LOGGING
83endif
84
85# Define CHRE_SLPI_SEE for the few components that are still shared between QSH
86# and SEE.
87SLPI_QSH_CFLAGS += -DCHRE_SLPI_SEE
88
89# SLPI-specific Source Files ###################################################
90
91SLPI_SRCS += platform/shared/assert.cc
92SLPI_SRCS += platform/shared/chre_api_audio.cc
93SLPI_SRCS += platform/shared/chre_api_core.cc
94SLPI_SRCS += platform/shared/chre_api_gnss.cc
95SLPI_SRCS += platform/shared/chre_api_re.cc
96SLPI_SRCS += platform/shared/chre_api_user_settings.cc
97SLPI_SRCS += platform/shared/chre_api_version.cc
98SLPI_SRCS += platform/shared/chre_api_wifi.cc
99SLPI_SRCS += platform/shared/chre_api_wwan.cc
100SLPI_SRCS += platform/shared/host_protocol_chre.cc
101SLPI_SRCS += platform/shared/host_protocol_common.cc
102SLPI_SRCS += platform/shared/memory_manager.cc
103SLPI_SRCS += platform/shared/nanoapp_load_manager.cc
104SLPI_SRCS += platform/shared/nanoapp/nanoapp_dso_util.cc
105SLPI_SRCS += platform/shared/pal_system_api.cc
106SLPI_SRCS += platform/shared/pw_tokenized_log.cc
107SLPI_SRCS += platform/shared/system_time.cc
108SLPI_SRCS += platform/shared/version.cc
109SLPI_SRCS += platform/slpi/chre_api_re.cc
110SLPI_SRCS += platform/slpi/fatal_error.cc
111SLPI_SRCS += platform/slpi/host_link.cc
112SLPI_SRCS += platform/slpi/init.cc
113SLPI_SRCS += platform/slpi/memory.cc
114SLPI_SRCS += platform/slpi/memory_manager.cc
115SLPI_SRCS += platform/slpi/platform_debug_dump_manager.cc
116SLPI_SRCS += platform/slpi/platform_nanoapp.cc
117SLPI_SRCS += platform/slpi/platform_pal.cc
118SLPI_SRCS += platform/slpi/platform_sensor_type_helpers.cc
119SLPI_SRCS += platform/slpi/system_time.cc
120SLPI_SRCS += platform/slpi/system_time_util.cc
121SLPI_SRCS += platform/slpi/system_timer.cc
122
123# Optional audio support.
124ifeq ($(CHRE_AUDIO_SUPPORT_ENABLED), true)
125SLPI_SRCS += platform/slpi/platform_audio.cc
126endif
127
128# Optional GNSS support.
129ifeq ($(CHRE_GNSS_SUPPORT_ENABLED), true)
130SLPI_SRCS += platform/shared/platform_gnss.cc
131endif
132
133# Optional Wi-Fi support.
134ifeq ($(CHRE_WIFI_SUPPORT_ENABLED), true)
135SLPI_SRCS += platform/shared/platform_wifi.cc
136endif
137
138# Optional WWAN support.
139ifeq ($(CHRE_WWAN_SUPPORT_ENABLED), true)
140SLPI_SRCS += platform/shared/platform_wwan.cc
141endif
142
143# SLPI/SEE-specific Source Files ###############################################
144
145# Optional sensors support.
146ifeq ($(CHRE_SENSORS_SUPPORT_ENABLED), true)
147SLPI_SEE_SRCS += platform/slpi/see/platform_sensor.cc
148SLPI_SEE_SRCS += platform/slpi/see/platform_sensor_manager.cc
149ifneq ($(IMPORT_CHRE_UTILS), true)
150SLPI_SEE_SRCS += platform/slpi/see/see_cal_helper.cc
151SLPI_SEE_SRCS += platform/slpi/see/see_helper.cc
152endif
153
154SLPI_SEE_SRCS += platform/shared/chre_api_sensor.cc
155SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc_api/pb/sns_client.pb.c
156SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc_api/pb/sns_suid.pb.c
157SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc_api/pb/sns_cal.pb.c
158SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc_api/pb/sns_physical_sensor_test.pb.c
159SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc_api/pb/sns_proximity.pb.c
160SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc_api/pb/sns_remote_proc_state.pb.c
161SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc_api/pb/sns_resampler.pb.c
162SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc_api/pb/sns_std.pb.c
163SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc_api/pb/sns_std_sensor.pb.c
164SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc_api/pb/sns_std_type.pb.c
165
166SLPI_SEE_QSK_SRCS += $(SLPI_PREFIX)/chre/chre/src/system/chre/platform/slpi/sns_qmi_client_alt.c
167SLPI_SEE_QMI_SRCS += $(SLPI_PREFIX)/chre/chre/src/system/chre/platform/slpi/sns_qmi_client.c
168endif
169
170SLPI_SEE_SRCS += platform/slpi/see/power_control_manager.cc
171
172ifneq ($(IMPORT_CHRE_UTILS), true)
173SLPI_SEE_SRCS += platform/slpi/see/island_vote_client.cc
174endif
175
176# SLPI/QSH-specific Source Files ###############################################
177
178SLPI_QSH_SRCS += platform/slpi/see/island_vote_client.cc
179SLPI_QSH_SRCS += platform/slpi/see/power_control_manager.cc
180SLPI_QSH_SRCS += platform/slpi/qsh/qsh_shim.cc
181
182ifeq ($(CHRE_USE_BUFFERED_LOGGING), true)
183SLPI_QSH_SRCS += platform/shared/log_buffer.cc
184SLPI_QSH_SRCS += platform/shared/log_buffer_manager.cc
185SLPI_QSH_SRCS += platform/slpi/log_buffer_manager.cc
186endif
187
188
189# Simulator-specific Compiler Flags ############################################
190
191SIM_CFLAGS += -Iplatform/shared/include
192
193# Simulator-specific Source Files ##############################################
194
195SIM_SRCS += platform/linux/chre_api_re.cc
196SIM_SRCS += platform/linux/context.cc
197SIM_SRCS += platform/linux/fatal_error.cc
198SIM_SRCS += platform/linux/host_link.cc
199SIM_SRCS += platform/linux/memory.cc
200SIM_SRCS += platform/linux/memory_manager.cc
201SIM_SRCS += platform/linux/platform_debug_dump_manager.cc
202SIM_SRCS += platform/linux/platform_log.cc
203SIM_SRCS += platform/linux/platform_pal.cc
204SIM_SRCS += platform/linux/platform_sensor_type_helpers.cc
205SIM_SRCS += platform/linux/power_control_manager.cc
206SIM_SRCS += platform/linux/system_time.cc
207SIM_SRCS += platform/linux/system_timer.cc
208SIM_SRCS += platform/linux/platform_nanoapp.cc
209SIM_SRCS += platform/linux/platform_sensor.cc
210SIM_SRCS += platform/linux/platform_sensor_type_helpers.cc
211SIM_SRCS += platform/shared/chre_api_audio.cc
212SIM_SRCS += platform/shared/chre_api_core.cc
213SIM_SRCS += platform/shared/chre_api_gnss.cc
214SIM_SRCS += platform/shared/chre_api_re.cc
215SIM_SRCS += platform/shared/chre_api_sensor.cc
216SIM_SRCS += platform/shared/chre_api_user_settings.cc
217SIM_SRCS += platform/shared/chre_api_version.cc
218SIM_SRCS += platform/shared/chre_api_wifi.cc
219SIM_SRCS += platform/shared/chre_api_wwan.cc
220SIM_SRCS += platform/shared/memory_manager.cc
221SIM_SRCS += platform/shared/nanoapp/nanoapp_dso_util.cc
222SIM_SRCS += platform/shared/pal_sensor_stub.cc
223SIM_SRCS += platform/shared/pal_system_api.cc
224SIM_SRCS += platform/shared/platform_sensor_manager.cc
225SIM_SRCS += platform/shared/system_time.cc
226SIM_SRCS += platform/shared/version.cc
227
228# Optional GNSS support.
229ifeq ($(CHRE_GNSS_SUPPORT_ENABLED), true)
230SIM_SRCS += platform/linux/pal_gnss.cc
231SIM_SRCS += platform/shared/platform_gnss.cc
232endif
233
234# Optional Wi-Fi support.
235ifeq ($(CHRE_WIFI_SUPPORT_ENABLED), true)
236SIM_SRCS += platform/linux/pal_wifi.cc
237SIM_SRCS += platform/shared/platform_wifi.cc
238endif
239
240# Optional WWAN support.
241ifeq ($(CHRE_WWAN_SUPPORT_ENABLED), true)
242SIM_SRCS += platform/linux/pal_wwan.cc
243SIM_SRCS += platform/shared/platform_wwan.cc
244endif
245
246# Linux-specific Compiler Flags ################################################
247
248GOOGLE_X86_LINUX_CFLAGS += -Iplatform/linux/include
249
250# Linux-specific Source Files ##################################################
251
252GOOGLE_X86_LINUX_SRCS += platform/linux/init.cc
253GOOGLE_X86_LINUX_SRCS += platform/linux/assert.cc
254
255# Optional audio support.
256ifeq ($(CHRE_AUDIO_SUPPORT_ENABLED), true)
257GOOGLE_X86_LINUX_SRCS += platform/linux/audio_source.cc
258GOOGLE_X86_LINUX_SRCS += platform/linux/platform_audio.cc
259endif
260
261# Android-specific Compiler Flags ##############################################
262
263# Add the Android include search path for Android-specific header files.
264GOOGLE_ARM64_ANDROID_CFLAGS += -Iplatform/android/include
265
266# Add in host sources to allow the executable to both be a socket server and
267# CHRE implementation.
268GOOGLE_ARM64_ANDROID_CFLAGS += -I$(ANDROID_BUILD_TOP)/system/libbase/include
269GOOGLE_ARM64_ANDROID_CFLAGS += -I$(ANDROID_BUILD_TOP)/system/core/libcutils/include
270GOOGLE_ARM64_ANDROID_CFLAGS += -I$(ANDROID_BUILD_TOP)/system/core/libutils/include
271GOOGLE_ARM64_ANDROID_CFLAGS += -I$(ANDROID_BUILD_TOP)/system/logging/liblog/include
272GOOGLE_ARM64_ANDROID_CFLAGS += -Ihost/common/include
273
274# Also add the linux sources to fall back to the default Linux implementation.
275GOOGLE_ARM64_ANDROID_CFLAGS += -Iplatform/linux/include
276
277# We use FlatBuffers in the Android simulator
278GOOGLE_ARM64_ANDROID_CFLAGS += -I$(FLATBUFFERS_PATH)/include
279
280# Android-specific Source Files ################################################
281
282ANDROID_CUTILS_TOP = $(ANDROID_BUILD_TOP)/system/core/libcutils
283ANDROID_LOG_TOP = $(ANDROID_BUILD_TOP)/system/logging/liblog
284
285GOOGLE_ARM64_ANDROID_SRCS += $(ANDROID_CUTILS_TOP)/sockets_unix.cpp
286GOOGLE_ARM64_ANDROID_SRCS += $(ANDROID_CUTILS_TOP)/android_get_control_file.cpp
287GOOGLE_ARM64_ANDROID_SRCS += $(ANDROID_CUTILS_TOP)/socket_local_server_unix.cpp
288GOOGLE_ARM64_ANDROID_SRCS += $(ANDROID_CUTILS_TOP)/socket_local_client_unix.cpp
289GOOGLE_ARM64_ANDROID_SRCS += $(ANDROID_LOG_TOP)/logd_reader.c
290
291GOOGLE_ARM64_ANDROID_SRCS += platform/android/init.cc
292GOOGLE_ARM64_ANDROID_SRCS += platform/android/host_link.cc
293GOOGLE_ARM64_ANDROID_SRCS += platform/shared/host_protocol_common.cc
294GOOGLE_ARM64_ANDROID_SRCS += host/common/host_protocol_host.cc
295GOOGLE_ARM64_ANDROID_SRCS += host/common/socket_server.cc
296
297# Optional audio support.
298ifeq ($(CHRE_AUDIO_SUPPORT_ENABLED), true)
299GOOGLE_ARM64_ANDROID_SRCS += platform/android/platform_audio.cc
300endif
301
302# GoogleTest Compiler Flags ####################################################
303
304# The order here is important so that the googletest target prefers shared,
305# linux and then SLPI.
306GOOGLETEST_CFLAGS += -Iplatform/shared/include
307GOOGLETEST_CFLAGS += -Iplatform/linux/include
308GOOGLETEST_CFLAGS += -Iplatform/slpi/include
309
310# GoogleTest Source Files ######################################################
311
312GOOGLETEST_COMMON_SRCS += platform/linux/assert.cc
313GOOGLETEST_COMMON_SRCS += platform/linux/audio_source.cc
314GOOGLETEST_COMMON_SRCS += platform/linux/platform_audio.cc
315GOOGLETEST_COMMON_SRCS += platform/tests/log_buffer_test.cc
316GOOGLETEST_COMMON_SRCS += platform/shared/log_buffer.cc
317