blob: f96fc4e7fb024cd9efbf0c5fd3f64f76a58621da [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
Elliott Hughesd5aff0a2014-01-30 14:43:42 -080015ifeq ($(TARGET_IS_64_BIT), false)
16
Jeff Brown501edd22011-10-19 20:35:35 -070017LOCAL_PATH:= $(call my-dir)
18
Elliott Hughes71363a82012-05-18 11:56:17 -070019generic_src_files := \
Jeff Brown501edd22011-10-19 20:35:35 -070020 backtrace.c \
21 backtrace-helper.c \
22 demangle.c \
23 map_info.c \
24 ptrace.c \
25 symbol_table.c
26
Elliott Hughes71363a82012-05-18 11:56:17 -070027arm_src_files := \
Jeff Brown501edd22011-10-19 20:35:35 -070028 arch-arm/backtrace-arm.c \
29 arch-arm/ptrace-arm.c
Elliott Hughes71363a82012-05-18 11:56:17 -070030
31x86_src_files := \
32 arch-x86/backtrace-x86.c \
33 arch-x86/ptrace-x86.c
34
35include $(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
71
Brian Carlstromb0df2f12013-05-15 09:13:04 -070072# TODO: reenable darwin-x86
73# ifeq ($(HOST_ARCH),x86)
74ifeq ($(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 Hughesbfec3a32012-05-24 19:03:07 -0700100endif # HOST_ARCH == x86
Elliott Hughesd5aff0a2014-01-30 14:43:42 -0800101
102endif # TARGET_IS_64_BIT == false