2 # Copyright (C) 2015 Google
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:
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 LOCAL_PATH:= $(call my-dir)
20 # ========================================================
21 btserviceCommonSrc := \
22 common/bluetooth/adapter_state.cpp \
23 common/bluetooth/advertise_data.cpp \
24 common/bluetooth/advertise_settings.cpp \
25 common/bluetooth/gatt_identifier.cpp \
26 common/bluetooth/scan_filter.cpp \
27 common/bluetooth/scan_result.cpp \
28 common/bluetooth/scan_settings.cpp \
29 common/bluetooth/util/address_helper.cpp \
30 common/bluetooth/util/atomic_string.cpp \
31 common/bluetooth/uuid.cpp
33 btserviceCommonBinderSrc := \
34 common/bluetooth/binder/IBluetooth.cpp \
35 common/bluetooth/binder/IBluetoothCallback.cpp \
36 common/bluetooth/binder/IBluetoothGattClient.cpp \
37 common/bluetooth/binder/IBluetoothGattClientCallback.cpp \
38 common/bluetooth/binder/IBluetoothGattServer.cpp \
39 common/bluetooth/binder/IBluetoothGattServerCallback.cpp \
40 common/bluetooth/binder/IBluetoothLowEnergy.cpp \
41 common/bluetooth/binder/IBluetoothLowEnergyCallback.cpp \
42 common/bluetooth/binder/parcel_helpers.cpp
44 btserviceDaemonSrc := \
50 hal/gatt_helpers.cpp \
51 hal/bluetooth_gatt_interface.cpp \
52 hal/bluetooth_interface.cpp \
56 low_energy_client.cpp \
59 btserviceLinuxSrc := \
60 ipc/ipc_handler_linux.cpp \
61 ipc/linux_ipc_host.cpp
63 btserviceBinderDaemonImplSrc := \
64 ipc/binder/bluetooth_binder_server.cpp \
65 ipc/binder/bluetooth_gatt_client_binder_server.cpp \
66 ipc/binder/bluetooth_gatt_server_binder_server.cpp \
67 ipc/binder/bluetooth_low_energy_binder_server.cpp \
68 ipc/binder/interface_with_instances_base.cpp \
69 ipc/binder/ipc_handler_binder.cpp \
71 btserviceBinderDaemonSrc := \
72 $(btserviceCommonBinderSrc) \
73 $(btserviceBinderDaemonImplSrc)
75 btserviceCommonIncludes := \
79 # Main unit test sources. These get built for host and target.
80 # ========================================================
81 btserviceBaseTestSrc := \
82 hal/fake_bluetooth_gatt_interface.cpp \
83 hal/fake_bluetooth_interface.cpp \
84 test/adapter_unittest.cpp \
85 test/advertise_data_unittest.cpp \
86 test/fake_hal_util.cpp \
87 test/gatt_client_unittest.cpp \
88 test/gatt_identifier_unittest.cpp \
89 test/gatt_server_unittest.cpp \
90 test/low_energy_client_unittest.cpp \
91 test/settings_unittest.cpp \
92 test/util_unittest.cpp \
93 test/uuid_unittest.cpp
95 # Some standard CFLAGS used in all targets.
96 btservice_common_flags :=
97 # libchrome has unused parameters in their .h files. b/26228533
98 btservice_common_flags += -Wno-unused-parameter
100 # Native system service for target
101 # ========================================================
102 include $(CLEAR_VARS)
104 $(btserviceBinderDaemonSrc) \
105 $(btserviceCommonSrc) \
106 $(btserviceLinuxSrc) \
107 $(btserviceDaemonSrc) \
109 LOCAL_C_INCLUDES += $(btserviceCommonIncludes)
110 LOCAL_CFLAGS += $(btservice_common_flags)
111 LOCAL_MODULE_TAGS := optional
112 LOCAL_MODULE := bluetoothtbd
113 LOCAL_REQUIRED_MODULES = bluetooth.default
114 LOCAL_STATIC_LIBRARIES += libbtcore
115 LOCAL_SHARED_LIBRARIES += \
122 LOCAL_INIT_RC := bluetoothtbd.rc
123 include $(BUILD_EXECUTABLE)
125 # Native system service unittests for host
126 # ========================================================
127 include $(CLEAR_VARS)
129 $(btserviceBaseTestSrc) \
130 $(btserviceCommonSrc) \
131 $(btserviceDaemonSrc) \
133 test/stub_ipc_handler_binder.cpp
134 ifeq ($(HOST_OS),linux)
136 $(btserviceLinuxSrc) \
137 test/ipc_linux_unittest.cpp
141 test/stub_ipc_handler_linux.cpp
143 LOCAL_C_INCLUDES += $(btserviceCommonIncludes)
144 LOCAL_CFLAGS += $(btservice_common_flags)
145 LOCAL_MODULE_TAGS := debug tests
146 LOCAL_MODULE := bluetoothtbd-host_test
147 LOCAL_SHARED_LIBRARIES += libchrome
148 LOCAL_STATIC_LIBRARIES += libgmock_host libgtest_host liblog
149 include $(BUILD_HOST_NATIVE_TEST)
151 # Native system service unittests for target. This
152 # includes Binder related tests that can only be run on
154 # ========================================================
155 include $(CLEAR_VARS)
157 $(btserviceBaseTestSrc) \
158 $(btserviceBinderDaemonSrc) \
159 $(btserviceCommonSrc) \
160 $(btserviceDaemonSrc) \
162 test/parcel_helpers_unittest.cpp
163 LOCAL_C_INCLUDES += $(btserviceCommonIncludes)
164 LOCAL_CFLAGS += $(btservice_common_flags)
165 LOCAL_MODULE_TAGS := debug tests
166 LOCAL_MODULE := bluetoothtbd_test
167 LOCAL_SHARED_LIBRARIES += \
171 LOCAL_STATIC_LIBRARIES += libgmock libgtest liblog
172 include $(BUILD_NATIVE_TEST)
174 # Client library for interacting with Bluetooth daemon
175 # ========================================================
176 include $(CLEAR_VARS)
178 $(btserviceCommonSrc) \
179 $(btserviceCommonBinderSrc)
180 LOCAL_C_INCLUDES += $(btserviceCommonIncludes)
181 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/common
182 LOCAL_CFLAGS += $(btservice_common_flags)
183 LOCAL_MODULE := libbluetooth-client
184 LOCAL_SHARED_LIBRARIES += libbinder libchrome libutils
185 include $(BUILD_STATIC_LIBRARY)
187 # Native system service CLI for target
188 # ========================================================
189 include $(CLEAR_VARS)
190 LOCAL_SRC_FILES := client/main.cpp
191 LOCAL_CFLAGS += $(btservice_common_flags)
192 LOCAL_MODULE_TAGS := optional
193 LOCAL_MODULE := bluetooth-cli
194 LOCAL_STATIC_LIBRARIES += libbluetooth-client
195 LOCAL_SHARED_LIBRARIES += \
199 include $(BUILD_EXECUTABLE)
201 # Heart Rate GATT service example
202 # ========================================================
203 # TODO(armansito): Move this into a new makefile under examples/ once we build a
204 # client static library that the examples can depend on.
205 include $(CLEAR_VARS)
207 example/heart_rate/heart_rate_server.cpp \
208 example/heart_rate/server_main.cpp
209 LOCAL_C_INCLUDES += $(LOCAL_PATH)/../
210 LOCAL_CFLAGS += $(btservice_common_flags)
211 LOCAL_MODULE_TAGS := optional
212 LOCAL_MODULE := bt-example-hr-server
213 LOCAL_STATIC_LIBRARIES += libbluetooth-client
214 LOCAL_SHARED_LIBRARIES += \
218 include $(BUILD_EXECUTABLE)