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 # ========================================================
33 btcoreCommonTestSrc := \
34 ./test/bdaddr_test.cpp \
35 ./test/counter_test.cpp \
36 ./test/device_class_test.cpp \
37 ./test/property_test.cpp \
38 ./test/uuid_test.cpp \
39 ../osi/test/AllocationTestHarness.cpp
41 btcoreCommonIncludes := \
42 $(LOCAL_PATH)/include \
43 $(LOCAL_PATH)/../osi/include \
46 # libbtcore static library for target
47 # ========================================================
49 LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
50 LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
51 LOCAL_SRC_FILES := $(btcoreCommonSrc)
52 LOCAL_CFLAGS := -std=c99 $(bdroid_CFLAGS)
53 LOCAL_MODULE := libbtcore
54 LOCAL_MODULE_TAGS := optional
55 LOCAL_SHARED_LIBRARIES := libc liblog
56 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
57 include $(BUILD_STATIC_LIBRARY)
59 # libbtcore static library for host
60 # ========================================================
61 ifeq ($(HOST_OS),linux)
63 LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
64 LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
65 LOCAL_SRC_FILES := $(btcoreCommonSrc)
66 # TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
67 # should be compatible for a Linux host OS. We should figure out what to do for
68 # a non-Linux host OS.
69 LOCAL_CFLAGS := -std=c99 $(bdroid_CFLAGS) -D_GNU_SOURCE
70 LOCAL_MODULE := libbtcore-host
71 LOCAL_MODULE_TAGS := optional
72 LOCAL_SHARED_LIBRARIES := liblog
73 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
74 include $(BUILD_HOST_STATIC_LIBRARY)
77 # Note: It's good to get the tests compiled both for the host and the target so
78 # we get to test with both Bionic libc and glibc
80 # libbtcore unit tests for target
81 # ========================================================
83 LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
84 LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
85 LOCAL_SRC_FILES := $(btcoreCommonTestSrc)
86 LOCAL_CFLAGS := -Wall -Werror -Werror=unused-variable
87 LOCAL_MODULE := net_test_btcore
88 LOCAL_MODULE_TAGS := tests
89 LOCAL_SHARED_LIBRARIES := liblog libpower
90 LOCAL_STATIC_LIBRARIES := libbtcore libosi
91 include $(BUILD_NATIVE_TEST)
93 # libbtcore unit tests for host
94 # ========================================================
95 ifeq ($(HOST_OS),linux)
97 LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
98 LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
99 LOCAL_SRC_FILES := $(btcoreCommonTestSrc)
100 LOCAL_CFLAGS := -Wall -Werror -Werror=unused-variable
101 LOCAL_MODULE := net_test_btcore
102 LOCAL_MODULE_TAGS := tests
103 LOCAL_SHARED_LIBRARIES := liblog
104 LOCAL_STATIC_LIBRARIES := libbtcore-host libosi-host
105 include $(BUILD_HOST_NATIVE_TEST)