xref: /aosp_15_r20/trusty/kernel/lib/libcxxabi-trusty/rules.mk (revision 344aa361028b423587d4ef3fa52a23d194628137)
1#
2# Copyright (c) 2022, Google, Inc. All rights reserved
3#
4# Permission is hereby granted, free of charge, to any person obtaining
5# a copy of this software and associated documentation files
6# (the "Software"), to deal in the Software without restriction,
7# including without limitation the rights to use, copy, modify, merge,
8# publish, distribute, sublicense, and/or sell copies of the Software,
9# and to permit persons to whom the Software is furnished to do so,
10# subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be
13# included in all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22#
23
24LOCAL_DIR := $(GET_LOCAL_DIR)
25
26MODULE := $(LOCAL_DIR)
27
28LIBCXXABI_DIR = external/libcxxabi
29
30GLOBAL_INCLUDES += $(LIBCXXABI_DIR)/include
31
32# Internal libcxxabi build requires std::unexpected_handler to be defined, even
33# though it is removed as of C++17. Building with LIBCPP_BUILDING_LIBRARY
34# includes this required non-spec definition in the build.
35MODULE_CPPFLAGS += -D_LIBCPP_BUILDING_LIBRARY
36
37# The way we define LIBCPP_BUILDING_LIBRARY above conflicts with a definition in
38# the fallback allocator. The resulting error is safe to ignore.
39MODULE_COMPILEFLAGS += -Wno-macro-redefined
40
41MODULE_COMPILEFLAGS += -D_LIBCXXABI_BUILDING_LIBRARY -D_LIBCXXABI_HAS_NO_THREADS
42
43# Required if compiling without exceptions.
44MODULE_COMPILEFLAGS += -D_LIBCXXABI_NO_EXCEPTIONS
45
46# Required if compiling without RTTI, but also helps binary size.
47MODULE_COMPILEFLAGS += -DLIBCXXABI_SILENT_TERMINATE
48
49MODULE_SRCS := \
50	$(LIBCXXABI_DIR)/src/cxa_aux_runtime.cpp \
51	$(LIBCXXABI_DIR)/src/cxa_default_handlers.cpp \
52	$(LIBCXXABI_DIR)/src/cxa_demangle.cpp \
53	$(LIBCXXABI_DIR)/src/cxa_exception_storage.cpp \
54	$(LIBCXXABI_DIR)/src/cxa_guard.cpp \
55	$(LIBCXXABI_DIR)/src/cxa_handlers.cpp \
56	$(LIBCXXABI_DIR)/src/cxa_unexpected.cpp \
57	$(LIBCXXABI_DIR)/src/cxa_vector.cpp \
58	$(LIBCXXABI_DIR)/src/stdlib_exception.cpp \
59	$(LIBCXXABI_DIR)/src/stdlib_stdexcept.cpp \
60	$(LIBCXXABI_DIR)/src/stdlib_typeinfo.cpp \
61	$(LIBCXXABI_DIR)/src/abort_message.cpp \
62	$(LIBCXXABI_DIR)/src/fallback_malloc.cpp \
63
64# Exceptions disabled
65MODULE_SRCS += \
66        $(LIBCXXABI_DIR)/src/cxa_noexception.cpp \
67
68# Files that do not compile without exceptions
69# $(LIBCXXABI_DIR)/src/cxa_exception.cpp \
70# $(LIBCXXABI_DIR)/src/cxa_personality.cpp \
71
72# Files that do not compile without RTTI
73# $(LIBCXXABI_DIR)/src/private_typeinfo.cpp \
74
75MODULE_DEPS := \
76	trusty/kernel/lib/libcxx-trusty
77
78include make/module.mk
79