xref: /aosp_15_r20/trusty/kernel/lib/libcxx-trusty/rules.mk (revision 344aa361028b423587d4ef3fa52a23d194628137)
1*344aa361SAndroid Build Coastguard Worker#
2*344aa361SAndroid Build Coastguard Worker# Copyright (c) 2022, Google, Inc. All rights reserved
3*344aa361SAndroid Build Coastguard Worker#
4*344aa361SAndroid Build Coastguard Worker# Permission is hereby granted, free of charge, to any person obtaining
5*344aa361SAndroid Build Coastguard Worker# a copy of this software and associated documentation files
6*344aa361SAndroid Build Coastguard Worker# (the "Software"), to deal in the Software without restriction,
7*344aa361SAndroid Build Coastguard Worker# including without limitation the rights to use, copy, modify, merge,
8*344aa361SAndroid Build Coastguard Worker# publish, distribute, sublicense, and/or sell copies of the Software,
9*344aa361SAndroid Build Coastguard Worker# and to permit persons to whom the Software is furnished to do so,
10*344aa361SAndroid Build Coastguard Worker# subject to the following conditions:
11*344aa361SAndroid Build Coastguard Worker#
12*344aa361SAndroid Build Coastguard Worker# The above copyright notice and this permission notice shall be
13*344aa361SAndroid Build Coastguard Worker# included in all copies or substantial portions of the Software.
14*344aa361SAndroid Build Coastguard Worker#
15*344aa361SAndroid Build Coastguard Worker# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16*344aa361SAndroid Build Coastguard Worker# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17*344aa361SAndroid Build Coastguard Worker# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18*344aa361SAndroid Build Coastguard Worker# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19*344aa361SAndroid Build Coastguard Worker# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20*344aa361SAndroid Build Coastguard Worker# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21*344aa361SAndroid Build Coastguard Worker# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22*344aa361SAndroid Build Coastguard Worker#
23*344aa361SAndroid Build Coastguard Worker
24*344aa361SAndroid Build Coastguard WorkerLOCAL_DIR := $(GET_LOCAL_DIR)
25*344aa361SAndroid Build Coastguard Worker
26*344aa361SAndroid Build Coastguard WorkerMODULE := $(LOCAL_DIR)
27*344aa361SAndroid Build Coastguard Worker
28*344aa361SAndroid Build Coastguard WorkerLIBCXX_DIR = external/libcxx
29*344aa361SAndroid Build Coastguard Worker
30*344aa361SAndroid Build Coastguard WorkerGLOBAL_INCLUDES += $(LIBCXX_DIR)/include
31*344aa361SAndroid Build Coastguard WorkerGLOBAL_INCLUDES += $(LOCAL_DIR)/include
32*344aa361SAndroid Build Coastguard Worker
33*344aa361SAndroid Build Coastguard Worker# The header files change if they're being used to build the library.
34*344aa361SAndroid Build Coastguard Worker# For example, adding "public" methods that are only used internally.
35*344aa361SAndroid Build Coastguard WorkerMODULE_CPPFLAGS += -D_LIBCPP_BUILDING_LIBRARY
36*344aa361SAndroid Build Coastguard Worker
37*344aa361SAndroid Build Coastguard Worker# libcxx defines fallback functions unless it knows they'll be found in libcxxabi.
38*344aa361SAndroid Build Coastguard WorkerMODULE_CPPFLAGS += -DLIBCXX_BUILDING_LIBCXXABI
39*344aa361SAndroid Build Coastguard Worker
40*344aa361SAndroid Build Coastguard Worker# The following should be CXXFLAGS, compile.mk uses CPPFLAGS for C++ rather than
41*344aa361SAndroid Build Coastguard Worker# preprocessor flags and implicit variables are never used so it should not be
42*344aa361SAndroid Build Coastguard Worker# an issue.
43*344aa361SAndroid Build Coastguard WorkerGLOBAL_CPPFLAGS += \
44*344aa361SAndroid Build Coastguard Worker	-D_LIBCPP_BUILD_STATIC \
45*344aa361SAndroid Build Coastguard Worker	-D_LIBCPP_HAS_MUSL_LIBC \
46*344aa361SAndroid Build Coastguard Worker	-D_LIBCPP_HAS_C11_FEATURES \
47*344aa361SAndroid Build Coastguard Worker
48*344aa361SAndroid Build Coastguard Worker# This enables a libcxx build flag which disables visibility attributes so that
49*344aa361SAndroid Build Coastguard Worker# the global -fvisibility=hidden flag that we set in engine.mk will apply to
50*344aa361SAndroid Build Coastguard Worker# this module's sources. -fvisibility=hidden is required for
51*344aa361SAndroid Build Coastguard Worker# -fvirtual-function-elimination which we use to remove dead floating point code
52*344aa361SAndroid Build Coastguard Worker# in libcxx.
53*344aa361SAndroid Build Coastguard WorkerGLOBAL_CPPFLAGS += -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
54*344aa361SAndroid Build Coastguard Worker
55*344aa361SAndroid Build Coastguard Worker# This libcxx module implements an external threading API using LK's
56*344aa361SAndroid Build Coastguard Worker# thread.h/mutex.h.
57*344aa361SAndroid Build Coastguard WorkerGLOBAL_CPPFLAGS += -D_LIBCPP_HAS_THREAD_API_EXTERNAL
58*344aa361SAndroid Build Coastguard Worker
59*344aa361SAndroid Build Coastguard WorkerMODULE_SRCS := \
60*344aa361SAndroid Build Coastguard Worker	$(LIBCXX_DIR)/src/algorithm.cpp \
61*344aa361SAndroid Build Coastguard Worker	$(LIBCXX_DIR)/src/exception.cpp \
62*344aa361SAndroid Build Coastguard Worker	$(LIBCXX_DIR)/src/ios.cpp \
63*344aa361SAndroid Build Coastguard Worker	$(LIBCXX_DIR)/src/iostream.cpp \
64*344aa361SAndroid Build Coastguard Worker	$(LIBCXX_DIR)/src/locale.cpp \
65*344aa361SAndroid Build Coastguard Worker	$(LIBCXX_DIR)/src/memory.cpp \
66*344aa361SAndroid Build Coastguard Worker	$(LIBCXX_DIR)/src/mutex.cpp \
67*344aa361SAndroid Build Coastguard Worker	$(LIBCXX_DIR)/src/new.cpp \
68*344aa361SAndroid Build Coastguard Worker	$(LIBCXX_DIR)/src/string.cpp \
69*344aa361SAndroid Build Coastguard Worker	$(LIBCXX_DIR)/src/vector.cpp \
70*344aa361SAndroid Build Coastguard Worker
71*344aa361SAndroid Build Coastguard Worker
72*344aa361SAndroid Build Coastguard WorkerMODULE_DEPS += \
73*344aa361SAndroid Build Coastguard Worker	trusty/kernel/lib/libcxxabi-trusty \
74*344aa361SAndroid Build Coastguard Worker
75*344aa361SAndroid Build Coastguard Workerinclude make/module.mk
76