1#
2# Copyright (C) 2015 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
18LOCAL_PATH:= $(call my-dir)
19
20ubsan_rtl_files := \
21    ubsan_diag.cc \
22    ubsan_init.cc \
23    ubsan_flags.cc \
24    ubsan_handlers.cc \
25    ubsan_value.cc \
26
27ubsan_cxx_rtl_files := \
28    ubsan_handlers_cxx.cc \
29    ubsan_type_hash.cc \
30    ubsan_type_hash_itanium.cc \
31    ubsan_type_hash_win.cc \
32
33ubsan_rtl_cppflags := \
34    -fvisibility=hidden \
35    -fno-exceptions \
36    -std=c++11 \
37    -Wall \
38    -Werror \
39    -Wno-unused-parameter \
40    -Wno-non-virtual-dtor \
41
42ubsan_rtl_c_includes := \
43    external/compiler-rt/lib \
44
45################################################################################
46# Target modules
47
48include $(CLEAR_VARS)
49LOCAL_MODULE := libubsan
50LOCAL_CPP_EXTENSION := .cc
51LOCAL_C_INCLUDES := $(ubsan_rtl_c_includes)
52LOCAL_CPPFLAGS := $(ubsan_rtl_cppflags)
53LOCAL_SRC_FILES := $(ubsan_rtl_files)
54LOCAL_NDK_STL_VARIANT := none
55LOCAL_SDK_VERSION := 19
56LOCAL_SANITIZE := never
57LOCAL_MODULE_TARGET_ARCH := arm arm64 x86
58LOCAL_MULTILIB := both
59include $(BUILD_STATIC_LIBRARY)
60
61################################################################################
62# Host modules
63
64ifneq ($(HOST_OS),darwin)
65
66include $(CLEAR_VARS)
67LOCAL_MODULE := libubsan
68LOCAL_CPP_EXTENSION := .cc
69LOCAL_C_INCLUDES := $(ubsan_rtl_c_includes)
70LOCAL_CPPFLAGS := $(ubsan_rtl_cppflags) -fno-rtti
71LOCAL_SRC_FILES := $(ubsan_rtl_files)
72LOCAL_CXX_STL := none
73LOCAL_SANITIZE := never
74LOCAL_MULTILIB := both
75include $(BUILD_HOST_STATIC_LIBRARY)
76
77include $(CLEAR_VARS)
78LOCAL_MODULE := libubsan_standalone
79LOCAL_CPP_EXTENSION := .cc
80LOCAL_C_INCLUDES := $(ubsan_rtl_c_includes)
81LOCAL_CPPFLAGS := $(ubsan_rtl_cppflags) -fno-rtti
82LOCAL_SRC_FILES := $(ubsan_rtl_files)
83LOCAL_WHOLE_STATIC_LIBRARIES := libsan
84LOCAL_CXX_STL := none
85LOCAL_SANITIZE := never
86LOCAL_MULTILIB := both
87include $(BUILD_HOST_STATIC_LIBRARY)
88
89include $(CLEAR_VARS)
90LOCAL_MODULE := libubsan_cxx
91LOCAL_CPP_EXTENSION := .cc
92LOCAL_C_INCLUDES := $(ubsan_rtl_c_includes)
93LOCAL_CPPFLAGS := $(ubsan_rtl_cppflags)
94LOCAL_SRC_FILES := $(ubsan_cxx_rtl_files)
95LOCAL_SANITIZE := never
96LOCAL_MULTILIB := both
97include $(BUILD_HOST_STATIC_LIBRARY)
98
99include $(CLEAR_VARS)
100LOCAL_MODULE := libubsan_standalone_cxx
101LOCAL_CPP_EXTENSION := .cc
102LOCAL_C_INCLUDES := $(ubsan_rtl_c_includes)
103LOCAL_CPPFLAGS := $(ubsan_rtl_cppflags)
104LOCAL_SRC_FILES := $(ubsan_cxx_rtl_files)
105LOCAL_SANITIZE := never
106LOCAL_MULTILIB := both
107include $(BUILD_HOST_STATIC_LIBRARY)
108
109endif
110