blob: 9019986f1f02fb30ac04d73a5c0a4577e610038b [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
Jeff Brown501edd22011-10-19 20:35:35 -070045
Jing Yu1a5a4972011-11-08 21:16:25 -080046LOCAL_SHARED_LIBRARIES += libdl libcutils libgccdemangle
Jeff Brown501edd22011-10-19 20:35:35 -070047
48LOCAL_CFLAGS += -std=gnu99 -Werror
49LOCAL_MODULE := libcorkscrew
50LOCAL_MODULE_TAGS := optional
51
52include $(BUILD_SHARED_LIBRARY)
Elliott Hughes71363a82012-05-18 11:56:17 -070053
54# Build test.
55include $(CLEAR_VARS)
56LOCAL_SRC_FILES := test.c
57LOCAL_CFLAGS += -std=gnu99 -Werror -fno-inline-small-functions
58LOCAL_SHARED_LIBRARIES := libcorkscrew
59LOCAL_MODULE := libcorkscrew_test
60LOCAL_MODULE_TAGS := optional
61include $(BUILD_EXECUTABLE)
62
63
64ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
65
66# Build libcorkscrew.
67include $(CLEAR_VARS)
68LOCAL_SRC_FILES += $(generic_src_files) $(x86_src_files)
69LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
70LOCAL_SHARED_LIBRARIES += libgccdemangle
71LOCAL_STATIC_LIBRARIES += libcutils
72LOCAL_LDLIBS += -ldl -lrt
73LOCAL_CFLAGS += -std=gnu99 -Werror
74LOCAL_MODULE := libcorkscrew
75LOCAL_MODULE_TAGS := optional
76include $(BUILD_HOST_SHARED_LIBRARY)
77
78# Build test.
79include $(CLEAR_VARS)
80LOCAL_SRC_FILES := test.c
81LOCAL_CFLAGS += -std=gnu99 -Werror -fno-inline-small-functions
82LOCAL_SHARED_LIBRARIES := libcorkscrew
83LOCAL_MODULE := libcorkscrew_test
84LOCAL_MODULE_TAGS := optional
85include $(BUILD_HOST_EXECUTABLE)
86
87endif # linux-x86