1# Copyright (C) 2013 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
17supported_platforms := linux darwin
18cur_platform := $(filter $(HOST_OS),$(supported_platforms))
19
20ifdef cur_platform
21
22#
23# host libdwfl
24#
25
26include $(CLEAR_VARS)
27
28LIBDWFL_SRC_FILES := \
29	dwfl_begin.c \
30	dwfl_build_id_find_elf.c \
31	dwfl_build_id_find_debuginfo.c \
32	dwfl_end.c \
33	dwfl_error.c \
34	dwfl_module.c \
35	dwfl_module_addrdie.c \
36	dwfl_module_addrsym.c \
37	dwfl_module_build_id.c \
38	dwfl_module_getdwarf.c \
39	dwfl_module_getsym.c \
40	dwfl_report_elf.c \
41	find-debuginfo.c \
42	image-header.c \
43	libdwfl_crc32.c \
44	libdwfl_crc32_file.c \
45	offline.c \
46	open.c \
47	relocate.c
48
49LOCAL_SRC_FILES := $(LIBDWFL_SRC_FILES)
50
51LOCAL_C_INCLUDES := \
52	$(LOCAL_PATH)/.. \
53	$(LOCAL_PATH)/../lib \
54	$(LOCAL_PATH)/../libdwfl \
55	$(LOCAL_PATH)/../libebl \
56	$(LOCAL_PATH)/../libdw \
57	$(LOCAL_PATH)/../libelf
58
59LOCAL_C_INCLUDES += $(LOCAL_PATH)/../host-$(HOST_OS)-fixup
60
61LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -D_GNU_SOURCE
62
63# to suppress the "pointer of type ‘void *’ used in arithmetic" warning
64LOCAL_CFLAGS += -Wno-pointer-arith
65
66ifeq ($(HOST_OS),darwin)
67	LOCAL_CFLAGS += -fnested-functions
68endif
69
70# libdwfl is one of the few libs that will never compile with clang
71LOCAL_CLANG := false
72
73# to fix machine-dependent issues
74LOCAL_CFLAGS += -include $(LOCAL_PATH)/../host-$(HOST_OS)-fixup/AndroidFixup.h
75
76LOCAL_MODULE:= libdwfl
77
78include $(BUILD_HOST_STATIC_LIBRARY)
79
80#
81# target libdwfl
82#
83
84include $(CLEAR_VARS)
85
86LOCAL_SRC_FILES := $(LIBDWFL_SRC_FILES)
87
88LOCAL_C_INCLUDES := \
89	$(LOCAL_PATH)/.. \
90	$(LOCAL_PATH)/../lib \
91	$(LOCAL_PATH)/../libdwfl \
92	$(LOCAL_PATH)/../libebl \
93	$(LOCAL_PATH)/../libdw \
94	$(LOCAL_PATH)/../libelf
95
96
97LOCAL_C_INCLUDES += $(LOCAL_PATH)/../bionic-fixup
98
99LOCAL_CFLAGS += -include $(LOCAL_PATH)/../bionic-fixup/AndroidFixup.h
100
101LOCAL_CFLAGS += -DHAVE_CONFIG_H -std=gnu99 -Werror
102
103# to suppress the "pointer of type ‘void *’ used in arithmetic" warning
104LOCAL_CFLAGS += -Wno-pointer-arith
105
106LOCAL_MODULE:= libdwfl
107
108include $(BUILD_STATIC_LIBRARY)
109
110endif #cur_platform
111