blob: 69144531ed7866a0258158a3404c277bd96ff99e [file] [log] [blame]
Dan Albert2ef012e2014-04-08 12:03:21 -07001#
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
Stephen Hines27ae7cb2014-04-25 19:13:02 -070017# Don't build for unbundled branches
18ifeq (,$(TARGET_BUILD_APPS))
19
Dan Albert2ef012e2014-04-08 12:03:21 -070020LOCAL_PATH := $(call my-dir)
21
22LIBCXX_SRC_FILES := \
23 src/algorithm.cpp \
24 src/bind.cpp \
25 src/chrono.cpp \
26 src/condition_variable.cpp \
27 src/debug.cpp \
28 src/exception.cpp \
29 src/future.cpp \
30 src/hash.cpp \
31 src/ios.cpp \
32 src/iostream.cpp \
33 src/locale.cpp \
34 src/memory.cpp \
35 src/mutex.cpp \
36 src/new.cpp \
37 src/optional.cpp \
38 src/random.cpp \
39 src/regex.cpp \
40 src/shared_mutex.cpp \
41 src/stdexcept.cpp \
42 src/string.cpp \
43 src/strstream.cpp \
44 src/system_error.cpp \
45 src/thread.cpp \
46 src/typeinfo.cpp \
47 src/utility.cpp \
48 src/valarray.cpp \
Dan Albert2ef012e2014-04-08 12:03:21 -070049
Dan Albert6c2fdb82014-05-16 09:55:15 -070050LIBCXX_C_INCLUDES := \
51 $(LOCAL_PATH)/include/ \
Dan Albert3bfb9442014-06-23 16:32:13 -070052 external/libcxxabi/include \
Dan Albert6c2fdb82014-05-16 09:55:15 -070053
Dan Albert2ef012e2014-04-08 12:03:21 -070054LIBCXX_CPPFLAGS := \
Dan Albert2ef012e2014-04-08 12:03:21 -070055 -std=c++11 \
Dan Albert8a6f7b12014-05-01 17:49:58 -070056 -nostdinc++ \
Dan Albert2ef012e2014-04-08 12:03:21 -070057 -fexceptions \
58
Dan Albert6c2fdb82014-05-16 09:55:15 -070059# target static lib
Dan Albert2ef012e2014-04-08 12:03:21 -070060include $(CLEAR_VARS)
61LOCAL_MODULE := libc++
62LOCAL_CLANG := true
63LOCAL_SRC_FILES := $(LIBCXX_SRC_FILES)
Dan Albert3bfb9442014-06-23 16:32:13 -070064LOCAL_C_INCLUDES := $(LIBCXX_C_INCLUDES)
65LOCAL_CPPFLAGS := $(LIBCXX_CPPFLAGS)
Dan Albertf1550542014-05-06 14:16:05 -070066LOCAL_RTTI_FLAG := -frtti
Dan Albert3bfb9442014-06-23 16:32:13 -070067LOCAL_WHOLE_STATIC_LIBRARIES := libc++abi libcompiler_rt
Dan Albert6c2fdb82014-05-16 09:55:15 -070068LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
69include $(BUILD_STATIC_LIBRARY)
70
71# target dynamic lib
72include $(CLEAR_VARS)
73LOCAL_MODULE := libc++
74LOCAL_CLANG := true
75LOCAL_WHOLE_STATIC_LIBRARIES := libc++
Dan Albert9569f042014-05-01 18:12:37 -070076LOCAL_SHARED_LIBRARIES := libdl
Dan Albert32ec1ea2014-05-23 18:44:06 -070077LOCAL_SYSTEM_SHARED_LIBRARIES := libc libm
Dan Albert226cd952014-04-16 10:58:40 -070078
Dan Albertc10e7192014-04-16 16:38:42 -070079ifneq ($(TARGET_ARCH),arm)
Dan Albert226cd952014-04-16 10:58:40 -070080 LOCAL_SHARED_LIBRARIES += libdl
81endif
82
Brian Carlstrom12c28912014-05-09 20:47:13 -070083LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Albert2ef012e2014-04-08 12:03:21 -070084include $(BUILD_SHARED_LIBRARY)
85
Dan Albert6c2fdb82014-05-16 09:55:15 -070086# host static lib
Dan Albert2ef012e2014-04-08 12:03:21 -070087include $(CLEAR_VARS)
88LOCAL_MODULE := libc++
89LOCAL_CLANG := true
90LOCAL_SRC_FILES := $(LIBCXX_SRC_FILES)
Dan Albert6c2fdb82014-05-16 09:55:15 -070091LOCAL_C_INCLUDES := $(LIBCXX_C_INCLUDES)
Dan Albert2ef012e2014-04-08 12:03:21 -070092LOCAL_CPPFLAGS := $(LIBCXX_CPPFLAGS)
Dan Albertf1550542014-05-06 14:16:05 -070093LOCAL_RTTI_FLAG := -frtti
Dan Albert3bfb9442014-06-23 16:32:13 -070094LOCAL_WHOLE_STATIC_LIBRARIES := libc++abi
Ian Rogersada29642014-06-05 11:09:44 -070095LOCAL_MULTILIB := both
Tim Murrayd513b7a2014-04-21 15:06:30 -070096
Dan Albert3bfb9442014-06-23 16:32:13 -070097ifneq ($(HOST_OS), darwin)
98LOCAL_WHOLE_STATIC_LIBRARIES += libcompiler_rt
Dan Albert6c2fdb82014-05-16 09:55:15 -070099endif
Dan Albert3bfb9442014-06-23 16:32:13 -0700100
Dan Albert6c2fdb82014-05-16 09:55:15 -0700101LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
102include $(BUILD_HOST_STATIC_LIBRARY)
103
104# host dynamic lib
105include $(CLEAR_VARS)
106LOCAL_MODULE := libc++
107LOCAL_CLANG := true
108LOCAL_LDFLAGS := -nodefaultlibs
109LOCAL_LDLIBS := -lc
110LOCAL_WHOLE_STATIC_LIBRARIES := libc++
Ian Rogersada29642014-06-05 11:09:44 -0700111LOCAL_MULTILIB := both
Dan Albert6c2fdb82014-05-16 09:55:15 -0700112
113ifeq ($(HOST_OS), darwin)
Dan Albert8a6f7b12014-05-01 17:49:58 -0700114LOCAL_LDFLAGS += \
Tim Murrayd513b7a2014-04-21 15:06:30 -0700115 -Wl,-unexported_symbols_list,external/libcxx/lib/libc++unexp.exp \
Tim Murrayd513b7a2014-04-21 15:06:30 -0700116 -Wl,-force_symbols_not_weak_list,external/libcxx/lib/notweak.exp \
117 -Wl,-force_symbols_weak_list,external/libcxx/lib/weak.exp
118else
Dan Albert7d57f1b2014-05-12 14:54:53 -0700119LOCAL_LDLIBS += -lrt -lpthread -ldl -lm
Tim Murrayd513b7a2014-04-21 15:06:30 -0700120endif
121
Brian Carlstrom12c28912014-05-09 20:47:13 -0700122LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dan Albert2ef012e2014-04-08 12:03:21 -0700123include $(BUILD_HOST_SHARED_LIBRARY)
Stephen Hines27ae7cb2014-04-25 19:13:02 -0700124
Dan Albert0f81d762014-07-18 14:15:56 -0700125LIT := $(ANDROID_BUILD_TOP)/external/llvm/utils/lit/lit.py
126test-libcxx-host: libc++
127 LIT=$(LIT) LIT_MODE=host make -f $(ANDROID_BUILD_TOP)/external/libcxx/test.mk
128test-libcxx-target: libc++
129 LIT=$(LIT) LIT_MODE=device make -f $(ANDROID_BUILD_TOP)/external/libcxx/test.mk
130
131# Don't want to just make test-libcxx-(host|target) dependencies of this because
132# the two families can't be run concurrently.
133test-libcxx: libc++
134 LIT=$(LIT) LIT_MODE=host make -f $(ANDROID_BUILD_TOP)/external/libcxx/test.mk
135 LIT=$(LIT) LIT_MODE=device make -f $(ANDROID_BUILD_TOP)/external/libcxx/test.mk
136
Stephen Hines27ae7cb2014-04-25 19:13:02 -0700137endif # TARGET_BUILD_APPS