1#
2# Copyright 2019 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19# Don't build the daemon for targets that don't contain a vendor image as
20# libsdsprpc and libadsprpc are provided by vendor code
21ifeq ($(BUILDING_VENDOR_IMAGE),true)
22
23ifeq ($(CHRE_DAEMON_ENABLED),true)
24
25include $(CLEAR_VARS)
26
27# CHRE AP-side daemon
28# NOTE: This can't be converted to a blueprint file until libsdsprpc /
29# libadsprpc is converted as blueprint targets can't depend on targets exposed
30# by makefiles
31LOCAL_MODULE := chre
32LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
33LOCAL_LICENSE_CONDITIONS := notice
34LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
35LOCAL_MODULE_OWNER := google
36LOCAL_MODULE_TAGS := optional
37LOCAL_VENDOR_MODULE := true
38LOCAL_INIT_RC := chre_daemon.rc
39
40LOCAL_CPP_EXTENSION := .cc
41LOCAL_CFLAGS += -Wall -Werror -Wextra
42LOCAL_CFLAGS += -DCHRE_DAEMON_METRIC_ENABLED
43
44LOCAL_TIDY_CHECKS := -google-runtime-int
45
46# Enable the LPMA feature for devices that support audio
47ifeq ($(CHRE_DAEMON_LPMA_ENABLED),true)
48LOCAL_CFLAGS += -DCHRE_DAEMON_LPMA_ENABLED
49endif
50
51ifeq ($(CHRE_DAEMON_LOAD_INTO_SENSORSPD),true)
52LOCAL_CFLAGS += -DCHRE_DAEMON_LOAD_INTO_SENSORSPD
53endif
54
55MSM_SRC_FILES := \
56    host/common/fbs_daemon_base.cc \
57    host/msm/daemon/fastrpc_daemon.cc \
58    host/msm/daemon/main.cc \
59    host/msm/daemon/generated/chre_slpi_stub.c
60
61MSM_INCLUDES := \
62    system/chre/host/msm/daemon
63
64LOCAL_SRC_FILES := \
65    host/common/daemon_base.cc \
66    host/common/config_util.cc \
67    host/common/file_stream.cc \
68    host/common/fragmented_load_transaction.cc \
69    host/common/host_protocol_host.cc \
70    host/common/log_message_parser.cc \
71    host/common/bt_snoop_log_parser.cc \
72    host/common/socket_server.cc \
73    host/common/st_hal_lpma_handler.cc \
74    platform/shared/host_protocol_common.cc
75
76LOCAL_C_INCLUDES := \
77    external/fastrpc/inc \
78    system/chre/external/flatbuffers/include \
79    system/chre/host/common/include \
80    system/chre/platform/shared/include \
81    system/chre/platform/slpi/include \
82    system/chre/util/include \
83    system/libbase/include \
84    system/core/libcutils/include \
85    system/logging/liblog/include \
86    system/core/libutils/include
87
88LOCAL_SHARED_LIBRARIES := \
89    libjsoncpp \
90    libutils \
91    libcutils \
92    liblog \
93    libhidlbase \
94    libbase \
95    android.hardware.soundtrigger@2.0 \
96    libpower \
97    libprotobuf-cpp-lite \
98    chremetrics-cpp \
99    chre_atoms_log \
100    android.frameworks.stats-V2-ndk \
101    libbinder_ndk \
102    server_configurable_flags
103
104LOCAL_STATIC_LIBRARIES := \
105    chre_flags_c_lib \
106    chre_metrics_reporter
107
108LOCAL_SRC_FILES += $(MSM_SRC_FILES)
109LOCAL_C_INCLUDES += $(MSM_INCLUDES)
110
111LOCAL_CPPFLAGS += -std=c++20
112LOCAL_CFLAGS += -Wno-sign-compare
113LOCAL_CFLAGS += -Wno-c++11-narrowing
114LOCAL_CFLAGS += -Wno-deprecated-volatile
115
116# Pigweed (PW)
117PW_DIR = external/pigweed
118PW_DIR_RELPATH = ../../$(PW_DIR)
119LOCAL_CFLAGS += -I$(PW_DIR)/pw_assert/assert_compatibility_public_overrides
120LOCAL_CFLAGS += -I$(PW_DIR)/pw_assert/public
121LOCAL_CFLAGS += -I$(PW_DIR)/pw_base64/public
122LOCAL_CFLAGS += -I$(PW_DIR)/pw_bytes/public
123LOCAL_CFLAGS += -I$(PW_DIR)/pw_containers/public
124LOCAL_CFLAGS += -I$(PW_DIR)/pw_log_tokenized/public
125LOCAL_CFLAGS += -I$(PW_DIR)/pw_log/public
126LOCAL_CFLAGS += -I$(PW_DIR)/pw_polyfill/public
127LOCAL_CFLAGS += -I$(PW_DIR)/pw_polyfill/public_overrides
128LOCAL_CFLAGS += -I$(PW_DIR)/pw_polyfill/standard_library_public
129LOCAL_CFLAGS += -I$(PW_DIR)/pw_preprocessor/public
130LOCAL_CFLAGS += -I$(PW_DIR)/pw_result/public
131LOCAL_CFLAGS += -I$(PW_DIR)/pw_span/public
132LOCAL_CFLAGS += -I$(PW_DIR)/pw_status/public
133LOCAL_CFLAGS += -I$(PW_DIR)/pw_string/public
134LOCAL_CFLAGS += -I$(PW_DIR)/pw_tokenizer/public
135LOCAL_CFLAGS += -I$(PW_DIR)/pw_varint/public
136LOCAL_CFLAGS += -I$(PW_DIR)/third_party/fuchsia/repo/sdk/lib/stdcompat/include
137
138LOCAL_SRC_FILES += $(PW_DIR_RELPATH)/pw_tokenizer/decode.cc
139LOCAL_SRC_FILES += $(PW_DIR_RELPATH)/pw_tokenizer/detokenize.cc
140LOCAL_SRC_FILES += $(PW_DIR_RELPATH)/pw_varint/varint_c.c
141LOCAL_SRC_FILES += $(PW_DIR_RELPATH)/pw_varint/varint.cc
142
143ifeq ($(CHRE_DAEMON_USE_SDSPRPC),true)
144LOCAL_SHARED_LIBRARIES += libsdsprpc
145else
146LOCAL_SHARED_LIBRARIES += libadsprpc
147endif
148
149include $(BUILD_EXECUTABLE)
150
151endif   # CHRE_DAEMON_ENABLED
152endif   # BUILDING_VENDOR_IMAGE
153