1#
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# If you actually want to use ltrace, let android-bionic@ know.
18# One of its dependencies (libelf) won't build with clang,
19# and we want to know whether anyone actually cares...
20ifeq (true,false)
21
22LOCAL_PATH := $(call my-dir)
23
24# -------------------------------------------------------------------------
25
26include $(CLEAR_VARS)
27
28LOCAL_SRC_FILES := \
29    bits.c \
30    breakpoints.c \
31    debug.c \
32    demangle.c \
33    dict.c \
34    execute_program.c \
35    expr.c \
36    fetch.c \
37    filter.c \
38    glob.c \
39    handle_event.c \
40    lens.c \
41    lens_default.c \
42    lens_enum.c \
43    libltrace.c \
44    library.c \
45    ltrace-elf.c \
46    main.c \
47    memstream.c \
48    options.c \
49    output.c \
50    param.c \
51    printf.c \
52    proc.c \
53    prototype.c \
54    read_config_file.c \
55    summary.c \
56    type.c \
57    value.c \
58    value_dict.c \
59    vect.c \
60    zero.c \
61    sysdeps/linux-gnu/breakpoint.c \
62    sysdeps/linux-gnu/events.c \
63    sysdeps/linux-gnu/hooks.c \
64    sysdeps/linux-gnu/proc.c \
65    sysdeps/linux-gnu/trace.c \
66
67LOCAL_C_INCLUDES := \
68    $(LOCAL_PATH)/ \
69    $(LOCAL_PATH)/sysdeps/ \
70    $(LOCAL_PATH)/sysdeps/linux-gnu \
71
72arm_path := sysdeps/linux-gnu/arm
73LOCAL_C_INCLUDES_arm := $(LOCAL_PATH)/$(arm_path)
74LOCAL_SRC_FILES_arm := \
75    $(arm_path)/breakpoint.c \
76    $(arm_path)/fetch.c \
77    $(arm_path)/plt.c \
78    $(arm_path)/regs.c \
79    $(arm_path)/trace.c \
80
81arm64_path := sysdeps/linux-gnu/aarch64
82LOCAL_C_INCLUDES_arm64 := $(LOCAL_PATH)/$(arm64_path)
83LOCAL_SRC_FILES_arm64 := \
84    $(arm64_path)/fetch.c \
85    $(arm64_path)/plt.c \
86    $(arm64_path)/regs.c \
87    $(arm64_path)/trace.c \
88
89mips_path := sysdeps/linux-gnu/mips
90LOCAL_C_INCLUDES_mips := $(LOCAL_PATH)/$(mips_path)
91LOCAL_SRC_FILES_mips := \
92    $(mips_path)/plt.c \
93    $(mips_path)/regs.c \
94    $(mips_path)/trace.c \
95
96x86_path := sysdeps/linux-gnu/x86
97LOCAL_C_INCLUDES_x86 := $(LOCAL_PATH)/$(x86_path)
98LOCAL_SRC_FILES_x86 := \
99    $(x86_path)/fetch.c \
100    $(x86_path)/plt.c \
101    $(x86_path)/regs.c \
102    $(x86_path)/trace.c \
103
104# x86_64 uses the same source as x86.
105LOCAL_C_INCLUDES_x86_64 := $(LOCAL_C_INCLUDES_x86)
106LOCAL_SRC_FILES_x86_64 := $(LOCAL_SRC_FILES_x86)
107
108LOCAL_CFLAGS += \
109    -DELF_HASH_TAKES_CHARP=1 \
110    -DHAVE_ALARM=1 \
111    -DHAVE_ATEXIT=1 \
112    -DHAVE_DLFCN_H=1 \
113    -DHAVE_ELF_C_READ_MMAP=1 \
114    -DHAVE_ELF_H=1 \
115    -DHAVE_FCNTL_H=1 \
116    -DHAVE_FORK=1 \
117    -DHAVE_GELF_H=1 \
118    -DHAVE_GETOPT_LONG=1 \
119    -DHAVE_GETTIMEOFDAY=1 \
120    -DHAVE_INTTYPES_H=1 \
121    -DHAVE_LIBELF=1 \
122    -DHAVE_LIBSELINUX=1 \
123    -DHAVE_LIBSTDC__=1 \
124    -DHAVE_LIBUNWIND=1 \
125    -DHAVE_LIBUNWIND_PTRACE=1 \
126    -DHAVE_LIMITS_H=1 \
127    -DHAVE_MEMORY_H=1 \
128    -DHAVE_MEMSET=1 \
129    -DHAVE_OPEN_MEMSTREAM=1 \
130    -DHAVE_SELINUX_SELINUX_H=1 \
131    -DHAVE_STDDEF_H=1 \
132    -DHAVE_STDINT_H=1 \
133    -DHAVE_STDLIB_H=1 \
134    -DHAVE_STRCHR=1 \
135    -DHAVE_STRDUP=1 \
136    -DHAVE_STRERROR=1 \
137    -DHAVE_STRINGS_H=1 \
138    -DHAVE_STRING_H=1 \
139    -DHAVE_STRSIGNAL=1 \
140    -DHAVE_STRTOL=1 \
141    -DHAVE_STRTOUL=1 \
142    -DHAVE_SYS_IOCTL_H=1 \
143    -DHAVE_SYS_PARAM_H=1 \
144    -DHAVE_SYS_STAT_H=1 \
145    -DHAVE_SYS_TIME_H=1 \
146    -DHAVE_SYS_TYPES_H=1 \
147    -DHAVE_UNISTD_H=1 \
148    -DHAVE_UNWINDER=1 \
149    -DHAVE_VFORK=1 \
150    -DHAVE_WORKING_FORK=1 \
151    -DHAVE_WORKING_VFORK=1 \
152    -DLT_OBJDIR='".libs"' \
153    -DPACKAGE='"ltrace"' \
154    -DPACKAGE_BUGREPORT='"ltrace-devel@lists.alioth.debian.org"' \
155    -DPACKAGE_NAME='"ltrace"' \
156    -DPACKAGE_STRING='"ltrace 0.7.91"' \
157    -DPACKAGE_TARNAME='"ltrace"' \
158    -DPACKAGE_URL='"http://ltrace.alioth.debian.org/"' \
159    -DPACKAGE_VERSION='"0.7.91"' \
160    -DVERSION='"0.7.91"' \
161    -D_FILE_OFFSET_BITS=64 \
162    -D_LARGE_FILES=1 \
163    -DPKGDATADIR=NULL \
164    -DSYSCONFDIR='"/etc/"' \
165    -Drindex=strrchr \
166
167LOCAL_CFLAGS_32 += -DSIZEOF_LONG=4
168LOCAL_CFLAGS_64 += -DSIZEOF_LONG=8
169
170LOCAL_CFLAGS += \
171    -Wall \
172    -Wno-missing-field-initializers \
173    -Wno-unused-parameter \
174    -Wno-sign-compare \
175
176LOCAL_STATIC_LIBRARIES := libelf
177
178LOCAL_SHARED_LIBRARIES := \
179    libcutils \
180    libselinux \
181    libunwind \
182
183LOCAL_MODULE := ltrace
184
185LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
186
187LOCAL_MODULE_TAGS := debug
188
189LOCAL_MODULE_TARGET_ARCH := arm arm64 x86 x86_64
190
191LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
192
193include $(BUILD_EXECUTABLE)
194
195endif
196