blob: 2afae8fcdb60b4a859428beabd4c7c634932fb97 [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
17LOCAL_PATH := $(call my-dir)
18
19LIBCXX_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 \
Dan Albert2ef012e2014-04-08 12:03:21 -070046
Dan Albert6c2fdb82014-05-16 09:55:15 -070047LIBCXX_C_INCLUDES := \
48 $(LOCAL_PATH)/include/ \
Dan Albert3bfb9442014-06-23 16:32:13 -070049 external/libcxxabi/include \
Dan Albert6c2fdb82014-05-16 09:55:15 -070050
Dan Albert2ef012e2014-04-08 12:03:21 -070051LIBCXX_CPPFLAGS := \
Dan Albert2ef012e2014-04-08 12:03:21 -070052 -std=c++11 \
Dan Albert8a6f7b12014-05-01 17:49:58 -070053 -nostdinc++ \
Dan Albert2ef012e2014-04-08 12:03:21 -070054 -fexceptions \
55
Dan Albert6c2fdb82014-05-16 09:55:15 -070056# target static lib
Dan Albert2ef012e2014-04-08 12:03:21 -070057include $(CLEAR_VARS)
Dan Albertb82dd132014-09-26 15:43:43 -070058LOCAL_MODULE := libc++_static
Dan Albert2ef012e2014-04-08 12:03:21 -070059LOCAL_CLANG := true
60LOCAL_SRC_FILES := $(LIBCXX_SRC_FILES)
Dan Albert3bfb9442014-06-23 16:32:13 -070061LOCAL_C_INCLUDES := $(LIBCXX_C_INCLUDES)
62LOCAL_CPPFLAGS := $(LIBCXX_CPPFLAGS)
Dan Albertf1550542014-05-06 14:16:05 -070063LOCAL_RTTI_FLAG := -frtti
Dan Albert8d0c51f2015-04-01 15:19:05 -070064LOCAL_WHOLE_STATIC_LIBRARIES := libc++abi
Dan Albertc4ecec12014-09-15 12:54:16 -070065LOCAL_CXX_STL := none
Dan Albert6c2fdb82014-05-16 09:55:15 -070066include $(BUILD_STATIC_LIBRARY)
67
68# target dynamic lib
69include $(CLEAR_VARS)
70LOCAL_MODULE := libc++
71LOCAL_CLANG := true
Dan Albertb82dd132014-09-26 15:43:43 -070072LOCAL_WHOLE_STATIC_LIBRARIES := libc++_static
Dan Albert9569f042014-05-01 18:12:37 -070073LOCAL_SHARED_LIBRARIES := libdl
Dan Albertc4ecec12014-09-15 12:54:16 -070074LOCAL_CXX_STL := none
Dan Albert2cfc4792015-03-31 16:33:55 -070075LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm
Dan Albert076df932015-06-23 13:34:02 -070076LOCAL_LDFLAGS_arm := -Wl,--exclude-libs,libunwind_llvm.a
Dan Albert2ef012e2014-04-08 12:03:21 -070077include $(BUILD_SHARED_LIBRARY)
78
Dan Albert6c2fdb82014-05-16 09:55:15 -070079# host static lib
Dan Albert2ef012e2014-04-08 12:03:21 -070080include $(CLEAR_VARS)
Dan Albertb82dd132014-09-26 15:43:43 -070081LOCAL_MODULE := libc++_static
Dan Albert2ef012e2014-04-08 12:03:21 -070082LOCAL_CLANG := true
83LOCAL_SRC_FILES := $(LIBCXX_SRC_FILES)
Dan Albert6c2fdb82014-05-16 09:55:15 -070084LOCAL_C_INCLUDES := $(LIBCXX_C_INCLUDES)
Dan Albert2ef012e2014-04-08 12:03:21 -070085LOCAL_CPPFLAGS := $(LIBCXX_CPPFLAGS)
Dan Albertf1550542014-05-06 14:16:05 -070086LOCAL_RTTI_FLAG := -frtti
Dan Albert3bfb9442014-06-23 16:32:13 -070087LOCAL_WHOLE_STATIC_LIBRARIES := libc++abi
Ian Rogersada29642014-06-05 11:09:44 -070088LOCAL_MULTILIB := both
Dan Albertc4ecec12014-09-15 12:54:16 -070089LOCAL_CXX_STL := none
Dan Albert6c2fdb82014-05-16 09:55:15 -070090include $(BUILD_HOST_STATIC_LIBRARY)
91
Ying Wangb1300bd2014-08-01 14:17:08 -070092# Don't build for unbundled branches
93ifeq (,$(TARGET_BUILD_APPS))
94
Dan Albert6c2fdb82014-05-16 09:55:15 -070095# host dynamic lib
96include $(CLEAR_VARS)
97LOCAL_MODULE := libc++
98LOCAL_CLANG := true
99LOCAL_LDFLAGS := -nodefaultlibs
Dan Albertb82dd132014-09-26 15:43:43 -0700100LOCAL_WHOLE_STATIC_LIBRARIES := libc++_static
Ian Rogersada29642014-06-05 11:09:44 -0700101LOCAL_MULTILIB := both
Dan Albertc4ecec12014-09-15 12:54:16 -0700102LOCAL_CXX_STL := none
Dan Albert6c2fdb82014-05-16 09:55:15 -0700103
104ifeq ($(HOST_OS), darwin)
Dan Albert8a6f7b12014-05-01 17:49:58 -0700105LOCAL_LDFLAGS += \
Tim Murrayd513b7a2014-04-21 15:06:30 -0700106 -Wl,-unexported_symbols_list,external/libcxx/lib/libc++unexp.exp \
Tim Murrayd513b7a2014-04-21 15:06:30 -0700107 -Wl,-force_symbols_not_weak_list,external/libcxx/lib/notweak.exp \
108 -Wl,-force_symbols_weak_list,external/libcxx/lib/weak.exp
109else
Dan Albert94962fb2015-03-03 15:05:07 -0800110LOCAL_LDLIBS += -lrt -lpthread -ldl
Tim Murrayd513b7a2014-04-21 15:06:30 -0700111endif
112
Dan Albert2ef012e2014-04-08 12:03:21 -0700113include $(BUILD_HOST_SHARED_LIBRARY)
Stephen Hines27ae7cb2014-04-25 19:13:02 -0700114
Dan Albert0f81d762014-07-18 14:15:56 -0700115LIT := $(ANDROID_BUILD_TOP)/external/llvm/utils/lit/lit.py
Dan Albert78f8c192015-01-07 16:16:05 -0800116LIBCXX_CONFIGTESTS := $(ANDROID_BUILD_TOP)/external/libcxx/buildcmds/configtests.py
117LIBCXX_TEST_MK := $(ANDROID_BUILD_TOP)/external/libcxx/test.mk
118
119test-libcxx-target: test-libcxx-target-clang
120test-libcxx-host: test-libcxx-host-clang
121
122test-libcxx-target-clang: libc++
123 python $(LIBCXX_CONFIGTESTS) --compiler=clang
124 LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
125test-libcxx-target-gcc: libc++
126 python $(LIBCXX_CONFIGTESTS) --compiler=gcc
127 LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
128test-libcxx-target-clang-32: libc++
129 python $(LIBCXX_CONFIGTESTS) --bitness=32 --compiler=clang
130 LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
131test-libcxx-target-gcc-32: libc++
132 python $(LIBCXX_CONFIGTESTS) --bitness=32 --compiler=gcc
133 LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
134test-libcxx-target-clang-64: libc++
135 python $(LIBCXX_CONFIGTESTS) --bitness=64 --compiler=clang
136 LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
137test-libcxx-target-gcc-64: libc++
138 python $(LIBCXX_CONFIGTESTS) --bitness=64 --compiler=gcc
139 LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
140
141test-libcxx-host-clang: libc++
142 python $(LIBCXX_CONFIGTESTS) --compiler=clang --host
143 LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
144test-libcxx-host-gcc: libc++
145 python $(LIBCXX_CONFIGTESTS) --compiler=gcc --host
146 LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
147test-libcxx-host-clang-32: libc++
148 python $(LIBCXX_CONFIGTESTS) --bitness=32 --compiler=clang --host
149 LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
150test-libcxx-host-gcc-32: libc++
151 python $(LIBCXX_CONFIGTESTS) --bitness=32 --compiler=gcc --host
152 LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
153test-libcxx-host-clang-64: libc++
154 python $(LIBCXX_CONFIGTESTS) --bitness=64 --compiler=clang --host
155 LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
156test-libcxx-host-gcc-64: libc++
157 python $(LIBCXX_CONFIGTESTS) --bitness=64 --compiler=gcc --host
158 LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
Dan Albert0f81d762014-07-18 14:15:56 -0700159
160# Don't want to just make test-libcxx-(host|target) dependencies of this because
161# the two families can't be run concurrently.
162test-libcxx: libc++
Dan Albert78f8c192015-01-07 16:16:05 -0800163 python buildcmds/configtests.py --host
Dan Albert0f81d762014-07-18 14:15:56 -0700164 LIT=$(LIT) LIT_MODE=host make -f $(ANDROID_BUILD_TOP)/external/libcxx/test.mk
Dan Albert78f8c192015-01-07 16:16:05 -0800165 python buildcmds/configtests.py
Dan Albert0f81d762014-07-18 14:15:56 -0700166 LIT=$(LIT) LIT_MODE=device make -f $(ANDROID_BUILD_TOP)/external/libcxx/test.mk
167
Stephen Hines27ae7cb2014-04-25 19:13:02 -0700168endif # TARGET_BUILD_APPS