Jeff Brown | 501edd2 | 2011-10-19 20:35:35 -0700 | [diff] [blame] | 1 | # 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 | |
| 15 | LOCAL_PATH:= $(call my-dir) |
| 16 | |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 17 | generic_src_files := \ |
Jeff Brown | 501edd2 | 2011-10-19 20:35:35 -0700 | [diff] [blame] | 18 | backtrace.c \ |
| 19 | backtrace-helper.c \ |
| 20 | demangle.c \ |
| 21 | map_info.c \ |
| 22 | ptrace.c \ |
| 23 | symbol_table.c |
| 24 | |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 25 | arm_src_files := \ |
Jeff Brown | 501edd2 | 2011-10-19 20:35:35 -0700 | [diff] [blame] | 26 | arch-arm/backtrace-arm.c \ |
| 27 | arch-arm/ptrace-arm.c |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 28 | |
| 29 | x86_src_files := \ |
| 30 | arch-x86/backtrace-x86.c \ |
| 31 | arch-x86/ptrace-x86.c |
| 32 | |
| 33 | include $(CLEAR_VARS) |
| 34 | |
| 35 | LOCAL_SRC_FILES := $(generic_src_files) |
| 36 | |
| 37 | ifeq ($(TARGET_ARCH),arm) |
| 38 | LOCAL_SRC_FILES += $(arm_src_files) |
Jing Yu | 1a5a497 | 2011-11-08 21:16:25 -0800 | [diff] [blame] | 39 | LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH |
Jeff Brown | 501edd2 | 2011-10-19 20:35:35 -0700 | [diff] [blame] | 40 | endif |
Jeff Brown | 10484a0 | 2011-10-21 12:07:49 -0700 | [diff] [blame] | 41 | ifeq ($(TARGET_ARCH),x86) |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 42 | LOCAL_SRC_FILES += $(x86_src_files) |
Jeff Brown | 10484a0 | 2011-10-21 12:07:49 -0700 | [diff] [blame] | 43 | LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH |
| 44 | endif |
Chris Dearman | 231e3c8 | 2012-08-10 17:06:20 -0700 | [diff] [blame] | 45 | ifeq ($(TARGET_ARCH),mips) |
| 46 | LOCAL_SRC_FILES += \ |
| 47 | arch-mips/backtrace-mips.c \ |
| 48 | arch-mips/ptrace-mips.c |
| 49 | LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH |
| 50 | endif |
Jeff Brown | 501edd2 | 2011-10-19 20:35:35 -0700 | [diff] [blame] | 51 | |
Ying Wang | 083b5cc | 2013-04-09 22:03:45 -0700 | [diff] [blame^] | 52 | LOCAL_SHARED_LIBRARIES += libdl libcutils liblog libgccdemangle |
Jeff Brown | 501edd2 | 2011-10-19 20:35:35 -0700 | [diff] [blame] | 53 | |
| 54 | LOCAL_CFLAGS += -std=gnu99 -Werror |
| 55 | LOCAL_MODULE := libcorkscrew |
| 56 | LOCAL_MODULE_TAGS := optional |
| 57 | |
| 58 | include $(BUILD_SHARED_LIBRARY) |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 59 | |
| 60 | # Build test. |
| 61 | include $(CLEAR_VARS) |
| 62 | LOCAL_SRC_FILES := test.c |
| 63 | LOCAL_CFLAGS += -std=gnu99 -Werror -fno-inline-small-functions |
| 64 | LOCAL_SHARED_LIBRARIES := libcorkscrew |
| 65 | LOCAL_MODULE := libcorkscrew_test |
| 66 | LOCAL_MODULE_TAGS := optional |
| 67 | include $(BUILD_EXECUTABLE) |
| 68 | |
| 69 | |
| 70 | ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) |
| 71 | |
| 72 | # Build libcorkscrew. |
| 73 | include $(CLEAR_VARS) |
| 74 | LOCAL_SRC_FILES += $(generic_src_files) $(x86_src_files) |
| 75 | LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH |
| 76 | LOCAL_SHARED_LIBRARIES += libgccdemangle |
Ying Wang | 083b5cc | 2013-04-09 22:03:45 -0700 | [diff] [blame^] | 77 | LOCAL_STATIC_LIBRARIES += libcutils liblog |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 78 | LOCAL_LDLIBS += -ldl -lrt |
| 79 | LOCAL_CFLAGS += -std=gnu99 -Werror |
| 80 | LOCAL_MODULE := libcorkscrew |
| 81 | LOCAL_MODULE_TAGS := optional |
| 82 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 83 | |
| 84 | # Build test. |
| 85 | include $(CLEAR_VARS) |
| 86 | LOCAL_SRC_FILES := test.c |
| 87 | LOCAL_CFLAGS += -std=gnu99 -Werror -fno-inline-small-functions |
| 88 | LOCAL_SHARED_LIBRARIES := libcorkscrew |
| 89 | LOCAL_MODULE := libcorkscrew_test |
| 90 | LOCAL_MODULE_TAGS := optional |
| 91 | include $(BUILD_HOST_EXECUTABLE) |
| 92 | |
| 93 | endif # linux-x86 |