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 | |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 19 | libbacktrace_common_cflags := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 20 | -Wall \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 21 | -Werror \ |
| 22 | |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 23 | libbacktrace_common_conlyflags := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 24 | -std=gnu99 \ |
| 25 | |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 26 | libbacktrace_common_cppflags := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 27 | -std=gnu++11 \ |
| 28 | |
Stephen Hines | 035e9ba | 2015-03-31 09:39:20 -0700 | [diff] [blame] | 29 | # The latest clang (r230699) does not allow SP/PC to be declared in inline asm lists. |
| 30 | libbacktrace_common_clang_cflags += \ |
| 31 | -Wno-inline-asm |
| 32 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 33 | build_host := false |
| 34 | ifeq ($(HOST_OS),linux) |
| 35 | ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64)) |
| 36 | build_host := true |
| 37 | endif |
| 38 | endif |
| 39 | |
| 40 | #------------------------------------------------------------------------- |
| 41 | # The libbacktrace library. |
| 42 | #------------------------------------------------------------------------- |
| 43 | libbacktrace_src_files := \ |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 44 | Backtrace.cpp \ |
| 45 | BacktraceCurrent.cpp \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 46 | BacktraceMap.cpp \ |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 47 | BacktracePtrace.cpp \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 48 | thread_utils.c \ |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 49 | ThreadEntry.cpp \ |
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 | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 54 | libbacktrace_shared_libraries_target := \ |
| 55 | libcutils \ |
| 56 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 57 | libbacktrace_shared_libraries := \ |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 58 | libbase \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 59 | libunwind \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 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 | 3cdbfdc | 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 |
Dan Albert | 0d7164d | 2014-11-11 15:15:21 -0800 | [diff] [blame] | 77 | libbacktrace_multilib := both |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 78 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 9e1ee2b | 2013-10-02 14:19:19 -0700 | [diff] [blame] | 79 | |
Dan Albert | 40a46dd | 2014-05-19 10:10:37 -0700 | [diff] [blame] | 80 | #------------------------------------------------------------------------- |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 81 | # The libbacktrace_test library needed by backtrace_test. |
| 82 | #------------------------------------------------------------------------- |
| 83 | libbacktrace_test_cflags := \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 84 | -O0 \ |
| 85 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 86 | libbacktrace_test_src_files := \ |
| 87 | backtrace_testlib.c \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 88 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 89 | module := libbacktrace_test |
| 90 | module_tag := debug |
| 91 | build_type := target |
| 92 | build_target := SHARED_LIBRARY |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 93 | libbacktrace_test_multilib := both |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 94 | include $(LOCAL_PATH)/Android.build.mk |
| 95 | build_type := host |
| 96 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 97 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 98 | #------------------------------------------------------------------------- |
| 99 | # The backtrace_test executable. |
| 100 | #------------------------------------------------------------------------- |
| 101 | backtrace_test_cflags := \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 102 | -fno-builtin \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 103 | -O0 \ |
| 104 | -g \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 105 | |
| 106 | backtrace_test_cflags_target := \ |
Christopher Ferris | e296091 | 2014-03-07 19:42:19 -0800 | [diff] [blame] | 107 | -DENABLE_PSS_TESTS \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 108 | |
| 109 | backtrace_test_src_files := \ |
| 110 | backtrace_test.cpp \ |
Christopher Ferris | e296091 | 2014-03-07 19:42:19 -0800 | [diff] [blame] | 111 | GetPss.cpp \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 112 | thread_utils.c \ |
| 113 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 114 | backtrace_test_ldlibs_host := \ |
Ying Wang | 9f437d7 | 2014-05-07 15:36:05 -0700 | [diff] [blame] | 115 | -lpthread \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 116 | -lrt \ |
| 117 | |
| 118 | backtrace_test_shared_libraries := \ |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 119 | libbacktrace_test \ |
| 120 | libbacktrace \ |
Christopher Ferris | 684fb77 | 2015-05-08 15:44:46 -0700 | [diff] [blame] | 121 | libbase \ |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 122 | libcutils \ |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 123 | |
Christopher Ferris | 684fb77 | 2015-05-08 15:44:46 -0700 | [diff] [blame] | 124 | backtrace_test_shared_libraries_target += \ |
| 125 | libdl \ |
| 126 | |
| 127 | backtrace_test_ldlibs_host += \ |
| 128 | -ldl \ |
Christopher Ferris | a2efd3a | 2014-05-06 15:23:59 -0700 | [diff] [blame] | 129 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 130 | module := backtrace_test |
| 131 | module_tag := debug |
| 132 | build_type := target |
| 133 | build_target := NATIVE_TEST |
Christopher Ferris | 2c43cff | 2015-03-26 19:18:36 -0700 | [diff] [blame] | 134 | backtrace_test_multilib := both |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 135 | include $(LOCAL_PATH)/Android.build.mk |
| 136 | build_type := host |
| 137 | include $(LOCAL_PATH)/Android.build.mk |
Christopher Ferris | 17e91d4 | 2013-10-21 13:30:52 -0700 | [diff] [blame] | 138 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 139 | #---------------------------------------------------------------------------- |
| 140 | # Special truncated libbacktrace library for mac. |
| 141 | #---------------------------------------------------------------------------- |
| 142 | ifeq ($(HOST_OS),darwin) |
Christopher Ferris | 7fb2287 | 2013-09-27 12:43:15 -0700 | [diff] [blame] | 143 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 144 | include $(CLEAR_VARS) |
Christopher Ferris | f67c641 | 2014-01-10 00:43:54 -0800 | [diff] [blame] | 145 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 146 | LOCAL_MODULE := libbacktrace |
| 147 | LOCAL_MODULE_TAGS := optional |
| 148 | |
| 149 | LOCAL_SRC_FILES := \ |
| 150 | BacktraceMap.cpp \ |
| 151 | |
Dan Albert | 5570c9b | 2014-11-13 14:54:10 -0800 | [diff] [blame] | 152 | LOCAL_MULTILIB := both |
| 153 | |
Christopher Ferris | 04b1e8c | 2014-01-30 01:13:33 -0800 | [diff] [blame] | 154 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 155 | |
| 156 | endif # HOST_OS-darwin |