Sharvil Nanavati | 8a6a89f | 2014-08-20 09:39:25 -0700 | [diff] [blame] | 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 | |
Arman Uguray | 145cf57 | 2015-07-31 19:14:39 -0700 | [diff] [blame] | 21 | # Common variables |
| 22 | # ======================================================== |
| 23 | btcoreCommonSrc := \ |
Sharvil Nanavati | d1e05de | 2014-08-27 19:03:03 -0700 | [diff] [blame] | 24 | src/bdaddr.c \ |
Chris Manton | 78a51cb | 2014-08-13 16:38:57 -0700 | [diff] [blame] | 25 | src/counter.c \ |
Chris Manton | 0bc7d27 | 2014-11-19 22:15:35 -0800 | [diff] [blame] | 26 | src/device_class.c \ |
Arman Uguray | f2d6434 | 2015-07-08 15:47:39 -0700 | [diff] [blame] | 27 | src/hal_util.c \ |
Zach Johnson | 72f308e | 2014-09-22 22:14:04 -0700 | [diff] [blame] | 28 | src/module.c \ |
Andre Eisenbach | cae219f | 2015-05-18 09:41:06 -0700 | [diff] [blame] | 29 | src/osi_module.c \ |
Chris Manton | 5c26224 | 2014-10-14 22:00:32 -0700 | [diff] [blame] | 30 | src/property.c \ |
Sharvil Nanavati | d1e05de | 2014-08-27 19:03:03 -0700 | [diff] [blame] | 31 | src/uuid.c |
Sharvil Nanavati | 8a6a89f | 2014-08-20 09:39:25 -0700 | [diff] [blame] | 32 | |
Arman Uguray | 145cf57 | 2015-07-31 19:14:39 -0700 | [diff] [blame] | 33 | btcoreCommonTestSrc := \ |
Zach Johnson | 05d0366 | 2014-11-05 14:29:31 -0800 | [diff] [blame] | 34 | ./test/bdaddr_test.cpp \ |
Chris Manton | 0116e18b | 2014-11-11 13:15:13 -0800 | [diff] [blame] | 35 | ./test/counter_test.cpp \ |
Chris Manton | 0bc7d27 | 2014-11-19 22:15:35 -0800 | [diff] [blame] | 36 | ./test/device_class_test.cpp \ |
Chris Manton | 97c5444 | 2015-01-07 13:34:18 -0800 | [diff] [blame] | 37 | ./test/property_test.cpp \ |
Chris Manton | 3623bc8 | 2014-11-11 12:14:52 -0800 | [diff] [blame] | 38 | ./test/uuid_test.cpp \ |
Chris Manton | 0116e18b | 2014-11-11 13:15:13 -0800 | [diff] [blame] | 39 | ../osi/test/AllocationTestHarness.cpp |
| 40 | |
Arman Uguray | 145cf57 | 2015-07-31 19:14:39 -0700 | [diff] [blame] | 41 | btcoreCommonIncludes := \ |
| 42 | $(LOCAL_PATH)/include \ |
Arman Uguray | 145cf57 | 2015-07-31 19:14:39 -0700 | [diff] [blame] | 43 | $(LOCAL_PATH)/.. |
| 44 | |
| 45 | # libbtcore static library for target |
| 46 | # ======================================================== |
| 47 | include $(CLEAR_VARS) |
Chih-Hung Hsieh | 918e5a6 | 2015-08-13 12:27:32 -0700 | [diff] [blame] | 48 | LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition |
Arman Uguray | 145cf57 | 2015-07-31 19:14:39 -0700 | [diff] [blame] | 49 | LOCAL_C_INCLUDES := $(btcoreCommonIncludes) |
| 50 | LOCAL_SRC_FILES := $(btcoreCommonSrc) |
| 51 | LOCAL_CFLAGS := -std=c99 $(bdroid_CFLAGS) |
| 52 | LOCAL_MODULE := libbtcore |
| 53 | LOCAL_MODULE_TAGS := optional |
| 54 | LOCAL_SHARED_LIBRARIES := libc liblog |
| 55 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 56 | include $(BUILD_STATIC_LIBRARY) |
| 57 | |
| 58 | # libbtcore static library for host |
| 59 | # ======================================================== |
| 60 | ifeq ($(HOST_OS),linux) |
| 61 | include $(CLEAR_VARS) |
Chih-Hung Hsieh | 918e5a6 | 2015-08-13 12:27:32 -0700 | [diff] [blame] | 62 | LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition |
Arman Uguray | 145cf57 | 2015-07-31 19:14:39 -0700 | [diff] [blame] | 63 | LOCAL_C_INCLUDES := $(btcoreCommonIncludes) |
| 64 | LOCAL_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. |
| 68 | LOCAL_CFLAGS := -std=c99 $(bdroid_CFLAGS) -D_GNU_SOURCE |
| 69 | LOCAL_MODULE := libbtcore-host |
| 70 | LOCAL_MODULE_TAGS := optional |
| 71 | LOCAL_SHARED_LIBRARIES := liblog |
| 72 | LOCAL_MODULE_CLASS := STATIC_LIBRARIES |
| 73 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 74 | endif |
| 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 | # ======================================================== |
| 81 | include $(CLEAR_VARS) |
Chih-Hung Hsieh | 918e5a6 | 2015-08-13 12:27:32 -0700 | [diff] [blame] | 82 | LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition |
Arman Uguray | 145cf57 | 2015-07-31 19:14:39 -0700 | [diff] [blame] | 83 | LOCAL_C_INCLUDES := $(btcoreCommonIncludes) |
| 84 | LOCAL_SRC_FILES := $(btcoreCommonTestSrc) |
Chris Manton | 0116e18b | 2014-11-11 13:15:13 -0800 | [diff] [blame] | 85 | LOCAL_CFLAGS := -Wall -Werror -Werror=unused-variable |
Sharvil Nanavati | 6168357 | 2014-12-29 00:56:46 -0800 | [diff] [blame] | 86 | LOCAL_MODULE := net_test_btcore |
Chris Manton | 0116e18b | 2014-11-11 13:15:13 -0800 | [diff] [blame] | 87 | LOCAL_MODULE_TAGS := tests |
Sharvil Nanavati | de86bfa | 2015-09-09 15:56:17 -0700 | [diff] [blame] | 88 | LOCAL_SHARED_LIBRARIES := liblog libpower |
Chris Manton | 0116e18b | 2014-11-11 13:15:13 -0800 | [diff] [blame] | 89 | LOCAL_STATIC_LIBRARIES := libbtcore libosi |
Chris Manton | 0116e18b | 2014-11-11 13:15:13 -0800 | [diff] [blame] | 90 | include $(BUILD_NATIVE_TEST) |
Arman Uguray | 145cf57 | 2015-07-31 19:14:39 -0700 | [diff] [blame] | 91 | |
| 92 | # libbtcore unit tests for host |
| 93 | # ======================================================== |
| 94 | ifeq ($(HOST_OS),linux) |
| 95 | include $(CLEAR_VARS) |
Chih-Hung Hsieh | 918e5a6 | 2015-08-13 12:27:32 -0700 | [diff] [blame] | 96 | LOCAL_CLANG_CFLAGS += -Wno-error=typedef-redefinition |
Arman Uguray | 145cf57 | 2015-07-31 19:14:39 -0700 | [diff] [blame] | 97 | LOCAL_C_INCLUDES := $(btcoreCommonIncludes) |
| 98 | LOCAL_SRC_FILES := $(btcoreCommonTestSrc) |
| 99 | LOCAL_CFLAGS := -Wall -Werror -Werror=unused-variable |
| 100 | LOCAL_MODULE := net_test_btcore |
| 101 | LOCAL_MODULE_TAGS := tests |
| 102 | LOCAL_SHARED_LIBRARIES := liblog |
| 103 | LOCAL_STATIC_LIBRARIES := libbtcore-host libosi-host |
| 104 | include $(BUILD_HOST_NATIVE_TEST) |
| 105 | endif |