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