blob: e27531766c58ebc710e6ac94315a6fd7c61f2baf [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
33include $(CLEAR_VARS)
34
35LOCAL_SRC_FILES := $(generic_src_files)
36
37ifeq ($(TARGET_ARCH),arm)
38LOCAL_SRC_FILES += $(arm_src_files)
Jing Yu1a5a4972011-11-08 21:16:25 -080039LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
Jeff Brown501edd22011-10-19 20:35:35 -070040endif
Jeff Brown10484a02011-10-21 12:07:49 -070041ifeq ($(TARGET_ARCH),x86)
Elliott Hughes71363a82012-05-18 11:56:17 -070042LOCAL_SRC_FILES += $(x86_src_files)
Jeff Brown10484a02011-10-21 12:07:49 -070043LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
44endif
Chris Dearman231e3c82012-08-10 17:06:20 -070045ifeq ($(TARGET_ARCH),mips)
46LOCAL_SRC_FILES += \
47 arch-mips/backtrace-mips.c \
48 arch-mips/ptrace-mips.c
49LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
50endif
Jeff Brown501edd22011-10-19 20:35:35 -070051
Ying Wang083b5cc2013-04-09 22:03:45 -070052LOCAL_SHARED_LIBRARIES += libdl libcutils liblog libgccdemangle
Jeff Brown501edd22011-10-19 20:35:35 -070053
Ben Chengc665df32013-09-03 10:52:39 -070054LOCAL_CFLAGS += -std=gnu99 -Werror -Wno-unused-parameter
Jeff Brown501edd22011-10-19 20:35:35 -070055LOCAL_MODULE := libcorkscrew
56LOCAL_MODULE_TAGS := optional
57
58include $(BUILD_SHARED_LIBRARY)
Elliott Hughes71363a82012-05-18 11:56:17 -070059
60# Build test.
61include $(CLEAR_VARS)
Elliott Hughesbfec3a32012-05-24 19:03:07 -070062LOCAL_SRC_FILES := test.cpp
63LOCAL_CFLAGS += -Werror -fno-inline-small-functions
Elliott Hughes71363a82012-05-18 11:56:17 -070064LOCAL_SHARED_LIBRARIES := libcorkscrew
65LOCAL_MODULE := libcorkscrew_test
66LOCAL_MODULE_TAGS := optional
67include $(BUILD_EXECUTABLE)
68
69
Brian Carlstromb0df2f12013-05-15 09:13:04 -070070# TODO: reenable darwin-x86
71# ifeq ($(HOST_ARCH),x86)
72ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
Elliott Hughes71363a82012-05-18 11:56:17 -070073
74# Build libcorkscrew.
75include $(CLEAR_VARS)
76LOCAL_SRC_FILES += $(generic_src_files) $(x86_src_files)
77LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
Ying Wang083b5cc2013-04-09 22:03:45 -070078LOCAL_STATIC_LIBRARIES += libcutils liblog
Elliott Hughesbfec3a32012-05-24 19:03:07 -070079LOCAL_LDLIBS += -ldl
80ifeq ($(HOST_OS),linux)
81 LOCAL_SHARED_LIBRARIES += libgccdemangle # TODO: is this even needed on Linux?
82 LOCAL_LDLIBS += -lrt
83endif
Ben Chengc665df32013-09-03 10:52:39 -070084LOCAL_CFLAGS += -std=gnu99 -Werror -Wno-unused-parameter
Elliott Hughes71363a82012-05-18 11:56:17 -070085LOCAL_MODULE := libcorkscrew
86LOCAL_MODULE_TAGS := optional
87include $(BUILD_HOST_SHARED_LIBRARY)
88
89# Build test.
90include $(CLEAR_VARS)
Elliott Hughesbfec3a32012-05-24 19:03:07 -070091LOCAL_SRC_FILES := test.cpp
92LOCAL_CFLAGS += -Werror
Elliott Hughes71363a82012-05-18 11:56:17 -070093LOCAL_SHARED_LIBRARIES := libcorkscrew
94LOCAL_MODULE := libcorkscrew_test
95LOCAL_MODULE_TAGS := optional
96include $(BUILD_HOST_EXECUTABLE)
97
Elliott Hughesbfec3a32012-05-24 19:03:07 -070098endif # HOST_ARCH == x86