blob: 8c9e1f1fdbde39b1d6ff964903cd76e64d535bc3 [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 \
43 $(LOCAL_PATH)/../osi/include \
44 $(LOCAL_PATH)/..
45
46# libbtcore static library for target
47# ========================================================
48include $(CLEAR_VARS)
Chih-Hung Hsieh918e5a62015-08-13 12:27:32 -070049LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
Arman Uguray145cf572015-07-31 19:14:39 -070050LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
51LOCAL_SRC_FILES := $(btcoreCommonSrc)
52LOCAL_CFLAGS := -std=c99 $(bdroid_CFLAGS)
53LOCAL_MODULE := libbtcore
54LOCAL_MODULE_TAGS := optional
55LOCAL_SHARED_LIBRARIES := libc liblog
56LOCAL_MODULE_CLASS := STATIC_LIBRARIES
57include $(BUILD_STATIC_LIBRARY)
58
59# libbtcore static library for host
60# ========================================================
61ifeq ($(HOST_OS),linux)
62include $(CLEAR_VARS)
Chih-Hung Hsieh918e5a62015-08-13 12:27:32 -070063LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
Arman Uguray145cf572015-07-31 19:14:39 -070064LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
65LOCAL_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.
69LOCAL_CFLAGS := -std=c99 $(bdroid_CFLAGS) -D_GNU_SOURCE
70LOCAL_MODULE := libbtcore-host
71LOCAL_MODULE_TAGS := optional
72LOCAL_SHARED_LIBRARIES := liblog
73LOCAL_MODULE_CLASS := STATIC_LIBRARIES
74include $(BUILD_HOST_STATIC_LIBRARY)
75endif
76
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
79
80# libbtcore unit tests for target
81# ========================================================
82include $(CLEAR_VARS)
Chih-Hung Hsieh918e5a62015-08-13 12:27:32 -070083LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
Arman Uguray145cf572015-07-31 19:14:39 -070084LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
85LOCAL_SRC_FILES := $(btcoreCommonTestSrc)
Chris Manton0116e18b2014-11-11 13:15:13 -080086LOCAL_CFLAGS := -Wall -Werror -Werror=unused-variable
Sharvil Nanavati61683572014-12-29 00:56:46 -080087LOCAL_MODULE := net_test_btcore
Chris Manton0116e18b2014-11-11 13:15:13 -080088LOCAL_MODULE_TAGS := tests
Sharvil Nanavatide86bfa2015-09-09 15:56:17 -070089LOCAL_SHARED_LIBRARIES := liblog libpower
Chris Manton0116e18b2014-11-11 13:15:13 -080090LOCAL_STATIC_LIBRARIES := libbtcore libosi
Chris Manton0116e18b2014-11-11 13:15:13 -080091include $(BUILD_NATIVE_TEST)
Arman Uguray145cf572015-07-31 19:14:39 -070092
93# libbtcore unit tests for host
94# ========================================================
95ifeq ($(HOST_OS),linux)
96include $(CLEAR_VARS)
Chih-Hung Hsieh918e5a62015-08-13 12:27:32 -070097LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition
Arman Uguray145cf572015-07-31 19:14:39 -070098LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
99LOCAL_SRC_FILES := $(btcoreCommonTestSrc)
100LOCAL_CFLAGS := -Wall -Werror -Werror=unused-variable
101LOCAL_MODULE := net_test_btcore
102LOCAL_MODULE_TAGS := tests
103LOCAL_SHARED_LIBRARIES := liblog
104LOCAL_STATIC_LIBRARIES := libbtcore-host libosi-host
105include $(BUILD_HOST_NATIVE_TEST)
106endif