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