OSDN Git Service

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