1#
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19LIBCXX_SRC_FILES := \
20    src/algorithm.cpp \
21    src/any.cpp \
22    src/bind.cpp \
23    src/chrono.cpp \
24    src/condition_variable.cpp \
25    src/debug.cpp \
26    src/exception.cpp \
27    src/future.cpp \
28    src/hash.cpp \
29    src/ios.cpp \
30    src/iostream.cpp \
31    src/locale.cpp \
32    src/memory.cpp \
33    src/mutex.cpp \
34    src/new.cpp \
35    src/optional.cpp \
36    src/random.cpp \
37    src/regex.cpp \
38    src/shared_mutex.cpp \
39    src/stdexcept.cpp \
40    src/string.cpp \
41    src/strstream.cpp \
42    src/system_error.cpp \
43    src/thread.cpp \
44    src/typeinfo.cpp \
45    src/utility.cpp \
46    src/valarray.cpp \
47
48LIBCXX_C_INCLUDES := \
49    $(LOCAL_PATH)/include/ \
50
51LIBCXX_CPPFLAGS := \
52    -std=c++14 \
53    -nostdinc++ \
54    -fexceptions \
55
56# target static lib
57include $(CLEAR_VARS)
58LOCAL_MODULE := libc++_static
59LOCAL_CLANG := true
60LOCAL_SRC_FILES := $(LIBCXX_SRC_FILES)
61LOCAL_C_INCLUDES := $(LIBCXX_C_INCLUDES)
62LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include external/libcxxabi/include
63LOCAL_CPPFLAGS := $(LIBCXX_CPPFLAGS)
64LOCAL_RTTI_FLAG := -frtti
65LOCAL_WHOLE_STATIC_LIBRARIES := libc++abi
66LOCAL_CXX_STL := none
67include $(BUILD_STATIC_LIBRARY)
68
69# target dynamic lib
70include $(CLEAR_VARS)
71LOCAL_MODULE := libc++
72LOCAL_CLANG := true
73LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include external/libcxxabi/include
74LOCAL_WHOLE_STATIC_LIBRARIES := libc++_static
75LOCAL_SHARED_LIBRARIES := libdl
76LOCAL_CXX_STL := none
77LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm
78LOCAL_LDFLAGS_arm := -Wl,--exclude-libs,libunwind_llvm.a
79include $(BUILD_SHARED_LIBRARY)
80
81# host static lib
82include $(CLEAR_VARS)
83LOCAL_MODULE := libc++_static
84LOCAL_CLANG := true
85LOCAL_SRC_FILES := $(LIBCXX_SRC_FILES)
86LOCAL_C_INCLUDES := $(LIBCXX_C_INCLUDES)
87LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include external/libcxxabi/include
88LOCAL_CPPFLAGS := $(LIBCXX_CPPFLAGS)
89LOCAL_RTTI_FLAG := -frtti
90LOCAL_WHOLE_STATIC_LIBRARIES := libc++abi
91LOCAL_MULTILIB := both
92LOCAL_CXX_STL := none
93include $(BUILD_HOST_STATIC_LIBRARY)
94
95# host dynamic lib
96include $(CLEAR_VARS)
97LOCAL_MODULE := libc++
98LOCAL_CLANG := true
99LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include external/libcxxabi/include
100LOCAL_LDFLAGS := -nodefaultlibs
101LOCAL_WHOLE_STATIC_LIBRARIES := libc++_static
102LOCAL_MULTILIB := both
103LOCAL_CXX_STL := none
104
105ifeq ($(HOST_OS), darwin)
106LOCAL_LDFLAGS += \
107            -Wl,-unexported_symbols_list,external/libcxx/lib/libc++unexp.exp  \
108            -Wl,-force_symbols_not_weak_list,external/libcxx/lib/notweak.exp \
109            -Wl,-force_symbols_weak_list,external/libcxx/lib/weak.exp
110else
111LOCAL_LDLIBS += -lrt -lpthread -ldl
112endif
113
114include $(BUILD_HOST_SHARED_LIBRARY)
115
116ifdef LIBCXX_TESTING
117include $(LOCAL_PATH)/buildcmds/Android.mk
118endif
119