1 ##############################################################################
3 # Copyright (C) 2014 Google, Inc.
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:
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 ##############################################################################
19 LOCAL_PATH := $(call my-dir)
22 # ========================================================
24 # TODO(mcchou): Remove socket_utils sources after platform specific
25 # dependencies are abstracted.
28 ./src/allocation_tracker.c \
34 ./src/data_dispatcher.c \
35 ./src/eager_reader.c \
38 ./src/hash_functions.c \
40 ./src/hash_map_utils.c \
50 ./src/socket_utils/socket_local_client.c \
51 ./src/socket_utils/socket_local_server.c \
56 btosiCommonTestSrc := \
57 ./test/AlarmTestHarness.cpp \
58 ./test/AllocationTestHarness.cpp \
59 ./test/alarm_test.cpp \
60 ./test/allocation_tracker_test.cpp \
61 ./test/allocator_test.cpp \
62 ./test/array_test.cpp \
63 ./test/config_test.cpp \
64 ./test/data_dispatcher_test.cpp \
65 ./test/eager_reader_test.cpp \
66 ./test/fixed_queue_test.cpp \
67 ./test/future_test.cpp \
68 ./test/hash_map_test.cpp \
69 ./test/hash_map_utils_test.cpp \
70 ./test/list_test.cpp \
71 ./test/properties_test.cpp \
72 ./test/rand_test.cpp \
73 ./test/reactor_test.cpp \
74 ./test/ringbuffer_test.cpp \
75 ./test/semaphore_test.cpp \
76 ./test/thread_test.cpp \
79 btosiCommonIncludes := \
81 $(LOCAL_PATH)/../utils/include \
82 $(LOCAL_PATH)/../stack/include \
83 $(bluetooth_C_INCLUDES)
85 # Bluetooth Protobuf static library for target
86 # ========================================================
88 LOCAL_MODULE := libbt-protos
89 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
90 generated_sources_dir := $(call local-generated-sources-dir)
91 LOCAL_EXPORT_C_INCLUDE_DIRS += \
92 $(generated_sources_dir)/proto/system/bt
93 LOCAL_SRC_FILES := $(call all-proto-files-under,src/protos/)
95 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
96 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
97 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
99 include $(BUILD_STATIC_LIBRARY)
101 # Bluetooth Protobuf static library for host
102 # ========================================================
103 include $(CLEAR_VARS)
104 LOCAL_MODULE := libbt-protos
105 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
106 LOCAL_IS_HOST_MODULE := true
107 generated_sources_dir := $(call local-generated-sources-dir)
108 LOCAL_EXPORT_C_INCLUDE_DIRS += \
109 $(generated_sources_dir)/proto/system/bt
110 LOCAL_SRC_FILES := $(call all-proto-files-under,src/protos/)
112 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
113 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
114 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
116 include $(BUILD_HOST_STATIC_LIBRARY)
118 # libosi static library for target
119 # ========================================================
120 include $(CLEAR_VARS)
121 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
122 LOCAL_SRC_FILES := $(btosiCommonSrc)
123 LOCAL_MODULE := libosi
124 LOCAL_MODULE_TAGS := optional
125 LOCAL_SHARED_LIBRARIES := libc liblog libchrome
126 LOCAL_STATIC_LIBRARIES := libbt-protos
127 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
129 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
130 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
131 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
133 include $(BUILD_STATIC_LIBRARY)
135 # libosi static library for host
136 # ========================================================
137 ifeq ($(HOST_OS),linux)
138 include $(CLEAR_VARS)
139 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
140 LOCAL_SRC_FILES := $(btosiCommonSrc)
141 LOCAL_MODULE := libosi-host
142 LOCAL_MODULE_TAGS := optional
143 LOCAL_SHARED_LIBRARIES := liblog libchrome
144 LOCAL_STATIC_LIBRARIES := libbt-protos
145 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
147 # TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
148 # should be compatible for a Linux host OS. We should figure out what to do for
149 # a non-Linux host OS.
150 LOCAL_CFLAGS += $(bluetooth_CFLAGS) -D_GNU_SOURCE -DOS_GENERIC
151 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
152 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
154 include $(BUILD_HOST_STATIC_LIBRARY)
158 # Note: It's good to get the tests compiled both for the host and the target so
159 # we get to test with both Bionic libc and glibc
161 # libosi unit tests for target
162 # ========================================================
163 include $(CLEAR_VARS)
164 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
165 LOCAL_SRC_FILES := $(btosiCommonTestSrc)
166 LOCAL_MODULE := net_test_osi
167 LOCAL_MODULE_TAGS := tests
168 LOCAL_SHARED_LIBRARIES := libc liblog libprotobuf-cpp-full libchrome libcutils
169 LOCAL_STATIC_LIBRARIES := libosi libbt-protos
171 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
172 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
173 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
175 include $(BUILD_NATIVE_TEST)
177 # libosi unit tests for host
178 # ========================================================
179 ifeq ($(HOST_OS),linux)
180 include $(CLEAR_VARS)
181 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
182 LOCAL_SRC_FILES := $(btosiCommonTestSrc)
183 LOCAL_LDLIBS := -lrt -lpthread
184 LOCAL_MODULE := net_test_osi
185 LOCAL_MODULE_TAGS := tests
186 LOCAL_SHARED_LIBRARIES := liblog libprotobuf-cpp-full libchrome
187 LOCAL_STATIC_LIBRARIES := libosi-host libbt-protos
189 LOCAL_CFLAGS += $(bluetooth_CFLAGS) -DOS_GENERIC
190 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
191 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
193 include $(BUILD_HOST_NATIVE_TEST)