blob: 20d704610562109a9e8732b68c5227cbcfb2fbef [file] [log] [blame]
Christopher Ferris04b1e8c2014-01-30 01:13:33 -08001#
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 Ferris7fb22872013-09-27 12:43:15 -070016
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080017LOCAL_PATH:= $(call my-dir)
Christopher Ferris17e91d42013-10-21 13:30:52 -070018
Christopher Ferris2c43cff2015-03-26 19:18:36 -070019libbacktrace_common_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070020 -Wall \
Christopher Ferris17e91d42013-10-21 13:30:52 -070021 -Werror \
22
Christopher Ferris2c43cff2015-03-26 19:18:36 -070023libbacktrace_common_conlyflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070024 -std=gnu99 \
25
Christopher Ferris2c43cff2015-03-26 19:18:36 -070026libbacktrace_common_cppflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070027 -std=gnu++11 \
28
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080029build_host := false
30ifeq ($(HOST_OS),linux)
31ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86 x86_64))
32build_host := true
33endif
34endif
35
36#-------------------------------------------------------------------------
37# The libbacktrace library.
38#-------------------------------------------------------------------------
39libbacktrace_src_files := \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070040 Backtrace.cpp \
41 BacktraceCurrent.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080042 BacktraceMap.cpp \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070043 BacktracePtrace.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080044 thread_utils.c \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070045 ThreadEntry.cpp \
Christopher Ferris17e91d42013-10-21 13:30:52 -070046 UnwindCurrent.cpp \
Christopher Ferrisdf290612014-01-22 19:21:07 -080047 UnwindMap.cpp \
Christopher Ferris17e91d42013-10-21 13:30:52 -070048 UnwindPtrace.cpp \
Christopher Ferris7fb22872013-09-27 12:43:15 -070049
Christopher Ferris2c43cff2015-03-26 19:18:36 -070050libbacktrace_shared_libraries_target := \
51 libcutils \
52
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080053libbacktrace_shared_libraries := \
Christopher Ferris2c43cff2015-03-26 19:18:36 -070054 libbase \
Christopher Ferris17e91d42013-10-21 13:30:52 -070055 libunwind \
56 libunwind-ptrace \
57
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080058libbacktrace_shared_libraries_host := \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070059 liblog \
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070060
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080061libbacktrace_static_libraries_host := \
62 libcutils \
Christopher Ferrisf67c6412014-01-10 00:43:54 -080063
Christopher Ferris3cdbfdc2014-11-08 15:57:11 -080064libbacktrace_ldlibs_host := \
65 -lpthread \
66 -lrt \
67
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080068module := libbacktrace
69module_tag := optional
70build_type := target
71build_target := SHARED_LIBRARY
72include $(LOCAL_PATH)/Android.build.mk
73build_type := host
Dan Albert0d7164d2014-11-11 15:15:21 -080074libbacktrace_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080075include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris9e1ee2b2013-10-02 14:19:19 -070076
Dan Albert40a46dd2014-05-19 10:10:37 -070077#-------------------------------------------------------------------------
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080078# The libbacktrace_test library needed by backtrace_test.
79#-------------------------------------------------------------------------
80libbacktrace_test_cflags := \
Christopher Ferris7fb22872013-09-27 12:43:15 -070081 -O0 \
82
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080083libbacktrace_test_src_files := \
84 backtrace_testlib.c \
Christopher Ferris17e91d42013-10-21 13:30:52 -070085
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080086module := libbacktrace_test
87module_tag := debug
88build_type := target
89build_target := SHARED_LIBRARY
Christopher Ferris2c43cff2015-03-26 19:18:36 -070090libbacktrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080091include $(LOCAL_PATH)/Android.build.mk
92build_type := host
93include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris7fb22872013-09-27 12:43:15 -070094
Christopher Ferris04b1e8c2014-01-30 01:13:33 -080095#-------------------------------------------------------------------------
96# The backtrace_test executable.
97#-------------------------------------------------------------------------
98backtrace_test_cflags := \
Christopher Ferris17e91d42013-10-21 13:30:52 -070099 -fno-builtin \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700100 -O0 \
101 -g \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800102
103backtrace_test_cflags_target := \
Christopher Ferrise2960912014-03-07 19:42:19 -0800104 -DENABLE_PSS_TESTS \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800105
106backtrace_test_src_files := \
107 backtrace_test.cpp \
Christopher Ferrise2960912014-03-07 19:42:19 -0800108 GetPss.cpp \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800109 thread_utils.c \
110
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800111backtrace_test_ldlibs_host := \
Ying Wang9f437d72014-05-07 15:36:05 -0700112 -lpthread \
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800113 -lrt \
114
115backtrace_test_shared_libraries := \
Christopher Ferris7fb22872013-09-27 12:43:15 -0700116 libbacktrace_test \
117 libbacktrace \
118
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800119backtrace_test_shared_libraries_target := \
120 libcutils \
Christopher Ferris17e91d42013-10-21 13:30:52 -0700121
Christopher Ferrisa2efd3a2014-05-06 15:23:59 -0700122backtrace_test_static_libraries_host := \
123 libcutils \
124
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800125module := backtrace_test
126module_tag := debug
127build_type := target
128build_target := NATIVE_TEST
Christopher Ferris2c43cff2015-03-26 19:18:36 -0700129backtrace_test_multilib := both
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800130include $(LOCAL_PATH)/Android.build.mk
131build_type := host
132include $(LOCAL_PATH)/Android.build.mk
Christopher Ferris17e91d42013-10-21 13:30:52 -0700133
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800134#----------------------------------------------------------------------------
135# Special truncated libbacktrace library for mac.
136#----------------------------------------------------------------------------
137ifeq ($(HOST_OS),darwin)
Christopher Ferris7fb22872013-09-27 12:43:15 -0700138
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800139include $(CLEAR_VARS)
Christopher Ferrisf67c6412014-01-10 00:43:54 -0800140
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800141LOCAL_MODULE := libbacktrace
142LOCAL_MODULE_TAGS := optional
143
144LOCAL_SRC_FILES := \
145 BacktraceMap.cpp \
146
Dan Albert5570c9b2014-11-13 14:54:10 -0800147LOCAL_MULTILIB := both
148
Christopher Ferris04b1e8c2014-01-30 01:13:33 -0800149include $(BUILD_HOST_SHARED_LIBRARY)
150
151endif # HOST_OS-darwin