OSDN Git Service

Update simpleperf for LLVM rebase to r256229.
[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   liblog \
38   libutils \
39   libLLVM \
40
41 simpleperf_static_libraries_target := \
42   libziparchive \
43
44 simpleperf_shared_libraries_host_linux := \
45   libbacktrace \
46   libbacktrace_offline \
47
48 simpleperf_shared_libraries_host_darwin := libLLVM
49
50 simpleperf_shared_libraries_host_windows := libLLVM
51
52 simpleperf_static_libraries_host := \
53   libziparchive-host \
54   libbase \
55   liblog \
56   libz \
57   libutils \
58
59 simpleperf_ldlibs_host_linux := -lrt
60
61 # libsimpleperf
62 # =========================================================
63 libsimpleperf_src_files := \
64   callchain.cpp \
65   cmd_dumprecord.cpp \
66   cmd_help.cpp \
67   cmd_report.cpp \
68   command.cpp \
69   dso.cpp \
70   event_attr.cpp \
71   event_type.cpp \
72   perf_regs.cpp \
73   read_apk.cpp \
74   read_elf.cpp \
75   record.cpp \
76   record_file_reader.cpp \
77   sample_tree.cpp \
78   thread_tree.cpp \
79   utils.cpp \
80
81 libsimpleperf_src_files_linux := \
82   cmd_list.cpp \
83   cmd_record.cpp \
84   cmd_stat.cpp \
85   dwarf_unwind.cpp \
86   environment.cpp \
87   event_fd.cpp \
88   event_selection_set.cpp \
89   record_file_writer.cpp \
90   workload.cpp \
91
92 libsimpleperf_src_files_darwin := \
93   nonlinux_support/nonlinux_support.cpp \
94
95 libsimpleperf_src_files_windows := \
96   nonlinux_support/nonlinux_support.cpp \
97
98 # libsimpleperf target
99 include $(CLEAR_VARS)
100 LOCAL_CLANG := true
101 LOCAL_MODULE := libsimpleperf
102 LOCAL_MODULE_TAGS := debug
103 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
104 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
105 LOCAL_SRC_FILES := \
106   $(libsimpleperf_src_files) \
107   $(libsimpleperf_src_files_linux) \
108
109 LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_target)
110 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
111 LOCAL_MULTILIB := first
112 include $(LLVM_DEVICE_BUILD_MK)
113 include $(BUILD_STATIC_LIBRARY)
114
115 # libsimpleperf host
116 include $(CLEAR_VARS)
117 #LOCAL_CLANG := true  # Comment it to build on windows.
118 LOCAL_MODULE := libsimpleperf
119 LOCAL_MODULE_HOST_OS := darwin linux windows
120 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
121 LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin)
122 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
123 LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
124 LOCAL_SRC_FILES := $(libsimpleperf_src_files)
125 LOCAL_SRC_FILES_darwin := $(libsimpleperf_src_files_darwin)
126 LOCAL_SRC_FILES_linux := $(libsimpleperf_src_files_linux)
127 LOCAL_SRC_FILES_windows := $(libsimpleperf_src_files_windows)
128 LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_host)
129 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host)
130 LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
131 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
132 LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
133 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
134 LOCAL_MULTILIB := first
135 include $(LLVM_HOST_BUILD_MK)
136 include $(BUILD_HOST_STATIC_LIBRARY)
137
138
139 # simpleperf
140 # =========================================================
141
142 # simpleperf target
143 include $(CLEAR_VARS)
144 LOCAL_CLANG := true
145 LOCAL_MODULE := simpleperf
146 LOCAL_MODULE_TAGS := debug
147 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
148 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
149 LOCAL_SRC_FILES := main.cpp
150 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_target)
151 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
152 LOCAL_MULTILIB := first
153 include $(BUILD_EXECUTABLE)
154
155 # simpleperf host
156 include $(CLEAR_VARS)
157 LOCAL_MODULE := simpleperf
158 LOCAL_MODULE_HOST_OS := darwin linux windows
159 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
160 LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin)
161 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
162 LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
163 LOCAL_SRC_FILES := main.cpp
164 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
165 LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
166 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
167 LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
168 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
169 LOCAL_MULTILIB := first
170 include $(BUILD_HOST_EXECUTABLE)
171
172
173 # simpleperf_unit_test
174 # =========================================================
175 simpleperf_unit_test_src_files := \
176   cmd_report_test.cpp \
177   command_test.cpp \
178   gtest_main.cpp \
179   read_apk_test.cpp \
180   read_elf_test.cpp \
181   record_test.cpp \
182   sample_tree_test.cpp \
183
184 simpleperf_unit_test_src_files_linux := \
185   cmd_dumprecord_test.cpp \
186   cmd_list_test.cpp \
187   cmd_record_test.cpp \
188   cmd_stat_test.cpp \
189   environment_test.cpp \
190   record_file_test.cpp \
191   workload_test.cpp \
192
193 # simpleperf_unit_test target
194 include $(CLEAR_VARS)
195 LOCAL_CLANG := true
196 LOCAL_MODULE := simpleperf_unit_test
197 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
198 LOCAL_SRC_FILES := \
199   $(simpleperf_unit_test_src_files) \
200   $(simpleperf_unit_test_src_files_linux) \
201
202 LOCAL_STATIC_LIBRARIES += libsimpleperf $(simpleperf_static_libraries_target)
203 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
204 LOCAL_MULTILIB := first
205 include $(BUILD_NATIVE_TEST)
206
207 # simpleperf_unit_test host
208 include $(CLEAR_VARS)
209 LOCAL_MODULE := simpleperf_unit_test
210 LOCAL_MODULE_HOST_OS := darwin linux windows
211 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
212 LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin)
213 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
214 LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
215 LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
216 LOCAL_SRC_FILES_linux := $(simpleperf_unit_test_src_files_linux)
217 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
218 LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
219 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
220 LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
221 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
222 LOCAL_MULTILIB := first
223 include $(BUILD_HOST_NATIVE_TEST)
224
225
226 # simpleperf_cpu_hotplug_test
227 # =========================================================
228 simpleperf_cpu_hotplug_test_src_files := \
229   cpu_hotplug_test.cpp \
230
231 # simpleperf_cpu_hotplug_test target
232 include $(CLEAR_VARS)
233 LOCAL_CLANG := true
234 LOCAL_MODULE := simpleperf_cpu_hotplug_test
235 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
236 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
237 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_target)
238 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
239 LOCAL_MULTILIB := first
240 include $(BUILD_NATIVE_TEST)
241
242 # simpleperf_cpu_hotplug_test linux host
243 include $(CLEAR_VARS)
244 LOCAL_CLANG := true
245 LOCAL_MODULE := simpleperf_cpu_hotplug_test
246 LOCAL_MODULE_HOST_OS := linux
247 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
248 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
249 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
250 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
251 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
252 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
253 LOCAL_MULTILIB := first
254 include $(BUILD_HOST_NATIVE_TEST)
255
256
257 # libsimpleperf_cts_test
258 # =========================================================
259 libsimpleperf_cts_test_src_files := \
260   $(libsimpleperf_src_files) \
261   $(libsimpleperf_src_files_linux) \
262   $(simpleperf_unit_test_src_files) \
263   $(simpleperf_unit_test_src_files_linux) \
264
265 # libsimpleperf_cts_test target
266 include $(CLEAR_VARS)
267 LOCAL_CLANG := true
268 LOCAL_MODULE := libsimpleperf_cts_test
269 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target) -DIN_CTS_TEST
270 LOCAL_SRC_FILES := $(libsimpleperf_cts_test_src_files)
271 LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_target)
272 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
273 LOCAL_MULTILIB := both
274 include $(LLVM_DEVICE_BUILD_MK)
275 include $(BUILD_STATIC_TEST_LIBRARY)
276
277 # libsimpleperf_cts_test linux host
278 include $(CLEAR_VARS)
279 LOCAL_CLANG := true
280 LOCAL_MODULE := libsimpleperf_cts_test
281 LOCAL_MODULE_HOST_OS := linux
282 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -DIN_CTS_TEST
283 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
284 LOCAL_SRC_FILES := $(libsimpleperf_cts_test_src_files)
285 LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_host)
286 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
287 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
288 LOCAL_MULTILIB := both
289 include $(LLVM_HOST_BUILD_MK)
290 include $(BUILD_HOST_STATIC_TEST_LIBRARY)
291
292 include $(call first-makefiles-under,$(LOCAL_PATH))