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
42
43# Enable the LPMA feature for devices that support audio
44ifeq ($(CHRE_DAEMON_LPMA_ENABLED),true)
45LOCAL_CFLAGS += -DCHRE_DAEMON_LPMA_ENABLED
46endif
47
48ifeq ($(CHRE_DAEMON_LOAD_INTO_SENSORSPD),true)
49LOCAL_CFLAGS += -DCHRE_DAEMON_LOAD_INTO_SENSORSPD
50endif
51
52# Disable Tokenized Logging
53CHRE_USE_TOKENIZED_LOGGING := false
54
55LOCAL_SRC_FILES := \
56    host/common/daemon_base.cc \
57    host/common/fragmented_load_transaction.cc \
58    host/common/host_protocol_host.cc \
59    host/common/log_message_parser_base.cc \
60    host/common/socket_server.cc \
61    host/common/st_hal_lpma_handler.cc \
62    host/msm/daemon/fastrpc_daemon.cc \
63    host/msm/daemon/main.cc \
64    host/msm/daemon/generated/chre_slpi_stub.c \
65    platform/shared/host_protocol_common.cc
66
67LOCAL_C_INCLUDES := \
68    external/fastrpc/inc \
69    system/chre/external/flatbuffers/include \
70    system/chre/host/common/include \
71    system/chre/host/msm/daemon \
72    system/chre/platform/shared/include \
73    system/chre/platform/slpi/include \
74    system/chre/util/include \
75    system/libbase/include \
76    system/core/libcutils/include \
77    system/logging/liblog/include \
78    system/core/libutils/include \
79
80LOCAL_SHARED_LIBRARIES := \
81    libjsoncpp \
82    libutils \
83    libcutils \
84    liblog \
85    libhidlbase \
86    libbase \
87    android.hardware.soundtrigger@2.0 \
88    libpower
89
90# Enable tokenized logging
91ifeq ($(CHRE_USE_TOKENIZED_LOGGING),true)
92LOCAL_CFLAGS += -DCHRE_USE_TOKENIZED_LOGGING
93PIGWEED_TOKENIZER_DIR = vendor/google_contexthub/chre/external/pigweed
94PIGWEED_TOKENIZER_DIR_RELPATH = ../../$(PIGWEED_TOKENIZER_DIR)
95LOCAL_CFLAGS += -I$(PIGWEED_TOKENIZER_DIR)/pw_polyfill/public
96LOCAL_CFLAGS += -I$(PIGWEED_TOKENIZER_DIR)/pw_polyfill/public_overrides
97LOCAL_CFLAGS += -I$(PIGWEED_TOKENIZER_DIR)/pw_polyfill/standard_library_public
98LOCAL_CFLAGS += -I$(PIGWEED_TOKENIZER_DIR)/pw_preprocessor/public
99LOCAL_CFLAGS += -I$(PIGWEED_TOKENIZER_DIR)/pw_tokenizer/public
100LOCAL_CFLAGS += -I$(PIGWEED_TOKENIZER_DIR)/pw_varint/public
101LOCAL_CFLAGS += -I$(PIGWEED_TOKENIZER_DIR)/pw_span/public
102
103LOCAL_SRC_FILES += $(PIGWEED_TOKENIZER_DIR_RELPATH)/pw_tokenizer/detokenize.cc
104LOCAL_SRC_FILES += $(PIGWEED_TOKENIZER_DIR_RELPATH)/pw_tokenizer/decode.cc
105LOCAL_SRC_FILES += $(PIGWEED_TOKENIZER_DIR_RELPATH)/pw_varint/varint.cc
106endif
107
108ifeq ($(CHRE_DAEMON_USE_SDSPRPC),true)
109LOCAL_SHARED_LIBRARIES += libsdsprpc
110else
111LOCAL_SHARED_LIBRARIES += libadsprpc
112endif
113
114include $(BUILD_EXECUTABLE)
115
116endif
117endif
118