blob: 8f3b68cd1201ed4c33605f89b58d13368251a8b5 [file] [log] [blame]
Jeff Brown501edd22011-10-19 20:35:35 -07001# Copyright (C) 2011 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH:= $(call my-dir)
16
Elliott Hughes71363a82012-05-18 11:56:17 -070017generic_src_files := \
Jeff Brown501edd22011-10-19 20:35:35 -070018 backtrace.c \
19 backtrace-helper.c \
20 demangle.c \
21 map_info.c \
22 ptrace.c \
23 symbol_table.c
24
Elliott Hughes71363a82012-05-18 11:56:17 -070025arm_src_files := \
Jeff Brown501edd22011-10-19 20:35:35 -070026 arch-arm/backtrace-arm.c \
27 arch-arm/ptrace-arm.c
Elliott Hughes71363a82012-05-18 11:56:17 -070028
29x86_src_files := \
30 arch-x86/backtrace-x86.c \
31 arch-x86/ptrace-x86.c
32
Christopher Ferrisc53c4732014-02-01 12:23:03 -080033ifneq ($(TARGET_IS_64_BIT),true)
Elliott Hughesba0cecf2014-01-30 17:51:18 -080034
Elliott Hughes71363a82012-05-18 11:56:17 -070035include $(CLEAR_VARS)
36
37LOCAL_SRC_FILES := $(generic_src_files)
38
39ifeq ($(TARGET_ARCH),arm)
40LOCAL_SRC_FILES += $(arm_src_files)
Jing Yu1a5a4972011-11-08 21:16:25 -080041LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
Jeff Brown501edd22011-10-19 20:35:35 -070042endif
Jeff Brown10484a02011-10-21 12:07:49 -070043ifeq ($(TARGET_ARCH),x86)
Elliott Hughes71363a82012-05-18 11:56:17 -070044LOCAL_SRC_FILES += $(x86_src_files)
Jeff Brown10484a02011-10-21 12:07:49 -070045LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
46endif
Chris Dearman231e3c82012-08-10 17:06:20 -070047ifeq ($(TARGET_ARCH),mips)
48LOCAL_SRC_FILES += \
49 arch-mips/backtrace-mips.c \
50 arch-mips/ptrace-mips.c
51LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
52endif
Jeff Brown501edd22011-10-19 20:35:35 -070053
Ying Wang083b5cc2013-04-09 22:03:45 -070054LOCAL_SHARED_LIBRARIES += libdl libcutils liblog libgccdemangle
Jeff Brown501edd22011-10-19 20:35:35 -070055
Ben Chengc665df32013-09-03 10:52:39 -070056LOCAL_CFLAGS += -std=gnu99 -Werror -Wno-unused-parameter
Jeff Brown501edd22011-10-19 20:35:35 -070057LOCAL_MODULE := libcorkscrew
58LOCAL_MODULE_TAGS := optional
59
60include $(BUILD_SHARED_LIBRARY)
Elliott Hughes71363a82012-05-18 11:56:17 -070061
62# Build test.
63include $(CLEAR_VARS)
Elliott Hughesbfec3a32012-05-24 19:03:07 -070064LOCAL_SRC_FILES := test.cpp
65LOCAL_CFLAGS += -Werror -fno-inline-small-functions
Elliott Hughes71363a82012-05-18 11:56:17 -070066LOCAL_SHARED_LIBRARIES := libcorkscrew
67LOCAL_MODULE := libcorkscrew_test
68LOCAL_MODULE_TAGS := optional
69include $(BUILD_EXECUTABLE)
70
Elliott Hughesfe4d68b2014-01-30 16:39:22 -080071endif # TARGET_IS_64_BIT == false
Elliott Hughes71363a82012-05-18 11:56:17 -070072
Elliott Hughesbf857ae2014-01-30 17:39:22 -080073
Brian Carlstromb0df2f12013-05-15 09:13:04 -070074ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
Elliott Hughes71363a82012-05-18 11:56:17 -070075
76# Build libcorkscrew.
77include $(CLEAR_VARS)
78LOCAL_SRC_FILES += $(generic_src_files) $(x86_src_files)
79LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
Ying Wang083b5cc2013-04-09 22:03:45 -070080LOCAL_STATIC_LIBRARIES += libcutils liblog
Elliott Hughesbfec3a32012-05-24 19:03:07 -070081LOCAL_LDLIBS += -ldl
82ifeq ($(HOST_OS),linux)
83 LOCAL_SHARED_LIBRARIES += libgccdemangle # TODO: is this even needed on Linux?
84 LOCAL_LDLIBS += -lrt
85endif
Ben Chengc665df32013-09-03 10:52:39 -070086LOCAL_CFLAGS += -std=gnu99 -Werror -Wno-unused-parameter
Elliott Hughes71363a82012-05-18 11:56:17 -070087LOCAL_MODULE := libcorkscrew
88LOCAL_MODULE_TAGS := optional
89include $(BUILD_HOST_SHARED_LIBRARY)
90
91# Build test.
92include $(CLEAR_VARS)
Elliott Hughesbfec3a32012-05-24 19:03:07 -070093LOCAL_SRC_FILES := test.cpp
94LOCAL_CFLAGS += -Werror
Elliott Hughes71363a82012-05-18 11:56:17 -070095LOCAL_SHARED_LIBRARIES := libcorkscrew
96LOCAL_MODULE := libcorkscrew_test
97LOCAL_MODULE_TAGS := optional
98include $(BUILD_HOST_EXECUTABLE)
99
Elliott Hughesbf857ae2014-01-30 17:39:22 -0800100endif # $(HOST_OS)-$(HOST_ARCH) == linux-x86