blob: f93fdfb8c86bb61528476371f7fd48ca1cec5e8a [file] [log] [blame]
Chris Manton3a2ee932014-06-03 11:02:38 -07001 ##############################################################################
2 #
3 # Copyright (C) 2014 Google, Inc.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at:
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 ##############################################################################
18
Sharvil Nanavaticef76952014-04-24 16:22:45 -070019LOCAL_PATH := $(call my-dir)
20
Arman Uguray145cf572015-07-31 19:14:39 -070021# Common variables
22# ========================================================
Sharvil Nanavaticef76952014-04-24 16:22:45 -070023
Miao Chou10969122015-06-09 17:39:46 -070024# TODO(mcchou): Remove socket_utils sources after platform specific
25# dependencies are abstracted.
Arman Uguray145cf572015-07-31 19:14:39 -070026btosiCommonSrc := \
Pavlin Radoslavovb2a292b2016-10-14 19:34:48 -070027 ./src/alarm.cc \
Jakub Pawlowski0d55d662016-05-25 10:37:17 -070028 ./src/allocation_tracker.cc \
Pavlin Radoslavovb2a292b2016-10-14 19:34:48 -070029 ./src/allocator.cc \
30 ./src/array.cc \
31 ./src/buffer.cc \
32 ./src/compat.cc \
33 ./src/config.cc \
Jakub Pawlowski2b56e012016-05-26 10:13:40 -070034 ./src/data_dispatcher.cc \
Pavlin Radoslavovb2a292b2016-10-14 19:34:48 -070035 ./src/eager_reader.cc \
36 ./src/fixed_queue.cc \
37 ./src/future.cc \
Jakub Pawlowski6a059512016-05-25 17:49:32 -070038 ./src/hash_map_utils.cc \
Pavlin Radoslavovb2a292b2016-10-14 19:34:48 -070039 ./src/list.cc \
Jakub Pawlowskie6d12022016-05-12 11:16:46 -070040 ./src/metrics.cc \
Pavlin Radoslavovb2a292b2016-10-14 19:34:48 -070041 ./src/mutex.cc \
42 ./src/osi.cc \
43 ./src/properties.cc \
44 ./src/reactor.cc \
45 ./src/ringbuffer.cc \
46 ./src/semaphore.cc \
47 ./src/socket.cc \
48 ./src/socket_utils/socket_local_client.cc \
49 ./src/socket_utils/socket_local_server.cc \
50 ./src/thread.cc \
51 ./src/time.cc \
52 ./src/wakelock.cc
Sharvil Nanavaticef76952014-04-24 16:22:45 -070053
Arman Uguray145cf572015-07-31 19:14:39 -070054btosiCommonTestSrc := \
Jakub Pawlowskie6d12022016-05-12 11:16:46 -070055 ./test/AlarmTestHarness.cc \
56 ./test/AllocationTestHarness.cc \
57 ./test/alarm_test.cc \
58 ./test/allocation_tracker_test.cc \
59 ./test/allocator_test.cc \
60 ./test/array_test.cc \
61 ./test/config_test.cc \
62 ./test/data_dispatcher_test.cc \
63 ./test/eager_reader_test.cc \
64 ./test/fixed_queue_test.cc \
65 ./test/future_test.cc \
Jakub Pawlowskie6d12022016-05-12 11:16:46 -070066 ./test/hash_map_utils_test.cc \
67 ./test/list_test.cc \
68 ./test/properties_test.cc \
69 ./test/rand_test.cc \
70 ./test/reactor_test.cc \
71 ./test/ringbuffer_test.cc \
72 ./test/semaphore_test.cc \
73 ./test/thread_test.cc \
Pavlin Radoslavov223cecf2016-08-08 11:18:47 -070074 ./test/time_test.cc \
75 ./test/wakelock_test.cc
Sharvil Nanavaticef76952014-04-24 16:22:45 -070076
Arman Uguray145cf572015-07-31 19:14:39 -070077btosiCommonIncludes := \
Arman Uguray145cf572015-07-31 19:14:39 -070078 $(LOCAL_PATH)/.. \
Pavlin Radoslavov10978012016-01-21 18:04:36 -080079 $(LOCAL_PATH)/../utils/include \
Pavlin Radoslavov1377f932016-02-11 19:44:47 -080080 $(LOCAL_PATH)/../stack/include \
81 $(bluetooth_C_INCLUDES)
Arman Uguray145cf572015-07-31 19:14:39 -070082
Pavlin Radoslavov1377f932016-02-11 19:44:47 -080083# Bluetooth Protobuf static library for target
Marie Janssen77f579f2016-01-15 16:14:14 -080084# ========================================================
85include $(CLEAR_VARS)
Jakub Pawlowskie6d12022016-05-12 11:16:46 -070086LOCAL_CPP_EXTENSION := .cc
Marie Janssen77f579f2016-01-15 16:14:14 -080087LOCAL_MODULE := libbt-protos
88LOCAL_MODULE_CLASS := STATIC_LIBRARIES
89generated_sources_dir := $(call local-generated-sources-dir)
Pavlin Radoslavov7aaf7c62016-08-23 12:24:03 -070090LOCAL_EXPORT_C_INCLUDE_DIRS := \
Marie Janssen77f579f2016-01-15 16:14:14 -080091 $(generated_sources_dir)/proto/system/bt
92LOCAL_SRC_FILES := $(call all-proto-files-under,src/protos/)
Pavlin Radoslavov1377f932016-02-11 19:44:47 -080093
94LOCAL_CFLAGS += $(bluetooth_CFLAGS)
95LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
96LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
97
Marie Janssen77f579f2016-01-15 16:14:14 -080098include $(BUILD_STATIC_LIBRARY)
99
Pavlin Radoslavov1377f932016-02-11 19:44:47 -0800100# Bluetooth Protobuf static library for host
101# ========================================================
Marie Janssen77f579f2016-01-15 16:14:14 -0800102include $(CLEAR_VARS)
Jakub Pawlowskie6d12022016-05-12 11:16:46 -0700103LOCAL_CPP_EXTENSION := .cc
Marie Janssen77f579f2016-01-15 16:14:14 -0800104LOCAL_MODULE := libbt-protos
105LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Ying Wangdf515a42016-03-23 11:41:15 -0700106LOCAL_IS_HOST_MODULE := true
Marie Janssen77f579f2016-01-15 16:14:14 -0800107generated_sources_dir := $(call local-generated-sources-dir)
Pavlin Radoslavov7aaf7c62016-08-23 12:24:03 -0700108LOCAL_EXPORT_C_INCLUDE_DIRS := \
Marie Janssen77f579f2016-01-15 16:14:14 -0800109 $(generated_sources_dir)/proto/system/bt
110LOCAL_SRC_FILES := $(call all-proto-files-under,src/protos/)
Pavlin Radoslavov1377f932016-02-11 19:44:47 -0800111
112LOCAL_CFLAGS += $(bluetooth_CFLAGS)
113LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
114LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
115
Marie Janssen77f579f2016-01-15 16:14:14 -0800116include $(BUILD_HOST_STATIC_LIBRARY)
117
Arman Uguray145cf572015-07-31 19:14:39 -0700118# libosi static library for target
119# ========================================================
120include $(CLEAR_VARS)
Jakub Pawlowskie6d12022016-05-12 11:16:46 -0700121LOCAL_CPP_EXTENSION := .cc
Arman Uguray145cf572015-07-31 19:14:39 -0700122LOCAL_C_INCLUDES := $(btosiCommonIncludes)
123LOCAL_SRC_FILES := $(btosiCommonSrc)
Arman Uguray145cf572015-07-31 19:14:39 -0700124LOCAL_MODULE := libosi
125LOCAL_MODULE_TAGS := optional
Ajay Panicker1d00dd22016-02-17 18:18:00 -0800126LOCAL_SHARED_LIBRARIES := libc liblog libchrome
Marie Janssen77f579f2016-01-15 16:14:14 -0800127LOCAL_STATIC_LIBRARIES := libbt-protos
Arman Uguray145cf572015-07-31 19:14:39 -0700128LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Pavlin Radoslavov1377f932016-02-11 19:44:47 -0800129
130LOCAL_CFLAGS += $(bluetooth_CFLAGS)
131LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
132LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
133
Arman Uguray145cf572015-07-31 19:14:39 -0700134include $(BUILD_STATIC_LIBRARY)
135
136# libosi static library for host
137# ========================================================
138ifeq ($(HOST_OS),linux)
139include $(CLEAR_VARS)
Jakub Pawlowskie6d12022016-05-12 11:16:46 -0700140LOCAL_CPP_EXTENSION := .cc
Arman Uguray145cf572015-07-31 19:14:39 -0700141LOCAL_C_INCLUDES := $(btosiCommonIncludes)
142LOCAL_SRC_FILES := $(btosiCommonSrc)
Arman Uguray145cf572015-07-31 19:14:39 -0700143LOCAL_MODULE := libosi-host
144LOCAL_MODULE_TAGS := optional
Ajay Panicker1d00dd22016-02-17 18:18:00 -0800145LOCAL_SHARED_LIBRARIES := liblog libchrome
Marie Janssen77f579f2016-01-15 16:14:14 -0800146LOCAL_STATIC_LIBRARIES := libbt-protos
Arman Uguray145cf572015-07-31 19:14:39 -0700147LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Pavlin Radoslavov1377f932016-02-11 19:44:47 -0800148
149# TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
150# should be compatible for a Linux host OS. We should figure out what to do for
151# a non-Linux host OS.
Jakub Pawlowski3eb4a482016-02-24 10:39:46 -0800152LOCAL_CFLAGS += $(bluetooth_CFLAGS) -D_GNU_SOURCE -DOS_GENERIC
Pavlin Radoslavov1377f932016-02-11 19:44:47 -0800153LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
154LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
155
Arman Uguray145cf572015-07-31 19:14:39 -0700156include $(BUILD_HOST_STATIC_LIBRARY)
157endif
158
Pavlin Radoslavov1377f932016-02-11 19:44:47 -0800159#
Arman Uguray145cf572015-07-31 19:14:39 -0700160# Note: It's good to get the tests compiled both for the host and the target so
161# we get to test with both Bionic libc and glibc
Pavlin Radoslavov1377f932016-02-11 19:44:47 -0800162#
Arman Uguray145cf572015-07-31 19:14:39 -0700163# libosi unit tests for target
164# ========================================================
165include $(CLEAR_VARS)
Jakub Pawlowskie6d12022016-05-12 11:16:46 -0700166LOCAL_CPP_EXTENSION := .cc
Arman Uguray145cf572015-07-31 19:14:39 -0700167LOCAL_C_INCLUDES := $(btosiCommonIncludes)
168LOCAL_SRC_FILES := $(btosiCommonTestSrc)
Sharvil Nanavati61683572014-12-29 00:56:46 -0800169LOCAL_MODULE := net_test_osi
Sharvil Nanavaticef76952014-04-24 16:22:45 -0700170LOCAL_MODULE_TAGS := tests
Colin Cross9a247112016-10-26 14:25:28 -0700171LOCAL_SHARED_LIBRARIES := libc liblog libprotobuf-cpp-lite libchrome libcutils
Marie Janssen77f579f2016-01-15 16:14:14 -0800172LOCAL_STATIC_LIBRARIES := libosi libbt-protos
Pavlin Radoslavov1377f932016-02-11 19:44:47 -0800173
174LOCAL_CFLAGS += $(bluetooth_CFLAGS)
175LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
176LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
177
Sharvil Nanavaticef76952014-04-24 16:22:45 -0700178include $(BUILD_NATIVE_TEST)
Arman Uguray145cf572015-07-31 19:14:39 -0700179
180# libosi unit tests for host
181# ========================================================
182ifeq ($(HOST_OS),linux)
183include $(CLEAR_VARS)
Jakub Pawlowskie6d12022016-05-12 11:16:46 -0700184LOCAL_CPP_EXTENSION := .cc
Arman Uguray145cf572015-07-31 19:14:39 -0700185LOCAL_C_INCLUDES := $(btosiCommonIncludes)
186LOCAL_SRC_FILES := $(btosiCommonTestSrc)
Arman Uguray145cf572015-07-31 19:14:39 -0700187LOCAL_LDLIBS := -lrt -lpthread
188LOCAL_MODULE := net_test_osi
189LOCAL_MODULE_TAGS := tests
Colin Cross9a247112016-10-26 14:25:28 -0700190LOCAL_SHARED_LIBRARIES := liblog libprotobuf-cpp-lite libchrome
Marie Janssen77f579f2016-01-15 16:14:14 -0800191LOCAL_STATIC_LIBRARIES := libosi-host libbt-protos
Pavlin Radoslavov1377f932016-02-11 19:44:47 -0800192
Jakub Pawlowski3eb4a482016-02-24 10:39:46 -0800193LOCAL_CFLAGS += $(bluetooth_CFLAGS) -DOS_GENERIC
Pavlin Radoslavov1377f932016-02-11 19:44:47 -0800194LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
195LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
196
Arman Uguray145cf572015-07-31 19:14:39 -0700197include $(BUILD_HOST_NATIVE_TEST)
198endif