OSDN Git Service

Merge "Simpleperf: check value returned by fopen."
[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 := -Wall -Wextra -Werror -Wunused \
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_linux := $(simpleperf_cppflags_host) \
27
28 simpleperf_cppflags_host_darwin := $(simpleperf_cppflags_host) \
29                                    -I $(LOCAL_PATH)/darwin_support/include \
30
31 LLVM_ROOT_PATH := external/llvm
32 include $(LLVM_ROOT_PATH)/llvm.mk
33
34 simpleperf_shared_libraries_target := \
35   libbacktrace \
36   libbase \
37   libLLVM \
38
39 simpleperf_shared_libraries_host_linux := \
40   libbacktrace \
41   libbase \
42
43 simpleperf_shared_libraries_host_darwin := \
44   libbase \
45   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   darwin_support/darwin_support.cpp \
82
83 # libsimpleperf target
84 include $(CLEAR_VARS)
85 LOCAL_CLANG := true
86 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
87 LOCAL_SRC_FILES := \
88   $(libsimpleperf_src_files) \
89   $(libsimpleperf_src_files_linux) \
90
91 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
92 LOCAL_MULTILIB := first
93 LOCAL_MODULE := libsimpleperf
94 LOCAL_MODULE_TAGS := debug
95 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
96 include $(LLVM_DEVICE_BUILD_MK)
97 include $(BUILD_STATIC_LIBRARY)
98
99 # libsimpleperf linux host
100 ifeq ($(HOST_OS),linux)
101 include $(CLEAR_VARS)
102 LOCAL_CLANG := true
103 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_linux)
104 LOCAL_SRC_FILES := \
105   $(libsimpleperf_src_files) \
106   $(libsimpleperf_src_files_linux) \
107
108 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_linux)
109 LOCAL_LDLIBS := $(simpleperf_ldlibs_host_linux)
110 LOCAL_MULTILIB := first
111 LOCAL_MODULE := libsimpleperf
112 LOCAL_MODULE_TAGS := optional
113 include $(LLVM_HOST_BUILD_MK)
114 include $(BUILD_HOST_STATIC_LIBRARY)
115 endif
116
117 # libsimpleperf darwin host
118 ifeq ($(HOST_OS),darwin)
119 include $(CLEAR_VARS)
120 LOCAL_CLANG := true
121 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_darwin)
122 LOCAL_SRC_FILES := \
123   $(libsimpleperf_src_files) \
124   $(libsimpleperf_src_files_darwin) \
125
126 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_darwin)
127 LOCAL_MULTILIB := first
128 LOCAL_MODULE := libsimpleperf
129 LOCAL_MODULE_TAGS := optional
130 include $(LLVM_HOST_BUILD_MK)
131 include $(BUILD_HOST_SHARED_LIBRARY)
132 endif
133
134
135 # simpleperf
136 # =========================================================
137
138 # simpleperf target
139 include $(CLEAR_VARS)
140 LOCAL_CLANG := true
141 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
142 LOCAL_SRC_FILES := main.cpp
143 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
144 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
145 LOCAL_MULTILIB := first
146 LOCAL_MODULE := simpleperf
147 LOCAL_MODULE_TAGS := debug
148 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
149 include $(BUILD_EXECUTABLE)
150
151 # simpleperf linux host
152 ifeq ($(HOST_OS),linux)
153 include $(CLEAR_VARS)
154 LOCAL_CLANG := true
155 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_linux)
156 LOCAL_SRC_FILES := main.cpp
157 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
158 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_linux)
159 LOCAL_MULTILIB := first
160 LOCAL_LDLIBS := $(simpleperf_ldlibs_host_linux)
161 LOCAL_MODULE := simpleperf
162 LOCAL_MODULE_TAGS := optional
163 include $(BUILD_HOST_EXECUTABLE)
164 endif
165
166 # simpleperf darwin host
167 ifeq ($(HOST_OS),darwin)
168 include $(CLEAR_VARS)
169 LOCAL_CLANG := true
170 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_darwin)
171 LOCAL_SRC_FILES := main.cpp
172 LOCAL_SHARED_LIBRARIES := \
173   libsimpleperf \
174   $(simpleperf_shared_libraries_host_darwin) \
175
176 LOCAL_MULTILIB := first
177 LOCAL_MODULE := simpleperf
178 LOCAL_MODULE_TAGS := optional
179 include $(BUILD_HOST_EXECUTABLE)
180 endif
181
182
183 # simpleperf_unit_test
184 # =========================================================
185 simpleperf_unit_test_src_files := \
186   command_test.cpp \
187   gtest_main.cpp \
188   record_test.cpp \
189   sample_tree_test.cpp \
190
191 simpleperf_unit_test_src_files_linux := \
192   cmd_dumprecord_test.cpp \
193   cmd_list_test.cpp \
194   cmd_record_test.cpp \
195   cmd_report_test.cpp \
196   cmd_stat_test.cpp \
197   environment_test.cpp \
198   read_elf_test.cpp \
199   record_file_test.cpp \
200   workload_test.cpp \
201
202 # simpleperf_unit_test target
203 include $(CLEAR_VARS)
204 LOCAL_CLANG := true
205 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
206 LOCAL_SRC_FILES := \
207   $(simpleperf_unit_test_src_files) \
208   $(simpleperf_unit_test_src_files_linux) \
209
210 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
211 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
212 LOCAL_MULTILIB := first
213 LOCAL_MODULE := simpleperf_unit_test
214 LOCAL_MODULE_TAGS := optional
215 include $(BUILD_NATIVE_TEST)
216
217 # simpleperf_unit_test linux host
218 ifeq ($(HOST_OS),linux)
219 include $(CLEAR_VARS)
220 LOCAL_CLANG := true
221 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_linux)
222 LOCAL_SRC_FILES := \
223   $(simpleperf_unit_test_src_files) \
224   $(simpleperf_unit_test_src_files_linux) \
225
226 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
227 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_linux)
228 LOCAL_MULTILIB := first
229 LOCAL_MODULE := simpleperf_unit_test
230 LOCAL_MODULE_TAGS := optional
231 include $(BUILD_HOST_NATIVE_TEST)
232 endif
233
234 # simpleperf_unit_test darwin host
235 ifeq ($(HOST_OS),darwin)
236 include $(CLEAR_VARS)
237 LOCAL_CLANG := true
238 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_darwin)
239 LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
240 LOCAL_SHARED_LIBRARIES := \
241   libsimpleperf \
242   $(simpleperf_shared_libraries_host_darwin) \
243
244 LOCAL_MULTILIB := first
245 LOCAL_MODULE := simpleperf_unit_test
246 LOCAL_MODULE_TAGS := optional
247 include $(BUILD_HOST_NATIVE_TEST)
248 endif
249
250
251 # simpleperf_cpu_hotplug_test
252 # =========================================================
253 simpleperf_cpu_hotplug_test_src_files := \
254   gtest_main.cpp \
255   cpu_hotplug_test.cpp \
256
257 # simpleperf_cpu_hotplug_test target
258 include $(CLEAR_VARS)
259 LOCAL_CLANG := true
260 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
261 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
262 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
263 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
264 LOCAL_MULTILIB := first
265 LOCAL_MODULE := simpleperf_cpu_hotplug_test
266 LOCAL_MODULE_TAGS := optional
267 include $(BUILD_NATIVE_TEST)
268
269 # simpleperf_cpu_hotplug_test linux host
270 ifeq ($(HOST_OS),linux)
271 include $(CLEAR_VARS)
272 LOCAL_CLANG := true
273 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host_linux)
274 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
275 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
276 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host_linux)
277 LOCAL_MULTILIB := first
278 LOCAL_MODULE := simpleperf_cpu_hotplug_test
279 LOCAL_MODULE_TAGS := optional
280 include $(BUILD_HOST_NATIVE_TEST)
281 endif
282
283 include $(call first-makefiles-under,$(LOCAL_PATH))