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 | |
Christopher Ferris | c53c473 | 2014-02-01 12:23:03 -0800 | [diff] [blame] | 33 | ifneq ($(TARGET_IS_64_BIT),true) |
Elliott Hughes | ba0cecf | 2014-01-30 17:51:18 -0800 | [diff] [blame] | 34 | |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 35 | include $(CLEAR_VARS) |
| 36 | |
| 37 | LOCAL_SRC_FILES := $(generic_src_files) |
| 38 | |
| 39 | ifeq ($(TARGET_ARCH),arm) |
| 40 | LOCAL_SRC_FILES += $(arm_src_files) |
Jing Yu | 1a5a497 | 2011-11-08 21:16:25 -0800 | [diff] [blame] | 41 | LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH |
Jeff Brown | 501edd2 | 2011-10-19 20:35:35 -0700 | [diff] [blame] | 42 | endif |
Jeff Brown | 10484a0 | 2011-10-21 12:07:49 -0700 | [diff] [blame] | 43 | ifeq ($(TARGET_ARCH),x86) |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 44 | LOCAL_SRC_FILES += $(x86_src_files) |
Jeff Brown | 10484a0 | 2011-10-21 12:07:49 -0700 | [diff] [blame] | 45 | LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH |
| 46 | endif |
Chris Dearman | 231e3c8 | 2012-08-10 17:06:20 -0700 | [diff] [blame] | 47 | ifeq ($(TARGET_ARCH),mips) |
| 48 | LOCAL_SRC_FILES += \ |
| 49 | arch-mips/backtrace-mips.c \ |
| 50 | arch-mips/ptrace-mips.c |
| 51 | LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH |
| 52 | endif |
Jeff Brown | 501edd2 | 2011-10-19 20:35:35 -0700 | [diff] [blame] | 53 | |
Ying Wang | 083b5cc | 2013-04-09 22:03:45 -0700 | [diff] [blame] | 54 | LOCAL_SHARED_LIBRARIES += libdl libcutils liblog libgccdemangle |
Jeff Brown | 501edd2 | 2011-10-19 20:35:35 -0700 | [diff] [blame] | 55 | |
Ben Cheng | c665df3 | 2013-09-03 10:52:39 -0700 | [diff] [blame] | 56 | LOCAL_CFLAGS += -std=gnu99 -Werror -Wno-unused-parameter |
Jeff Brown | 501edd2 | 2011-10-19 20:35:35 -0700 | [diff] [blame] | 57 | LOCAL_MODULE := libcorkscrew |
| 58 | LOCAL_MODULE_TAGS := optional |
| 59 | |
| 60 | include $(BUILD_SHARED_LIBRARY) |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 61 | |
| 62 | # Build test. |
| 63 | include $(CLEAR_VARS) |
Elliott Hughes | bfec3a3 | 2012-05-24 19:03:07 -0700 | [diff] [blame] | 64 | LOCAL_SRC_FILES := test.cpp |
| 65 | LOCAL_CFLAGS += -Werror -fno-inline-small-functions |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 66 | LOCAL_SHARED_LIBRARIES := libcorkscrew |
| 67 | LOCAL_MODULE := libcorkscrew_test |
| 68 | LOCAL_MODULE_TAGS := optional |
| 69 | include $(BUILD_EXECUTABLE) |
| 70 | |
Elliott Hughes | fe4d68b | 2014-01-30 16:39:22 -0800 | [diff] [blame] | 71 | endif # TARGET_IS_64_BIT == false |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 72 | |
Elliott Hughes | bf857ae | 2014-01-30 17:39:22 -0800 | [diff] [blame] | 73 | |
Brian Carlstrom | b0df2f1 | 2013-05-15 09:13:04 -0700 | [diff] [blame] | 74 | ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 75 | |
| 76 | # Build libcorkscrew. |
| 77 | include $(CLEAR_VARS) |
| 78 | LOCAL_SRC_FILES += $(generic_src_files) $(x86_src_files) |
| 79 | LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH |
Ying Wang | 083b5cc | 2013-04-09 22:03:45 -0700 | [diff] [blame] | 80 | LOCAL_STATIC_LIBRARIES += libcutils liblog |
Elliott Hughes | bfec3a3 | 2012-05-24 19:03:07 -0700 | [diff] [blame] | 81 | LOCAL_LDLIBS += -ldl |
| 82 | ifeq ($(HOST_OS),linux) |
| 83 | LOCAL_SHARED_LIBRARIES += libgccdemangle # TODO: is this even needed on Linux? |
| 84 | LOCAL_LDLIBS += -lrt |
| 85 | endif |
Ben Cheng | c665df3 | 2013-09-03 10:52:39 -0700 | [diff] [blame] | 86 | LOCAL_CFLAGS += -std=gnu99 -Werror -Wno-unused-parameter |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 87 | LOCAL_MODULE := libcorkscrew |
| 88 | LOCAL_MODULE_TAGS := optional |
| 89 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 90 | |
| 91 | # Build test. |
| 92 | include $(CLEAR_VARS) |
Elliott Hughes | bfec3a3 | 2012-05-24 19:03:07 -0700 | [diff] [blame] | 93 | LOCAL_SRC_FILES := test.cpp |
| 94 | LOCAL_CFLAGS += -Werror |
Elliott Hughes | 71363a8 | 2012-05-18 11:56:17 -0700 | [diff] [blame] | 95 | LOCAL_SHARED_LIBRARIES := libcorkscrew |
| 96 | LOCAL_MODULE := libcorkscrew_test |
| 97 | LOCAL_MODULE_TAGS := optional |
| 98 | include $(BUILD_HOST_EXECUTABLE) |
| 99 | |
Elliott Hughes | bf857ae | 2014-01-30 17:39:22 -0800 | [diff] [blame] | 100 | endif # $(HOST_OS)-$(HOST_ARCH) == linux-x86 |