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 | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 67 | module := libbacktrace |
| 68 | module_tag := optional |
| 69 | build_type := target |
| 70 | build_target := SHARED_LIBRARY |
| 71 | include $(LOCAL_PATH)/Android.build.mk |
| 72 | build_type := host |
| 73 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 74 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 75 | #------------------------------------------------------------------------- |
Dan Albert | 40a46dd | 2014-05-19 10:10:37 -0700 | [diff] [blame^] | 76 | # The libbacktrace library (libc++) |
| 77 | #------------------------------------------------------------------------- |
| 78 | libbacktrace_libc++_src_files := \ |
| 79 | BacktraceImpl.cpp \ |
| 80 | BacktraceMap.cpp \ |
| 81 | BacktraceThread.cpp \ |
| 82 | thread_utils.c \ |
| 83 | |
| 84 | libbacktrace_libc++_shared_libraries_target := \ |
| 85 | libcutils \ |
| 86 | libgccdemangle \ |
| 87 | |
| 88 | libbacktrace_libc++_src_files += \ |
| 89 | UnwindCurrent.cpp \ |
| 90 | UnwindMap.cpp \ |
| 91 | UnwindPtrace.cpp \ |
| 92 | |
| 93 | libbacktrace_libc++_c_includes := \ |
| 94 | external/libunwind/include \ |
| 95 | |
| 96 | libbacktrace_libc++_shared_libraries := \ |
| 97 | libunwind \ |
| 98 | libunwind-ptrace \ |
| 99 | |
| 100 | libbacktrace_libc++_shared_libraries_host := \ |
| 101 | liblog \ |
| 102 | |
| 103 | libbacktrace_libc++_static_libraries_host := \ |
| 104 | libcutils \ |
| 105 | |
| 106 | libbacktrace_libc++_libc++ := true |
| 107 | |
| 108 | module := libbacktrace_libc++ |
| 109 | module_tag := optional |
| 110 | build_type := target |
| 111 | build_target := SHARED_LIBRARY |
| 112 | include $(LOCAL_PATH)/Android.build.mk |
| 113 | build_type := host |
| 114 | include $(LOCAL_PATH)/Android.build.mk |
| 115 | |
| 116 | #------------------------------------------------------------------------- |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 117 | # The libbacktrace_test library needed by backtrace_test. |
| 118 | #------------------------------------------------------------------------- |
| 119 | libbacktrace_test_cflags := \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 120 | -O0 \ |
| 121 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 122 | libbacktrace_test_src_files := \ |
| 123 | backtrace_testlib.c \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 124 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 125 | module := libbacktrace_test |
| 126 | module_tag := debug |
| 127 | build_type := target |
| 128 | build_target := SHARED_LIBRARY |
| 129 | include $(LOCAL_PATH)/Android.build.mk |
| 130 | build_type := host |
| 131 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 132 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 133 | #------------------------------------------------------------------------- |
| 134 | # The backtrace_test executable. |
| 135 | #------------------------------------------------------------------------- |
| 136 | backtrace_test_cflags := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 137 | -fno-builtin \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 138 | -O0 \ |
| 139 | -g \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 140 | |
| 141 | backtrace_test_cflags_target := \ |
Christopher Ferris | e296091 | 2014-03-07 19:42:19 -0800 | [diff] [blame] | 142 | -DENABLE_PSS_TESTS \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 143 | |
| 144 | backtrace_test_src_files := \ |
| 145 | backtrace_test.cpp \ |
Christopher Ferris | e296091 | 2014-03-07 19:42:19 -0800 | [diff] [blame] | 146 | GetPss.cpp \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 147 | thread_utils.c \ |
| 148 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 149 | backtrace_test_ldlibs_host := \ |
Ying Wang | 9f437d7 | 2014-05-07 15:36:05 -0700 | [diff] [blame] | 150 | -lpthread \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 151 | -lrt \ |
| 152 | |
| 153 | backtrace_test_shared_libraries := \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 154 | libbacktrace_test \ |
| 155 | libbacktrace \ |
| 156 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 157 | backtrace_test_shared_libraries_target := \ |
| 158 | libcutils \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 159 | |
Christopher Ferris | a2efd3a | 2014-05-06 15:23:59 -0700 | [diff] [blame] | 160 | backtrace_test_static_libraries_host := \ |
| 161 | libcutils \ |
| 162 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 163 | module := backtrace_test |
| 164 | module_tag := debug |
| 165 | build_type := target |
| 166 | build_target := NATIVE_TEST |
| 167 | include $(LOCAL_PATH)/Android.build.mk |
| 168 | build_type := host |
| 169 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 170 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 171 | #---------------------------------------------------------------------------- |
| 172 | # Special truncated libbacktrace library for mac. |
| 173 | #---------------------------------------------------------------------------- |
| 174 | ifeq ($(HOST_OS),darwin) |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 175 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 176 | include $(CLEAR_VARS) |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 177 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 178 | LOCAL_MODULE := libbacktrace |
| 179 | LOCAL_MODULE_TAGS := optional |
| 180 | |
| 181 | LOCAL_SRC_FILES := \ |
| 182 | BacktraceMap.cpp \ |
| 183 | |
| 184 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 185 | |
| 186 | endif # HOST_OS-darwin |