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