1#
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
17include $(CLEAR_VARS)
18
19ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64 x86_64))
20# Many init services failed to start with clang for x86_64, mips, mips64
21LOCAL_CLANG := false
22endif
23
24LOCAL_MODULE := $(libunwind_module)
25LOCAL_MODULE_TAGS := $(libunwind_module_tag)
26ifeq ($(libunwind_build_type),host)
27# Always make host multilib, and always use clang.
28LOCAL_MULTILIB := both
29LOCAL_CLANG := true
30else
31LOCAL_MULTILIB := $($(libunwind_module)_multilib)
32endif
33
34ifneq ($(findstring LIBRARY, $(libunwind_build_target)),LIBRARY)
35ifeq ($(LOCAL_MULTILIB),both)
36    LOCAL_MODULE_STEM_32 := $(libunwind_module)32
37    LOCAL_MODULE_STEM_64 := $(libunwind_module)64
38endif
39endif
40
41LOCAL_ADDITIONAL_DEPENDENCIES := \
42    $(LOCAL_PATH)/Android.mk \
43    $(LOCAL_PATH)/Android.build.mk \
44
45LOCAL_CFLAGS += \
46    $(libunwind_common_cflags) \
47    $(libunwind_common_cflags_$(libunwind_build_type)) \
48    $($(libunwind_module)_cflags) \
49    $($(libunwind_module)_cflags_$(libunwind_build_type)) \
50
51LOCAL_CLANG_CFLAGS += \
52    $(libunwind_common_clang_cflags) \
53    $(libunwind_common_clang_cflags_$(libunwind_build_type)) \
54    $($(libunwind_module)_clang_cflags) \
55    $($(libunwind_module)_clang_cflags_$(libunwind_build_type)) \
56
57LOCAL_CONLYFLAGS += \
58    $(libunwind_common_conlyflags) \
59    $(libunwind_common_conlyflags_$(libunwind_build_type)) \
60    $($(libunwind_module)_conlyflags) \
61    $($(libunwind_module)_conlyflags_$(libunwind_build_type)) \
62
63LOCAL_CPPFLAGS += \
64    $(libunwind_common_cppflags) \
65    $($(libunwind_module)_cppflags) \
66    $($(libunwind_module)_cppflags_$(libunwind_build_type)) \
67
68LOCAL_C_INCLUDES := \
69    $(libunwind_common_c_includes) \
70    $($(libunwind_module)_c_includes) \
71    $($(libunwind_module)_c_includes_$(libunwind_build_type)) \
72
73LOCAL_EXPORT_C_INCLUDE_DIRS := \
74    $($(libunwind_module)_export_c_include_dirs)
75
76$(foreach arch,$(libunwind_arches), \
77    $(eval LOCAL_C_INCLUDES_$(arch) := $(libunwind_common_c_includes_$(arch))))
78
79LOCAL_SRC_FILES := \
80    $($(libunwind_module)_src_files) \
81    $($(libunwind_module)_src_files_$(build_type)) \
82
83$(foreach arch,$(libunwind_arches), \
84    $(eval LOCAL_SRC_FILES_$(arch) := $($(libunwind_module)_src_files_$(arch))))
85
86LOCAL_SRC_FILES_32 := $($(libunwind_module)_src_files_32)
87LOCAL_SRC_FILES_64 := $($(libunwind_module)_src_files_64)
88
89LOCAL_STATIC_LIBRARIES := \
90    $($(libunwind_module)_static_libraries) \
91    $($(libunwind_module)_static_libraries_$(libunwind_build_type)) \
92
93LOCAL_WHOLE_STATIC_LIBRARIES := \
94    $($(libunwind_module)_whole_static_libraries) \
95    $($(libunwind_module)_whole_static_libraries_$(libunwind_build_type)) \
96
97LOCAL_SHARED_LIBRARIES := \
98    $($(libunwind_module)_shared_libraries) \
99    $($(libunwind_module)_shared_libraries_$(libunwind_build_type)) \
100
101LOCAL_LDLIBS := \
102    $($(libunwind_module)_ldlibs) \
103    $($(libunwind_module)_ldlibs_$(libunwind_build_type)) \
104
105LOCAL_LDFLAGS := \
106    $($(libunwind_module)_ldflags) \
107    $($(libunwind_module)_ldflags_$(libunwind_build_type)) \
108
109# Translate arm64 to aarch64 in c includes and src files.
110LOCAL_C_INCLUDES_arm64 := \
111    $(subst tdep-arm64,tdep-aarch64,$(LOCAL_C_INCLUDES_arm64))
112
113LOCAL_SRC_FILES_arm64 := \
114    $(subst src/arm64,src/aarch64,$(LOCAL_SRC_FILES_arm64))
115
116LOCAL_SANITIZE := never
117
118ifeq ($(libunwind_build_type),target)
119  include $(BUILD_$(libunwind_build_target))
120endif
121
122ifeq ($(libunwind_build_type),host)
123  # Only build if host builds are supported.
124  ifeq ($(libunwind_build_host),true)
125    include $(BUILD_HOST_$(libunwind_build_target))
126  endif
127endif
128