OSDN Git Service

Timetest: Clean up
[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 LOCAL_PATH := $(call my-dir)
17
18 simpleperf_version :=  $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)
19
20 simpleperf_common_cflags := -Wall -Werror -Wextra -Wunused -Wno-unknown-pragmas \
21                               -DSIMPLEPERF_REVISION='"$(simpleperf_version)"'
22
23 simpleperf_cflags_target := $(simpleperf_common_cflags)
24
25 simpleperf_cflags_host := $(simpleperf_common_cflags) \
26                             -DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \
27                             -fvisibility=hidden \
28
29 simpleperf_cflags_host_darwin := -I $(LOCAL_PATH)/nonlinux_support/include
30 simpleperf_cflags_host_windows := -I $(LOCAL_PATH)/nonlinux_support/include
31
32
33 LLVM_ROOT_PATH := external/llvm
34 include $(LLVM_ROOT_PATH)/llvm.mk
35
36 simpleperf_static_libraries_target := \
37   libbacktrace \
38   libunwindstack \
39   libdexfile \
40   libziparchive \
41   libz \
42   libbase \
43   libcutils \
44   liblog \
45   libprocinfo \
46   libutils \
47   liblzma \
48   libLLVMObject \
49   libLLVMBitReader \
50   libLLVMMC \
51   libLLVMMCParser \
52   libLLVMCore \
53   libLLVMSupport \
54   libprotobuf-cpp-lite \
55   libevent \
56
57 simpleperf_static_libraries_with_libc_target := \
58   $(simpleperf_static_libraries_target) \
59   libc \
60
61 simpleperf_static_libraries_host := \
62   libziparchive \
63   libbase \
64   liblog \
65   liblzma \
66   libz \
67   libutils \
68   libLLVMObject \
69   libLLVMBitReader \
70   libLLVMMC \
71   libLLVMMCParser \
72   libLLVMCore \
73   libLLVMSupport \
74   libprotobuf-cpp-lite \
75
76 simpleperf_static_libraries_host_linux := \
77   libprocinfo \
78   libbacktrace \
79   libunwindstack \
80   libdexfile \
81   libcutils \
82   libevent \
83
84 simpleperf_ldlibs_host_linux := -lrt
85
86 # libsimpleperf
87 # =========================================================
88 libsimpleperf_src_files := \
89   cmd_dumprecord.cpp \
90   cmd_help.cpp \
91   cmd_kmem.cpp \
92   cmd_report.cpp \
93   cmd_report_sample.cpp \
94   command.cpp \
95   dso.cpp \
96   event_attr.cpp \
97   event_type.cpp \
98   perf_regs.cpp \
99   read_apk.cpp \
100   read_elf.cpp \
101   record.cpp \
102   record_file_reader.cpp \
103   report_sample.proto \
104   thread_tree.cpp \
105   tracing.cpp \
106   utils.cpp \
107
108 libsimpleperf_src_files_linux := \
109   CallChainJoiner.cpp \
110   cmd_debug_unwind.cpp \
111   cmd_list.cpp \
112   cmd_record.cpp \
113   cmd_stat.cpp \
114   environment.cpp \
115   event_fd.cpp \
116   event_selection_set.cpp \
117   InplaceSamplerClient.cpp \
118   IOEventLoop.cpp \
119   OfflineUnwinder.cpp \
120   perf_clock.cpp \
121   record_file_writer.cpp \
122   UnixSocket.cpp \
123   workload.cpp \
124
125 libsimpleperf_src_files_darwin := \
126   nonlinux_support/nonlinux_support.cpp \
127
128 libsimpleperf_src_files_windows := \
129   nonlinux_support/nonlinux_support.cpp \
130
131 # libsimpleperf target
132 include $(CLEAR_VARS)
133 LOCAL_MODULE := libsimpleperf
134 LOCAL_MODULE_TAGS := debug
135 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
136 LOCAL_CFLAGS := $(simpleperf_cflags_target)
137 LOCAL_SRC_FILES := \
138   $(libsimpleperf_src_files) \
139   $(libsimpleperf_src_files_linux) \
140
141 LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_target)
142 LOCAL_MULTILIB := both
143 LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
144 include $(LLVM_DEVICE_BUILD_MK)
145 include $(BUILD_STATIC_LIBRARY)
146
147 # libsimpleperf host
148 include $(CLEAR_VARS)
149 LOCAL_MODULE := libsimpleperf
150 LOCAL_MODULE_HOST_OS := darwin linux windows
151 LOCAL_CFLAGS := $(simpleperf_cflags_host)
152 LOCAL_CFLAGS_darwin := $(simpleperf_cflags_host_darwin)
153 LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux)
154 LOCAL_CFLAGS_windows := $(simpleperf_cflags_host_windows)
155 LOCAL_SRC_FILES := $(libsimpleperf_src_files)
156 LOCAL_SRC_FILES_darwin := $(libsimpleperf_src_files_darwin)
157 LOCAL_SRC_FILES_linux := $(libsimpleperf_src_files_linux)
158 LOCAL_SRC_FILES_windows := $(libsimpleperf_src_files_windows)
159 LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_host)
160 LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
161 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
162 LOCAL_MULTILIB := both
163 LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
164 LOCAL_CXX_STL := libc++_static
165 include $(LLVM_HOST_BUILD_MK)
166 include $(BUILD_HOST_STATIC_LIBRARY)
167
168
169 # simpleperf
170 # =========================================================
171
172 # simpleperf target
173 include $(CLEAR_VARS)
174 LOCAL_MODULE := simpleperf
175 LOCAL_MODULE_TAGS := debug
176 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
177 LOCAL_CFLAGS := $(simpleperf_cflags_target)
178 LOCAL_SRC_FILES := main.cpp
179 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_with_libc_target)
180 ifdef TARGET_2ND_ARCH
181 LOCAL_MULTILIB := both
182 LOCAL_MODULE_STEM_32 := simpleperf32
183 LOCAL_MODULE_STEM_64 := simpleperf
184 endif
185 LOCAL_FORCE_STATIC_EXECUTABLE := true
186 include $(LLVM_DEVICE_BUILD_MK)
187 include $(BUILD_EXECUTABLE)
188
189 $(call dist-for-goals,sdk,$(ALL_MODULES.simpleperf.BUILT))
190 ifdef TARGET_2ND_ARCH
191 $(call dist-for-goals,sdk,$(ALL_MODULES.simpleperf$(TARGET_2ND_ARCH_MODULE_SUFFIX).BUILT))
192 endif
193
194 # simpleperf host
195 include $(CLEAR_VARS)
196 LOCAL_MODULE := simpleperf_host
197 LOCAL_MODULE_HOST_OS := darwin linux windows
198 LOCAL_CFLAGS := $(simpleperf_cflags_host)
199 LOCAL_CFLAGS_darwin := $(simpleperf_cflags_host_darwin)
200 LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux)
201 LOCAL_CFLAGS_windows := $(simpleperf_cflags_host_windows)
202 LOCAL_SRC_FILES := main.cpp
203 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
204 LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
205 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
206 LOCAL_MULTILIB := both
207 LOCAL_MODULE_STEM_32 := simpleperf32
208 LOCAL_MODULE_STEM_64 := simpleperf
209 LOCAL_CXX_STL := libc++_static
210 include $(LLVM_HOST_BUILD_MK)
211 include $(BUILD_HOST_EXECUTABLE)
212
213 $(call dist-for-goals,sdk,$(ALL_MODULES.simpleperf_host.BUILT):simpleperf_host)
214 ifdef HOST_2ND_ARCH
215 $(call dist-for-goals,sdk,$(ALL_MODULES.simpleperf_host$(HOST_2ND_ARCH_MODULE_SUFFIX).BUILT):simpleperf_host32)
216 endif
217 $(call dist-for-goals,win_sdk,$(ALL_MODULES.host_cross_simpleperf_host.BUILT))
218 ifdef HOST_CROSS_2ND_ARCH
219 $(call dist-for-goals,win_sdk,$(ALL_MODULES.host_cross_simpleperf_host$(HOST_CROSS_2ND_ARCH_MODULE_SUFFIX).BUILT))
220 endif
221
222 # libsimpleperf_record.a and libsimpleperf_record.so
223 # They are linked to user's program, to get profile
224 # counters and samples for specified code ranges.
225 # =========================================================
226
227 # libsimpleperf_record.a on target
228 include $(CLEAR_VARS)
229 LOCAL_MODULE := libsimpleperf_record
230 LOCAL_CFLAGS := $(simpleperf_cflags_target)
231 LOCAL_SRC_FILES := record_lib_interface.cpp
232 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_target)
233 LOCAL_MULTILIB := both
234 LOCAL_CXX_STL := libc++_static
235 LOCAL_LDLIBS := -Wl,--exclude-libs,ALL
236 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
237 include $(LLVM_DEVICE_BUILD_MK)
238 include $(BUILD_STATIC_LIBRARY)
239
240 # libsimpleperf_record.so on target
241 include $(CLEAR_VARS)
242 LOCAL_MODULE := libsimpleperf_record
243 LOCAL_CFLAGS := $(simpleperf_cflags_target)
244 LOCAL_SRC_FILES := record_lib_interface.cpp
245 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_target)
246 LOCAL_MULTILIB := both
247 LOCAL_CXX_STL := libc++_static
248 LOCAL_LDLIBS := -Wl,--exclude-libs,ALL
249 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
250 include $(LLVM_DEVICE_BUILD_MK)
251 include $(BUILD_SHARED_LIBRARY)
252
253 # libsimpleperf_record.a on host
254 include $(CLEAR_VARS)
255 LOCAL_MODULE := libsimpleperf_record
256 LOCAL_MODULE_HOST_OS := linux
257 LOCAL_CFLAGS := $(simpleperf_cflags_host)
258 LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux)
259 LOCAL_SRC_FILES := record_lib_interface.cpp
260 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
261 LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
262 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux) -Wl,--exclude-libs,ALL
263 LOCAL_MULTILIB := both
264 LOCAL_CXX_STL := libc++_static
265 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
266 include $(LLVM_HOST_BUILD_MK)
267 include $(BUILD_HOST_STATIC_LIBRARY)
268
269 # libsimpleperf_record.so on host
270 include $(CLEAR_VARS)
271 LOCAL_MODULE := libsimpleperf_record
272 LOCAL_MODULE_HOST_OS := linux
273 LOCAL_CFLAGS := $(simpleperf_cflags_host)
274 LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux)
275 LOCAL_SRC_FILES := record_lib_interface.cpp
276 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
277 LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
278 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux) -Wl,--exclude-libs,ALL
279 LOCAL_MULTILIB := both
280 LOCAL_CXX_STL := libc++_static
281 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
282 include $(LLVM_HOST_BUILD_MK)
283 include $(BUILD_HOST_SHARED_LIBRARY)
284
285
286 # libsimpleperf_report.so
287 # It is the shared library used on host by python scripts
288 # to report samples in different ways.
289 # =========================================================
290 include $(CLEAR_VARS)
291 LOCAL_MODULE := libsimpleperf_report
292 LOCAL_MODULE_HOST_OS := darwin linux windows
293 LOCAL_CFLAGS := $(simpleperf_cflags_host)
294 LOCAL_CFLAGS_darwin := $(simpleperf_cflags_host_darwin)
295 LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux)
296 LOCAL_CFLAGS_windows := $(simpleperf_cflags_host_windows)
297 LOCAL_SRC_FILES := report_lib_interface.cpp
298 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
299 LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
300 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux) -Wl,--exclude-libs,ALL
301 LOCAL_MULTILIB := both
302 LOCAL_CXX_STL := libc++_static
303 include $(LLVM_HOST_BUILD_MK)
304 include $(BUILD_HOST_SHARED_LIBRARY)
305
306 $(call dist-for-goals,sdk,$(ALL_MODULES.libsimpleperf_report.BUILT))
307 ifdef HOST_2ND_ARCH
308 $(call dist-for-goals,sdk,$(ALL_MODULES.libsimpleperf_report$(HOST_2ND_ARCH_MODULE_SUFFIX).BUILT):libsimpleperf_report32.so)
309 endif
310 $(call dist-for-goals,win_sdk,$(ALL_MODULES.host_cross_libsimpleperf_report.BUILT):libsimpleperf_report32.dll)
311 ifdef HOST_CROSS_2ND_ARCH
312 $(call dist-for-goals,win_sdk,$(ALL_MODULES.host_cross_libsimpleperf_report$(HOST_CROSS_2ND_ARCH_MODULE_SUFFIX).BUILT))
313 endif
314
315
316 # libsimpleperf_inplace_sampler.so
317 # It is the shared library linked with user's app and get samples from
318 # signal handlers in each thread.
319 # =========================================================
320
321 # libsimpleperf_inplace_sampler.so on target
322 include $(CLEAR_VARS)
323 LOCAL_MODULE := libsimpleperf_inplace_sampler
324 LOCAL_CFLAGS := $(simpleperf_cflags_target)
325 LOCAL_SRC_FILES := inplace_sampler_lib.cpp
326 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_target)
327 LOCAL_MULTILIB := both
328 LOCAL_CXX_STL := libc++_static
329 LOCAL_LDLIBS := -Wl,--exclude-libs,ALL
330 include $(LLVM_DEVICE_BUILD_MK)
331 include $(BUILD_SHARED_LIBRARY)
332
333 # libsimpleperf_inplace_sampler.so on host
334 include $(CLEAR_VARS)
335 LOCAL_MODULE := libsimpleperf_inplace_sampler
336 LOCAL_MODULE_HOST_OS := linux
337 LOCAL_CFLAGS := $(simpleperf_cflags_host)
338 LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux)
339 LOCAL_SRC_FILES := inplace_sampler_lib.cpp
340 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
341 LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
342 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux) -Wl,--exclude-libs,ALL
343 LOCAL_MULTILIB := both
344 LOCAL_CXX_STL := libc++_static
345 include $(LLVM_HOST_BUILD_MK)
346 include $(BUILD_HOST_SHARED_LIBRARY)
347
348
349 # simpleperf_unit_test
350 # =========================================================
351 simpleperf_unit_test_src_files := \
352   cmd_kmem_test.cpp \
353   cmd_report_test.cpp \
354   cmd_report_sample_test.cpp \
355   command_test.cpp \
356   gtest_main.cpp \
357   read_apk_test.cpp \
358   read_elf_test.cpp \
359   record_test.cpp \
360   sample_tree_test.cpp \
361   utils_test.cpp \
362
363 simpleperf_unit_test_src_files_linux := \
364   CallChainJoiner_test.cpp \
365   cmd_debug_unwind_test.cpp \
366   cmd_dumprecord_test.cpp \
367   cmd_list_test.cpp \
368   cmd_record_test.cpp \
369   cmd_stat_test.cpp \
370   environment_test.cpp \
371   IOEventLoop_test.cpp \
372   record_file_test.cpp \
373   UnixSocket_test.cpp \
374   workload_test.cpp \
375
376 # simpleperf_unit_test target
377 include $(CLEAR_VARS)
378 LOCAL_MODULE := simpleperf_unit_test
379 LOCAL_COMPATIBILITY_SUITE := device-tests
380 LOCAL_CFLAGS := $(simpleperf_cflags_target)
381 LOCAL_SRC_FILES := \
382   $(simpleperf_unit_test_src_files) \
383   $(simpleperf_unit_test_src_files_linux) \
384
385 LOCAL_STATIC_LIBRARIES += libsimpleperf $(simpleperf_static_libraries_with_libc_target)
386 LOCAL_TEST_DATA := $(call find-test-data-in-subdirs,$(LOCAL_PATH),"*",testdata)
387 LOCAL_MULTILIB := both
388 LOCAL_FORCE_STATIC_EXECUTABLE := true
389 include $(LLVM_DEVICE_BUILD_MK)
390 include $(BUILD_NATIVE_TEST)
391
392 # simpleperf_unit_test host
393 include $(CLEAR_VARS)
394 LOCAL_MODULE := simpleperf_unit_test
395 LOCAL_MODULE_HOST_OS := darwin linux windows
396 LOCAL_CFLAGS := $(simpleperf_cflags_host)
397 LOCAL_CFLAGS_darwin := $(simpleperf_cflags_host_darwin)
398 LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux)
399 LOCAL_CFLAGS_windows := $(simpleperf_cflags_host_windows)
400 LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
401 LOCAL_SRC_FILES_linux := $(simpleperf_unit_test_src_files_linux)
402 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
403 LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
404 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
405 LOCAL_MULTILIB := both
406 include $(LLVM_HOST_BUILD_MK)
407 include $(BUILD_HOST_NATIVE_TEST)
408
409
410 # simpleperf_cpu_hotplug_test
411 # =========================================================
412 simpleperf_cpu_hotplug_test_src_files := \
413   cpu_hotplug_test.cpp \
414
415 # simpleperf_cpu_hotplug_test target
416 include $(CLEAR_VARS)
417 LOCAL_MODULE := simpleperf_cpu_hotplug_test
418 LOCAL_COMPATIBILITY_SUITE := device-tests
419 LOCAL_CFLAGS := $(simpleperf_cflags_target)
420 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
421 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_with_libc_target)
422 LOCAL_MULTILIB := both
423 LOCAL_FORCE_STATIC_EXECUTABLE := true
424 include $(LLVM_DEVICE_BUILD_MK)
425 include $(BUILD_NATIVE_TEST)
426
427 # simpleperf_cpu_hotplug_test linux host
428 include $(CLEAR_VARS)
429 LOCAL_MODULE := simpleperf_cpu_hotplug_test
430 LOCAL_MODULE_HOST_OS := linux
431 LOCAL_CFLAGS := $(simpleperf_cflags_host)
432 LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux)
433 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
434 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
435 LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
436 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
437 LOCAL_MULTILIB := first
438 include $(LLVM_HOST_BUILD_MK)
439 include $(BUILD_HOST_NATIVE_TEST)
440
441
442 # libsimpleperf_cts_test
443 # =========================================================
444 libsimpleperf_cts_test_src_files := \
445   $(libsimpleperf_src_files) \
446   $(libsimpleperf_src_files_linux) \
447   $(simpleperf_unit_test_src_files) \
448   $(simpleperf_unit_test_src_files_linux) \
449
450 # libsimpleperf_cts_test target
451 include $(CLEAR_VARS)
452 LOCAL_MODULE := libsimpleperf_cts_test
453 LOCAL_CFLAGS := $(simpleperf_cflags_target) -DRUN_IN_APP_CONTEXT="\"com.android.simpleperf\""
454 LOCAL_SRC_FILES := $(libsimpleperf_cts_test_src_files)
455 LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_target)
456 LOCAL_MULTILIB := both
457 LOCAL_FORCE_STATIC_EXECUTABLE := true
458 include $(LLVM_DEVICE_BUILD_MK)
459 include $(BUILD_STATIC_TEST_LIBRARY)
460
461 # libsimpleperf_cts_test linux host
462 include $(CLEAR_VARS)
463 LOCAL_MODULE := libsimpleperf_cts_test
464 LOCAL_MODULE_HOST_OS := linux
465 LOCAL_CFLAGS := $(simpleperf_cflags_host)
466 LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux)
467 LOCAL_SRC_FILES := $(libsimpleperf_cts_test_src_files)
468 LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_host)
469 LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
470 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
471 LOCAL_MULTILIB := both
472 include $(LLVM_HOST_BUILD_MK)
473 include $(BUILD_HOST_STATIC_TEST_LIBRARY)
474
475 # simpleperf_record_test
476 # ============================================================
477
478 # simpleperf_record_test target
479 include $(CLEAR_VARS)
480 LOCAL_MODULE := simpleperf_record_test
481 LOCAL_CFLAGS := $(simpleperf_cflags_target)
482 LOCAL_SRC_FILES := record_lib_test.cpp
483 LOCAL_SHARED_LIBRARIES := libsimpleperf_record
484 LOCAL_MULTILIB := both
485 include $(BUILD_NATIVE_TEST)
486
487 # simpleperf_record_test linux host
488 include $(CLEAR_VARS)
489 LOCAL_MODULE := simpleperf_record_test
490 LOCAL_MODULE_HOST_OS := linux
491 LOCAL_CFLAGS := $(simpleperf_cflags_host)
492 LOCAL_CFLAGS_linux := $(simpleperf_cflags_host_linux)
493 LOCAL_SRC_FILES := record_lib_test.cpp
494 LOCAL_SHARED_LIBRARIES := libsimpleperf_record
495 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
496 LOCAL_MULTILIB := both
497 include $(BUILD_HOST_NATIVE_TEST)
498
499
500 # simpleperf_script.zip (for release in ndk)
501 # ============================================================
502 SIMPLEPERF_SCRIPT_LIST := \
503     $(filter-out scripts/update.py,$(call all-named-files-under,*.py,scripts)) \
504     scripts/inferno.sh \
505     scripts/inferno.bat \
506     scripts/inferno/inferno.b64 \
507     $(call all-named-files-under,*,scripts/script_testdata) \
508     $(call all-named-files-under,*.js,scripts) \
509     $(call all-named-files-under,*.css,scripts) \
510     $(call all-named-files-under,*,doc) \
511     $(call all-named-files-under,app-profiling.apk,demo) \
512     $(call all-named-files-under,*.so,demo) \
513     $(call all-cpp-files-under,demo) \
514     $(call all-java-files-under,demo) \
515     $(call all-named-files-under,*.kt,demo) \
516     testdata/perf_with_symbols.data \
517     testdata/perf_with_trace_offcpu.data \
518     testdata/perf_with_tracepoint_event.data
519
520 SIMPLEPERF_SCRIPT_LIST := $(addprefix -f $(LOCAL_PATH)/,$(SIMPLEPERF_SCRIPT_LIST))
521
522 SIMPLEPERF_SCRIPT_PATH := \
523     $(call intermediates-dir-for,PACKAGING,simplerperf_script,HOST)/simpleperf_script.zip
524
525 $(SIMPLEPERF_SCRIPT_PATH) : $(SOONG_ZIP)
526         $(hide) $(SOONG_ZIP) -d -o $@ -C system/extras/simpleperf $(SIMPLEPERF_SCRIPT_LIST)
527
528 sdk: $(SIMPLEPERF_SCRIPT_PATH)
529
530 $(call dist-for-goals,sdk,$(SIMPLEPERF_SCRIPT_PATH))
531
532 include $(call first-makefiles-under,$(LOCAL_PATH))