OSDN Git Service

DO NOT MERGE Add bound check for rfc_parse_data
[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/osi.c \
45     ./src/properties.c \
46     ./src/reactor.c \
47     ./src/ringbuffer.c \
48     ./src/semaphore.c \
49     ./src/socket.c \
50     ./src/socket_utils/socket_local_client.c \
51     ./src/socket_utils/socket_local_server.c \
52     ./src/thread.c \
53     ./src/time.c \
54     ./src/wakelock.c
55
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/leaky_bonded_queue_test.cpp \
71     ./test/list_test.cpp \
72     ./test/metrics_test.cpp \
73     ./test/properties_test.cpp \
74     ./test/rand_test.cpp \
75     ./test/reactor_test.cpp \
76     ./test/ringbuffer_test.cpp \
77     ./test/semaphore_test.cpp \
78     ./test/thread_test.cpp \
79     ./test/time_test.cpp
80
81 btosiCommonIncludes := \
82     $(LOCAL_PATH)/.. \
83     $(LOCAL_PATH)/../include \
84     $(LOCAL_PATH)/../utils/include \
85     $(LOCAL_PATH)/../stack/include \
86     $(bluetooth_C_INCLUDES)
87
88 # Bluetooth Protobuf static library for target
89 # ========================================================
90 include $(CLEAR_VARS)
91 LOCAL_MODULE := libbt-protos
92 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
93 generated_sources_dir := $(call local-generated-sources-dir)
94 LOCAL_EXPORT_C_INCLUDE_DIRS += \
95     $(generated_sources_dir)/proto/system/bt
96 LOCAL_SRC_FILES := $(call all-proto-files-under,src/protos/)
97
98 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
99 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
100 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
101
102 include $(BUILD_STATIC_LIBRARY)
103
104 # Bluetooth Protobuf static library for host
105 # ========================================================
106 include $(CLEAR_VARS)
107 LOCAL_MODULE := libbt-protos
108 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
109 LOCAL_IS_HOST_MODULE := true
110 generated_sources_dir := $(call local-generated-sources-dir)
111 LOCAL_EXPORT_C_INCLUDE_DIRS += \
112     $(generated_sources_dir)/proto/system/bt
113 LOCAL_SRC_FILES := $(call all-proto-files-under,src/protos/)
114
115 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
116 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
117 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
118
119 include $(BUILD_HOST_STATIC_LIBRARY)
120
121 # libosi static library for target
122 # ========================================================
123 include $(CLEAR_VARS)
124 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
125 LOCAL_SRC_FILES := $(btosiCommonSrc)
126 LOCAL_MODULE := libosi
127 LOCAL_MODULE_TAGS := optional
128 LOCAL_SHARED_LIBRARIES := libc liblog libchrome
129 LOCAL_STATIC_LIBRARIES := libbt-protos
130 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
131
132 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
133 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
134 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
135
136 include $(BUILD_STATIC_LIBRARY)
137
138 # libosi static library for host
139 # ========================================================
140 ifeq ($(HOST_OS),linux)
141 include $(CLEAR_VARS)
142 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
143 LOCAL_SRC_FILES := $(btosiCommonSrc)
144 LOCAL_MODULE := libosi-host
145 LOCAL_MODULE_TAGS := optional
146 LOCAL_SHARED_LIBRARIES := liblog libchrome
147 LOCAL_STATIC_LIBRARIES := libbt-protos
148 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
149
150 # TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
151 # should be compatible for a Linux host OS. We should figure out what to do for
152 # a non-Linux host OS.
153 LOCAL_CFLAGS += $(bluetooth_CFLAGS) -D_GNU_SOURCE -DOS_GENERIC
154 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
155 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
156
157 include $(BUILD_HOST_STATIC_LIBRARY)
158 endif
159
160 #
161 # Note: It's good to get the tests compiled both for the host and the target so
162 # we get to test with both Bionic libc and glibc
163 #
164 # libosi unit tests for target
165 # ========================================================
166 include $(CLEAR_VARS)
167 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
168 LOCAL_SRC_FILES := $(btosiCommonTestSrc)
169 LOCAL_MODULE := net_test_osi
170 LOCAL_MODULE_TAGS := tests
171 LOCAL_SHARED_LIBRARIES := libc liblog libprotobuf-cpp-full libchrome libcutils
172 LOCAL_STATIC_LIBRARIES := libosi libbt-protos libgmock
173
174 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
175 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
176 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
177
178 include $(BUILD_NATIVE_TEST)
179
180 # libosi unit tests for host
181 # ========================================================
182 ifeq ($(HOST_OS),linux)
183 include $(CLEAR_VARS)
184 LOCAL_C_INCLUDES := $(btosiCommonIncludes)
185 LOCAL_SRC_FILES := $(btosiCommonTestSrc)
186 LOCAL_LDLIBS := -lrt -lpthread
187 LOCAL_MODULE := net_test_osi
188 LOCAL_MODULE_TAGS := tests
189 LOCAL_SHARED_LIBRARIES := liblog libprotobuf-cpp-full libchrome
190 LOCAL_STATIC_LIBRARIES := libosi-host libbt-protos libgmock_host
191
192 LOCAL_CFLAGS += $(bluetooth_CFLAGS) -DOS_GENERIC
193 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
194 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
195
196 include $(BUILD_HOST_NATIVE_TEST)
197 endif