Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 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 | # |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 16 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 17 | LOCAL_PATH:= $(call my-dir) |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 18 | |
| 19 | common_cflags := \ |
| 20 | -Wall \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 21 | -Werror \ |
| 22 | |
| 23 | common_conlyflags := \ |
| 24 | -std=gnu99 \ |
| 25 | |
| 26 | common_cppflags := \ |
| 27 | -std=gnu++11 \ |
| 28 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 29 | build_host := false |
| 30 | ifeq ($(HOST_OS),linux) |
| 31 | ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64)) |
| 32 | build_host := true |
| 33 | endif |
| 34 | endif |
| 35 | |
| 36 | #------------------------------------------------------------------------- |
| 37 | # The libbacktrace library. |
| 38 | #------------------------------------------------------------------------- |
| 39 | libbacktrace_src_files := \ |
| 40 | BacktraceImpl.cpp \ |
| 41 | BacktraceMap.cpp \ |
| 42 | BacktraceThread.cpp \ |
| 43 | thread_utils.c \ |
| 44 | |
| 45 | libbacktrace_shared_libraries_target := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 46 | libcutils \ |
| 47 | libgccdemangle \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 48 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 49 | libbacktrace_src_files += \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 50 | UnwindCurrent.cpp \ |
Christopher Ferris | df29061 | 2014-01-22 19:21:07 -0800 | [diff] [blame] | 51 | UnwindMap.cpp \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 52 | UnwindPtrace.cpp \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 53 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 54 | libbacktrace_c_includes := \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 55 | external/libunwind/include \ |
| 56 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 57 | libbacktrace_shared_libraries := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 58 | libunwind \ |
| 59 | libunwind-ptrace \ |
| 60 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 61 | libbacktrace_shared_libraries_host := \ |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 62 | liblog \ |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 63 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 64 | libbacktrace_static_libraries_host := \ |
| 65 | libcutils \ |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 66 | |
Christopher Ferris | db44538 | 2014-11-08 15:57:11 -0800 | [diff] [blame] | 67 | libbacktrace_ldlibs_host := \ |
| 68 | -lpthread \ |
| 69 | -lrt \ |
| 70 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 71 | module := libbacktrace |
| 72 | module_tag := optional |
| 73 | build_type := target |
| 74 | build_target := SHARED_LIBRARY |
| 75 | include $(LOCAL_PATH)/Android.build.mk |
| 76 | build_type := host |
| 77 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 78 | |
Dan Albert | a8b8460 | 2014-05-19 11:40:27 -0700 | [diff] [blame] | 79 | # Don't build for unbundled branches |
| 80 | ifeq (,$(TARGET_BUILD_APPS)) |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 81 | #------------------------------------------------------------------------- |
Dan Albert | 40a46dd | 2014-05-19 10:10:37 -0700 | [diff] [blame] | 82 | # The libbacktrace library (libc++) |
| 83 | #------------------------------------------------------------------------- |
| 84 | libbacktrace_libc++_src_files := \ |
| 85 | BacktraceImpl.cpp \ |
| 86 | BacktraceMap.cpp \ |
| 87 | BacktraceThread.cpp \ |
| 88 | thread_utils.c \ |
| 89 | |
| 90 | libbacktrace_libc++_shared_libraries_target := \ |
| 91 | libcutils \ |
| 92 | libgccdemangle \ |
| 93 | |
| 94 | libbacktrace_libc++_src_files += \ |
| 95 | UnwindCurrent.cpp \ |
| 96 | UnwindMap.cpp \ |
| 97 | UnwindPtrace.cpp \ |
| 98 | |
| 99 | libbacktrace_libc++_c_includes := \ |
| 100 | external/libunwind/include \ |
| 101 | |
| 102 | libbacktrace_libc++_shared_libraries := \ |
| 103 | libunwind \ |
| 104 | libunwind-ptrace \ |
| 105 | |
| 106 | libbacktrace_libc++_shared_libraries_host := \ |
| 107 | liblog \ |
| 108 | |
| 109 | libbacktrace_libc++_static_libraries_host := \ |
| 110 | libcutils \ |
| 111 | |
Christopher Ferris | db44538 | 2014-11-08 15:57:11 -0800 | [diff] [blame] | 112 | libbacktrace_libc++_ldlibs_host := \ |
| 113 | -lpthread \ |
| 114 | -lrt \ |
| 115 | |
Dan Albert | 40a46dd | 2014-05-19 10:10:37 -0700 | [diff] [blame] | 116 | libbacktrace_libc++_libc++ := true |
| 117 | |
| 118 | module := libbacktrace_libc++ |
| 119 | module_tag := optional |
| 120 | build_type := target |
| 121 | build_target := SHARED_LIBRARY |
| 122 | include $(LOCAL_PATH)/Android.build.mk |
| 123 | build_type := host |
Ian Rogers | 5af80aa | 2014-06-17 01:50:25 -0700 | [diff] [blame] | 124 | libbacktrace_libc++_multilib := both |
Dan Albert | 40a46dd | 2014-05-19 10:10:37 -0700 | [diff] [blame] | 125 | include $(LOCAL_PATH)/Android.build.mk |
Ian Rogers | 5af80aa | 2014-06-17 01:50:25 -0700 | [diff] [blame] | 126 | libbacktrace_libc++_multilib := |
Dan Albert | a8b8460 | 2014-05-19 11:40:27 -0700 | [diff] [blame] | 127 | endif |
Dan Albert | 40a46dd | 2014-05-19 10:10:37 -0700 | [diff] [blame] | 128 | |
| 129 | #------------------------------------------------------------------------- |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 130 | # The libbacktrace_test library needed by backtrace_test. |
| 131 | #------------------------------------------------------------------------- |
| 132 | libbacktrace_test_cflags := \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 133 | -O0 \ |
| 134 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 135 | libbacktrace_test_src_files := \ |
| 136 | backtrace_testlib.c \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 137 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 138 | module := libbacktrace_test |
| 139 | module_tag := debug |
| 140 | build_type := target |
| 141 | build_target := SHARED_LIBRARY |
| 142 | include $(LOCAL_PATH)/Android.build.mk |
| 143 | build_type := host |
| 144 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 145 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 146 | #------------------------------------------------------------------------- |
| 147 | # The backtrace_test executable. |
| 148 | #------------------------------------------------------------------------- |
| 149 | backtrace_test_cflags := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 150 | -fno-builtin \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 151 | -O0 \ |
| 152 | -g \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 153 | |
| 154 | backtrace_test_cflags_target := \ |
Christopher Ferris | e296091 | 2014-03-07 19:42:19 -0800 | [diff] [blame] | 155 | -DENABLE_PSS_TESTS \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 156 | |
| 157 | backtrace_test_src_files := \ |
| 158 | backtrace_test.cpp \ |
Christopher Ferris | e296091 | 2014-03-07 19:42:19 -0800 | [diff] [blame] | 159 | GetPss.cpp \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 160 | thread_utils.c \ |
| 161 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 162 | backtrace_test_ldlibs_host := \ |
Ying Wang | 9f437d7 | 2014-05-07 15:36:05 -0700 | [diff] [blame] | 163 | -lpthread \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 164 | -lrt \ |
| 165 | |
| 166 | backtrace_test_shared_libraries := \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 167 | libbacktrace_test \ |
| 168 | libbacktrace \ |
| 169 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 170 | backtrace_test_shared_libraries_target := \ |
| 171 | libcutils \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 172 | |
Christopher Ferris | a2efd3a | 2014-05-06 15:23:59 -0700 | [diff] [blame] | 173 | backtrace_test_static_libraries_host := \ |
| 174 | libcutils \ |
| 175 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 176 | module := backtrace_test |
| 177 | module_tag := debug |
| 178 | build_type := target |
| 179 | build_target := NATIVE_TEST |
| 180 | include $(LOCAL_PATH)/Android.build.mk |
| 181 | build_type := host |
| 182 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 183 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 184 | #---------------------------------------------------------------------------- |
| 185 | # Special truncated libbacktrace library for mac. |
| 186 | #---------------------------------------------------------------------------- |
| 187 | ifeq ($(HOST_OS),darwin) |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 188 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 189 | include $(CLEAR_VARS) |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 190 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 191 | LOCAL_MODULE := libbacktrace |
| 192 | LOCAL_MODULE_TAGS := optional |
| 193 | |
| 194 | LOCAL_SRC_FILES := \ |
| 195 | BacktraceMap.cpp \ |
| 196 | |
| 197 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 198 | |
Ian Rogers | deebae5 | 2014-06-11 12:55:50 -0700 | [diff] [blame] | 199 | # Don't build for unbundled branches |
| 200 | ifeq (,$(TARGET_BUILD_APPS)) |
| 201 | #------------------------------------------------------------------------- |
| 202 | # The libbacktrace library (libc++) |
| 203 | #------------------------------------------------------------------------- |
| 204 | include $(CLEAR_VARS) |
| 205 | |
| 206 | LOCAL_MODULE := libbacktrace_libc++ |
| 207 | LOCAL_MODULE_TAGS := optional |
| 208 | |
| 209 | LOCAL_SRC_FILES := \ |
| 210 | BacktraceMap.cpp \ |
| 211 | |
Ian Rogers | c132aaf | 2014-06-24 21:57:55 -0700 | [diff] [blame] | 212 | LOCAL_MULTILIB := both |
| 213 | |
Ian Rogers | deebae5 | 2014-06-11 12:55:50 -0700 | [diff] [blame] | 214 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 215 | |
| 216 | endif # TARGET_BUILD_APPS |
| 217 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 218 | endif # HOST_OS-darwin |