blob: 508c5f86a6556101822bc8f8eb61396ebe3715fd [file] [log] [blame]
Sharvil Nanavati8a6a89f2014-08-20 09:39:25 -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
19LOCAL_PATH := $(call my-dir)
20
Arman Uguray145cf572015-07-31 19:14:39 -070021# Common variables
22# ========================================================
23btcoreCommonSrc := \
Sharvil Nanavatid1e05de2014-08-27 19:03:03 -070024 src/bdaddr.c \
Chris Manton78a51cb2014-08-13 16:38:57 -070025 src/counter.c \
Chris Manton0bc7d272014-11-19 22:15:35 -080026 src/device_class.c \
Arman Ugurayf2d64342015-07-08 15:47:39 -070027 src/hal_util.c \
Zach Johnson72f308e2014-09-22 22:14:04 -070028 src/module.c \
Andre Eisenbachcae219f2015-05-18 09:41:06 -070029 src/osi_module.c \
Chris Manton5c262242014-10-14 22:00:32 -070030 src/property.c \
Sharvil Nanavatid1e05de2014-08-27 19:03:03 -070031 src/uuid.c
Sharvil Nanavati8a6a89f2014-08-20 09:39:25 -070032
Arman Uguray145cf572015-07-31 19:14:39 -070033btcoreCommonTestSrc := \
Zach Johnson05d03662014-11-05 14:29:31 -080034 ./test/bdaddr_test.cpp \
Chris Manton0116e18b2014-11-11 13:15:13 -080035 ./test/counter_test.cpp \
Chris Manton0bc7d272014-11-19 22:15:35 -080036 ./test/device_class_test.cpp \
Chris Manton97c54442015-01-07 13:34:18 -080037 ./test/property_test.cpp \
Chris Manton3623bc82014-11-11 12:14:52 -080038 ./test/uuid_test.cpp \
Chris Manton0116e18b2014-11-11 13:15:13 -080039 ../osi/test/AllocationTestHarness.cpp
40
Arman Uguray145cf572015-07-31 19:14:39 -070041btcoreCommonIncludes := \
42 $(LOCAL_PATH)/include \
Arman Uguray145cf572015-07-31 19:14:39 -070043 $(LOCAL_PATH)/..
44
45# libbtcore static library for target
46# ========================================================
47include $(CLEAR_VARS)
Chih-Hung Hsieh918e5a62015-08-13 12:27:32 -070048LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
Arman Uguray145cf572015-07-31 19:14:39 -070049LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
50LOCAL_SRC_FILES := $(btcoreCommonSrc)
51LOCAL_CFLAGS := -std=c99 $(bdroid_CFLAGS)
52LOCAL_MODULE := libbtcore
53LOCAL_MODULE_TAGS := optional
54LOCAL_SHARED_LIBRARIES := libc liblog
55LOCAL_MODULE_CLASS := STATIC_LIBRARIES
56include $(BUILD_STATIC_LIBRARY)
57
58# libbtcore static library for host
59# ========================================================
60ifeq ($(HOST_OS),linux)
61include $(CLEAR_VARS)
Chih-Hung Hsieh918e5a62015-08-13 12:27:32 -070062LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
Arman Uguray145cf572015-07-31 19:14:39 -070063LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
64LOCAL_SRC_FILES := $(btcoreCommonSrc)
65# TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
66# should be compatible for a Linux host OS. We should figure out what to do for
67# a non-Linux host OS.
68LOCAL_CFLAGS := -std=c99 $(bdroid_CFLAGS) -D_GNU_SOURCE
69LOCAL_MODULE := libbtcore-host
70LOCAL_MODULE_TAGS := optional
71LOCAL_SHARED_LIBRARIES := liblog
72LOCAL_MODULE_CLASS := STATIC_LIBRARIES
73include $(BUILD_HOST_STATIC_LIBRARY)
74endif
75
76# Note: It's good to get the tests compiled both for the host and the target so
77# we get to test with both Bionic libc and glibc
78
79# libbtcore unit tests for target
80# ========================================================
81include $(CLEAR_VARS)
Chih-Hung Hsieh918e5a62015-08-13 12:27:32 -070082LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
Arman Uguray145cf572015-07-31 19:14:39 -070083LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
84LOCAL_SRC_FILES := $(btcoreCommonTestSrc)
Chris Manton0116e18b2014-11-11 13:15:13 -080085LOCAL_CFLAGS := -Wall -Werror -Werror=unused-variable
Sharvil Nanavati61683572014-12-29 00:56:46 -080086LOCAL_MODULE := net_test_btcore
Chris Manton0116e18b2014-11-11 13:15:13 -080087LOCAL_MODULE_TAGS := tests
Sharvil Nanavatide86bfa2015-09-09 15:56:17 -070088LOCAL_SHARED_LIBRARIES := liblog libpower
Chris Manton0116e18b2014-11-11 13:15:13 -080089LOCAL_STATIC_LIBRARIES := libbtcore libosi
Chris Manton0116e18b2014-11-11 13:15:13 -080090include $(BUILD_NATIVE_TEST)
Arman Uguray145cf572015-07-31 19:14:39 -070091
92# libbtcore unit tests for host
93# ========================================================
94ifeq ($(HOST_OS),linux)
95include $(CLEAR_VARS)
Chih-Hung Hsieh918e5a62015-08-13 12:27:32 -070096LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
Arman Uguray145cf572015-07-31 19:14:39 -070097LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
98LOCAL_SRC_FILES := $(btcoreCommonTestSrc)
99LOCAL_CFLAGS := -Wall -Werror -Werror=unused-variable
100LOCAL_MODULE := net_test_btcore
101LOCAL_MODULE_TAGS := tests
102LOCAL_SHARED_LIBRARIES := liblog
103LOCAL_STATIC_LIBRARIES := libbtcore-host libosi-host
104include $(BUILD_HOST_NATIVE_TEST)
105endif