OSDN Git Service

Free allocation tracker hash map entries to reduce memory pressure
[android-x86/system-bt.git] / osi / Android.mk
1  ##############################################################################
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
19 LOCAL_PATH := $(call my-dir)
20
21 # Common variables
22 # ========================================================
23
24 # TODO(mcchou): Remove socket_utils sources after platform specific
25 # dependencies are abstracted.
26 btosiCommonSrc := \
27     ./src/alarm.c \
28     ./src/allocation_tracker.c \
29     ./src/allocator.c \
30     ./src/array.c \
31     ./src/buffer.c \
32     ./src/compat.c \
33     ./src/config.c \
34     ./src/data_dispatcher.c \
35     ./src/eager_reader.c \
36     ./src/fixed_queue.c \
37     ./src/future.c \
38     ./src/hash_functions.c \
39     ./src/hash_map.c \
40     ./src/hash_map_utils.c \
41     ./src/list.c \
42     ./src/metrics.cpp \
43     ./src/mutex.c \
44     ./src/reactor.c \
45     ./src/ringbuffer.c \
46     ./src/semaphore.c \
47     ./src/socket.c \
48     ./src/socket_utils/socket_local_client.c \
49     ./src/socket_utils/socket_local_server.c \
50     ./src/thread.c \
51     ./src/time.c \
52     ./src/wakelock.c
53
54 btosiCommonTestSrc := \
55     ./test/AlarmTestHarness.cpp \
56     ./test/AllocationTestHarness.cpp \
57     ./test/alarm_test.cpp \
58     ./test/allocation_tracker_test.cpp \
59     ./test/allocator_test.cpp \
60     ./test/array_test.cpp \
61     ./test/config_test.cpp \
62     ./test/data_dispatcher_test.cpp \
63     ./test/eager_reader_test.cpp \
64     ./test/fixed_queue_test.cpp \
65     ./test/future_test.cpp \
66     ./test/hash_map_test.cpp \
67     ./test/hash_map_utils_test.cpp \
68     ./test/list_test.cpp \
69     ./test/reactor_test.cpp \
70     ./test/ringbuffer_test.cpp \
71     ./test/semaphore_test.cpp \
72     ./test/thread_test.cpp \
73     ./test/time_test.cpp
74
75 btosiCommonIncludes := \
76     $(LOCAL_PATH)/.. \
77     $(LOCAL_PATH)/../utils/include \
78     $(LOCAL_PATH)/../stack/include \
79     $(bluetooth_C_INCLUDES)
80
81 # Bluetooth Protobuf static library for target
82 # ========================================================
83 include $(CLEAR_VARS)
84 LOCAL_MODULE := libbt-protos
85 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
86 generated_sources_dir := $(call local-generated-sources-dir)
87 LOCAL_EXPORT_C_INCLUDE_DIRS += \
88     $(generated_sources_dir)/proto/system/bt
89 LOCAL_SRC_FILES := $(call all-proto-files-under,src/protos/)
90
91 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
92 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
93 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
94
95 include $(BUILD_STATIC_LIBRARY)
96
97 # Bluetooth Protobuf static library for host
98 # ========================================================
99 include $(CLEAR_VARS)
100 LOCAL_MODULE := libbt-protos
101 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
102 generated_sources_dir := $(call local-generated-sources-dir)
103 LOCAL_EXPORT_C_INCLUDE_DIRS += \
104     $(generated_sources_dir)/proto/system/bt
105 LOCAL_SRC_FILES := $(call all-proto-files-under,src/protos/)
106
107 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
108 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
109 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
110
111 include $(BUILD_HOST_STATIC_LIBRARY)
112
113 # libosi static library for target
114 # ========================================================
115 include $(CLEAR_VARS)
116 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
117 LOCAL_SRC_FILES := $(btosiCommonSrc)
118 LOCAL_MODULE := libosi
119 LOCAL_MODULE_TAGS := optional
120 LOCAL_SHARED_LIBRARIES := libc liblog libchrome
121 LOCAL_STATIC_LIBRARIES := libbt-protos
122 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
123
124 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
125 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
126 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
127
128 include $(BUILD_STATIC_LIBRARY)
129
130 # libosi static library for host
131 # ========================================================
132 ifeq ($(HOST_OS),linux)
133 include $(CLEAR_VARS)
134 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
135 LOCAL_SRC_FILES := $(btosiCommonSrc)
136 LOCAL_MODULE := libosi-host
137 LOCAL_MODULE_TAGS := optional
138 LOCAL_SHARED_LIBRARIES := liblog libchrome
139 LOCAL_STATIC_LIBRARIES := libbt-protos
140 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
141
142 # TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
143 # should be compatible for a Linux host OS. We should figure out what to do for
144 # a non-Linux host OS.
145 LOCAL_CFLAGS += $(bluetooth_CFLAGS) -D_GNU_SOURCE
146 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
147 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
148
149 include $(BUILD_HOST_STATIC_LIBRARY)
150 endif
151
152 #
153 # Note: It's good to get the tests compiled both for the host and the target so
154 # we get to test with both Bionic libc and glibc
155 #
156 # libosi unit tests for target
157 # ========================================================
158 include $(CLEAR_VARS)
159 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
160 LOCAL_SRC_FILES := $(btosiCommonTestSrc)
161 LOCAL_MODULE := net_test_osi
162 LOCAL_MODULE_TAGS := tests
163 LOCAL_SHARED_LIBRARIES := liblog libprotobuf-cpp-full libchrome
164 LOCAL_STATIC_LIBRARIES := libosi libbt-protos
165
166 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
167 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
168 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
169
170 include $(BUILD_NATIVE_TEST)
171
172 # libosi unit tests for host
173 # ========================================================
174 ifeq ($(HOST_OS),linux)
175 include $(CLEAR_VARS)
176 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
177 LOCAL_SRC_FILES := $(btosiCommonTestSrc)
178 LOCAL_LDLIBS := -lrt -lpthread
179 LOCAL_MODULE := net_test_osi
180 LOCAL_MODULE_TAGS := tests
181 LOCAL_SHARED_LIBRARIES := liblog libprotobuf-cpp-full libchrome
182 LOCAL_STATIC_LIBRARIES := libosi-host libbt-protos
183
184 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
185 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
186 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
187
188 include $(BUILD_HOST_NATIVE_TEST)
189 endif