OSDN Git Service

Cleanup C and C++ compiler flags
[android-x86/system-bt.git] / btcore / 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 btcoreCommonSrc := \
24     src/bdaddr.c \
25     src/counter.c \
26     src/device_class.c \
27     src/hal_util.c \
28     src/module.c \
29     src/osi_module.c \
30     src/property.c \
31     src/uuid.c
32
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
40
41 btcoreCommonIncludes := \
42     $(LOCAL_PATH)/include \
43     $(LOCAL_PATH)/..
44
45 # libbtcore static library for target
46 # ========================================================
47 include $(CLEAR_VARS)
48 LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
49 LOCAL_SRC_FILES := $(btcoreCommonSrc)
50 LOCAL_MODULE := libbtcore
51 LOCAL_MODULE_TAGS := optional
52 LOCAL_SHARED_LIBRARIES := libc liblog
53 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
54
55 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
56 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
57 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
58
59 include $(BUILD_STATIC_LIBRARY)
60
61 # libbtcore static library for host
62 # ========================================================
63 ifeq ($(HOST_OS),linux)
64 include $(CLEAR_VARS)
65 LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
66 LOCAL_SRC_FILES := $(btcoreCommonSrc)
67 LOCAL_MODULE := libbtcore-host
68 LOCAL_MODULE_TAGS := optional
69 LOCAL_SHARED_LIBRARIES := liblog
70 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
71
72 # TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
73 # should be compatible for a Linux host OS. We should figure out what to do for
74 # a non-Linux host OS.
75 LOCAL_CFLAGS += $(bluetooth_CFLAGS) -D_GNU_SOURCE
76 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
77 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
78
79 include $(BUILD_HOST_STATIC_LIBRARY)
80 endif
81
82 # Note: It's good to get the tests compiled both for the host and the target so
83 # we get to test with both Bionic libc and glibc
84
85 # libbtcore unit tests for target
86 # ========================================================
87 include $(CLEAR_VARS)
88 LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
89 LOCAL_SRC_FILES := $(btcoreCommonTestSrc)
90 LOCAL_MODULE := net_test_btcore
91 LOCAL_MODULE_TAGS := tests
92 LOCAL_SHARED_LIBRARIES := liblog
93 LOCAL_STATIC_LIBRARIES := libbtcore libosi
94
95 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
96 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
97 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
98
99 include $(BUILD_NATIVE_TEST)
100
101 # libbtcore unit tests for host
102 # ========================================================
103 ifeq ($(HOST_OS),linux)
104 include $(CLEAR_VARS)
105 LOCAL_C_INCLUDES := $(btcoreCommonIncludes)
106 LOCAL_SRC_FILES := $(btcoreCommonTestSrc)
107 LOCAL_MODULE := net_test_btcore
108 LOCAL_MODULE_TAGS := tests
109 LOCAL_SHARED_LIBRARIES := liblog
110 LOCAL_STATIC_LIBRARIES := libbtcore-host libosi-host
111
112 LOCAL_CFLAGS += $(bluetooth_CFLAGS)
113 LOCAL_CONLYFLAGS += $(bluetooth_CONLYFLAGS)
114 LOCAL_CPPFLAGS += $(bluetooth_CPPFLAGS)
115
116 include $(BUILD_HOST_NATIVE_TEST)
117 endif