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 17 LOCAL_PATH := $(call my-dir) 18 19 LIBCXX_SRC_FILES := \ 20 src/algorithm.cpp \ 21 src/bind.cpp \ 22 src/chrono.cpp \ 23 src/condition_variable.cpp \ 24 src/debug.cpp \ 25 src/exception.cpp \ 26 src/future.cpp \ 27 src/hash.cpp \ 28 src/ios.cpp \ 29 src/iostream.cpp \ 30 src/locale.cpp \ 31 src/memory.cpp \ 32 src/mutex.cpp \ 33 src/new.cpp \ 34 src/optional.cpp \ 35 src/random.cpp \ 36 src/regex.cpp \ 37 src/shared_mutex.cpp \ 38 src/stdexcept.cpp \ 39 src/string.cpp \ 40 src/strstream.cpp \ 41 src/system_error.cpp \ 42 src/thread.cpp \ 43 src/typeinfo.cpp \ 44 src/utility.cpp \ 45 src/valarray.cpp \ 46 47 LIBCXX_C_INCLUDES := \ 48 $(LOCAL_PATH)/include/ \ 49 external/libcxxabi/include \ 50 51 LIBCXX_CPPFLAGS := \ 52 -std=c++11 \ 53 -nostdinc++ \ 54 -fexceptions \ 55 56 # target static lib 57 include $(CLEAR_VARS) 58 LOCAL_MODULE := libc++ 59 LOCAL_CLANG := true 60 LOCAL_SRC_FILES := $(LIBCXX_SRC_FILES) 61 LOCAL_C_INCLUDES := $(LIBCXX_C_INCLUDES) 62 LOCAL_CPPFLAGS := $(LIBCXX_CPPFLAGS) 63 LOCAL_RTTI_FLAG := -frtti 64 LOCAL_WHOLE_STATIC_LIBRARIES := libc++abi libcompiler_rt 65 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 66 include $(BUILD_STATIC_LIBRARY) 67 68 # target dynamic lib 69 include $(CLEAR_VARS) 70 LOCAL_MODULE := libc++ 71 LOCAL_CLANG := true 72 LOCAL_WHOLE_STATIC_LIBRARIES := libc++ 73 LOCAL_SHARED_LIBRARIES := libdl 74 LOCAL_SYSTEM_SHARED_LIBRARIES := libc libm 75 76 ifneq ($(TARGET_ARCH),arm) 77 LOCAL_SHARED_LIBRARIES += libdl 78 endif 79 80 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 81 include $(BUILD_SHARED_LIBRARY) 82 83 # host static lib 84 include $(CLEAR_VARS) 85 LOCAL_MODULE := libc++ 86 LOCAL_CLANG := true 87 LOCAL_SRC_FILES := $(LIBCXX_SRC_FILES) 88 LOCAL_C_INCLUDES := $(LIBCXX_C_INCLUDES) 89 LOCAL_CPPFLAGS := $(LIBCXX_CPPFLAGS) 90 LOCAL_RTTI_FLAG := -frtti 91 LOCAL_WHOLE_STATIC_LIBRARIES := libc++abi 92 LOCAL_MULTILIB := both 93 94 ifneq ($(HOST_OS), darwin) 95 LOCAL_WHOLE_STATIC_LIBRARIES += libcompiler_rt 96 endif 97 98 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 99 include $(BUILD_HOST_STATIC_LIBRARY) 100 101 # Don't build for unbundled branches 102 ifeq (,$(TARGET_BUILD_APPS)) 103 104 # host dynamic lib 105 include $(CLEAR_VARS) 106 LOCAL_MODULE := libc++ 107 LOCAL_CLANG := true 108 LOCAL_LDFLAGS := -nodefaultlibs 109 LOCAL_LDLIBS := -lc 110 LOCAL_WHOLE_STATIC_LIBRARIES := libc++ 111 LOCAL_MULTILIB := both 112 113 ifeq ($(HOST_OS), darwin) 114 LOCAL_LDFLAGS += \ 115 -Wl,-unexported_symbols_list,external/libcxx/lib/libc++unexp.exp \ 116 -Wl,-force_symbols_not_weak_list,external/libcxx/lib/notweak.exp \ 117 -Wl,-force_symbols_weak_list,external/libcxx/lib/weak.exp 118 else 119 LOCAL_LDLIBS += -lrt -lpthread -ldl -lm 120 endif 121 122 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 123 include $(BUILD_HOST_SHARED_LIBRARY) 124 125 endif # TARGET_BUILD_APPS 126