OSDN Git Service

Merge "Add use of libbacktrace_offline."
[android-x86/system-extras.git] / simpleperf / Android.mk
1 #
2 # Copyright (C) 2015 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 LOCAL_PATH := $(call my-dir)
18
19 simpleperf_common_cppflags := -Wextra -Wunused -Wno-unknown-pragmas
20
21 simpleperf_cppflags_target := $(simpleperf_common_cppflags)
22
23 simpleperf_cppflags_host := $(simpleperf_common_cppflags) \
24                             -DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \
25
26 simpleperf_cppflags_host_darwin := -I $(LOCAL_PATH)/nonlinux_support/include
27 simpleperf_cppflags_host_windows := -I $(LOCAL_PATH)/nonlinux_support/include
28
29
30 LLVM_ROOT_PATH := external/llvm
31 include $(LLVM_ROOT_PATH)/llvm.mk
32
33 simpleperf_shared_libraries_target := \
34   libbacktrace \
35   libbacktrace_offline \
36   libbase \
37   libLLVM \
38
39 simpleperf_shared_libraries_host := libbase
40
41 simpleperf_shared_libraries_host_linux := libbacktrace libbacktrace_offline
42
43 simpleperf_shared_libraries_host_darwin := libLLVM
44
45 simpleperf_shared_libraries_host_windows := libLLVM
46
47 simpleperf_ldlibs_host_linux := -lrt
48
49
50 # libsimpleperf
51 # =========================================================
52 libsimpleperf_src_files := \
53   callchain.cpp \
54   cmd_dumprecord.cpp \
55   cmd_help.cpp \
56   cmd_report.cpp \
57   command.cpp \
58   dso.cpp \
59   event_attr.cpp \
60   event_type.cpp \
61   perf_regs.cpp \
62   read_elf.cpp \
63   record.cpp \
64   record_file_reader.cpp \
65   sample_tree.cpp \
66   thread_tree.cpp \
67   utils.cpp \
68
69 libsimpleperf_src_files_linux := \
70   cmd_list.cpp \
71   cmd_record.cpp \
72   cmd_stat.cpp \
73   dwarf_unwind.cpp \
74   environment.cpp \
75   event_fd.cpp \
76   event_selection_set.cpp \
77   record_file_writer.cpp \
78   workload.cpp \
79
80 libsimpleperf_src_files_darwin := \
81   nonlinux_support/nonlinux_support.cpp \
82
83 libsimpleperf_src_files_windows := \
84   nonlinux_support/nonlinux_support.cpp \
85
86 # libsimpleperf target
87 include $(CLEAR_VARS)
88 LOCAL_CLANG := true
89 LOCAL_MODULE := libsimpleperf
90 LOCAL_MODULE_TAGS := debug
91 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
92 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
93 LOCAL_SRC_FILES := \
94   $(libsimpleperf_src_files) \
95   $(libsimpleperf_src_files_linux) \
96
97 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
98 LOCAL_MULTILIB := first
99 include $(LLVM_DEVICE_BUILD_MK)
100 include $(BUILD_STATIC_LIBRARY)
101
102 # libsimpleperf host
103 include $(CLEAR_VARS)
104 #LOCAL_CLANG := true  # Comment it to build on windows.
105 LOCAL_MODULE := libsimpleperf
106 LOCAL_MODULE_HOST_OS := darwin linux windows
107 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
108 LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin)
109 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
110 LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
111 LOCAL_SRC_FILES := $(libsimpleperf_src_files)
112 LOCAL_SRC_FILES_darwin := $(libsimpleperf_src_files_darwin)
113 LOCAL_SRC_FILES_linux := $(libsimpleperf_src_files_linux)
114 LOCAL_SRC_FILES_windows := $(libsimpleperf_src_files_windows)
115 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host)
116 LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
117 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
118 LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
119 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
120 LOCAL_MULTILIB := first
121 include $(LLVM_HOST_BUILD_MK)
122 include $(BUILD_HOST_STATIC_LIBRARY)
123
124
125 # simpleperf
126 # =========================================================
127
128 # simpleperf target
129 include $(CLEAR_VARS)
130 LOCAL_CLANG := true
131 LOCAL_MODULE := simpleperf
132 LOCAL_MODULE_TAGS := debug
133 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
134 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
135 LOCAL_SRC_FILES := main.cpp
136 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
137 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
138 LOCAL_MULTILIB := first
139 include $(BUILD_EXECUTABLE)
140
141 # simpleperf host
142 include $(CLEAR_VARS)
143 LOCAL_MODULE := simpleperf
144 LOCAL_MODULE_HOST_OS := darwin linux windows
145 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
146 LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin)
147 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
148 LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
149 LOCAL_SRC_FILES := main.cpp
150 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
151 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host)
152 LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
153 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
154 LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
155 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
156 LOCAL_MULTILIB := first
157 include $(BUILD_HOST_EXECUTABLE)
158
159
160 # simpleperf_unit_test
161 # =========================================================
162 simpleperf_unit_test_src_files := \
163   command_test.cpp \
164   gtest_main.cpp \
165   record_test.cpp \
166   sample_tree_test.cpp \
167
168 simpleperf_unit_test_src_files_linux := \
169   cmd_dumprecord_test.cpp \
170   cmd_list_test.cpp \
171   cmd_record_test.cpp \
172   cmd_report_test.cpp \
173   cmd_stat_test.cpp \
174   environment_test.cpp \
175   read_elf_test.cpp \
176   record_file_test.cpp \
177   workload_test.cpp \
178
179 # simpleperf_unit_test target
180 include $(CLEAR_VARS)
181 LOCAL_CLANG := true
182 LOCAL_MODULE := simpleperf_unit_test
183 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
184 LOCAL_SRC_FILES := \
185   $(simpleperf_unit_test_src_files) \
186   $(simpleperf_unit_test_src_files_linux) \
187
188 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
189 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
190 LOCAL_MULTILIB := first
191 include $(BUILD_NATIVE_TEST)
192
193 # simpleperf_unit_test host
194 include $(CLEAR_VARS)
195 LOCAL_MODULE := simpleperf_unit_test
196 LOCAL_MODULE_HOST_OS := darwin linux windows
197 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
198 LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin)
199 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
200 LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
201 LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
202 LOCAL_SRC_FILES_linux := $(simpleperf_unit_test_src_files_linux)
203 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
204 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host)
205 LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
206 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
207 LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
208 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
209 LOCAL_MULTILIB := first
210 include $(BUILD_HOST_NATIVE_TEST)
211
212
213 # simpleperf_cpu_hotplug_test
214 # =========================================================
215 simpleperf_cpu_hotplug_test_src_files := \
216   gtest_main.cpp \
217   cpu_hotplug_test.cpp \
218
219 # simpleperf_cpu_hotplug_test target
220 include $(CLEAR_VARS)
221 LOCAL_CLANG := true
222 LOCAL_MODULE := simpleperf_cpu_hotplug_test
223 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
224 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
225 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
226 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
227 LOCAL_MULTILIB := first
228 include $(BUILD_NATIVE_TEST)
229
230 # simpleperf_cpu_hotplug_test linux host
231 include $(CLEAR_VARS)
232 LOCAL_CLANG := true
233 LOCAL_MODULE := simpleperf_cpu_hotplug_test
234 LOCAL_MODULE_HOST_OS := linux
235 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
236 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
237 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
238 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
239 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host)
240 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
241 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
242 LOCAL_MULTILIB := first
243 include $(BUILD_HOST_NATIVE_TEST)
244
245 include $(call first-makefiles-under,$(LOCAL_PATH))