2 # Copyright (C) 2015 The Android Open Source Project
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 LOCAL_PATH := $(call my-dir)
19 simpleperf_common_cppflags := -Wextra -Wunused -Wno-unknown-pragmas
21 simpleperf_cppflags_target := $(simpleperf_common_cppflags)
23 simpleperf_cppflags_host := $(simpleperf_common_cppflags) \
24 -DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \
26 simpleperf_cppflags_host_darwin := -I $(LOCAL_PATH)/nonlinux_support/include
27 simpleperf_cppflags_host_windows := -I $(LOCAL_PATH)/nonlinux_support/include
30 LLVM_ROOT_PATH := external/llvm
31 include $(LLVM_ROOT_PATH)/llvm.mk
33 simpleperf_shared_libraries_target := \
35 libbacktrace_offline \
41 simpleperf_static_libraries_target := \
44 simpleperf_shared_libraries_host_linux := \
46 libbacktrace_offline \
48 simpleperf_shared_libraries_host_darwin := libLLVM
50 simpleperf_shared_libraries_host_windows := libLLVM
52 simpleperf_static_libraries_host := \
59 simpleperf_ldlibs_host_linux := -lrt
62 # =========================================================
63 libsimpleperf_src_files := \
76 record_file_reader.cpp \
81 libsimpleperf_src_files_linux := \
88 event_selection_set.cpp \
89 record_file_writer.cpp \
92 libsimpleperf_src_files_darwin := \
93 nonlinux_support/nonlinux_support.cpp \
95 libsimpleperf_src_files_windows := \
96 nonlinux_support/nonlinux_support.cpp \
98 # libsimpleperf target
101 LOCAL_MODULE := libsimpleperf
102 LOCAL_MODULE_TAGS := debug
103 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
104 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
106 $(libsimpleperf_src_files) \
107 $(libsimpleperf_src_files_linux) \
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)
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)
140 # =========================================================
143 include $(CLEAR_VARS)
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)
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)
173 # simpleperf_unit_test
174 # =========================================================
175 simpleperf_unit_test_src_files := \
176 cmd_report_test.cpp \
182 sample_tree_test.cpp \
184 simpleperf_unit_test_src_files_linux := \
185 cmd_dumprecord_test.cpp \
187 cmd_record_test.cpp \
189 environment_test.cpp \
190 record_file_test.cpp \
193 # simpleperf_unit_test target
194 include $(CLEAR_VARS)
196 LOCAL_MODULE := simpleperf_unit_test
197 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
199 $(simpleperf_unit_test_src_files) \
200 $(simpleperf_unit_test_src_files_linux) \
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)
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)
226 # simpleperf_cpu_hotplug_test
227 # =========================================================
228 simpleperf_cpu_hotplug_test_src_files := \
229 cpu_hotplug_test.cpp \
231 # simpleperf_cpu_hotplug_test target
232 include $(CLEAR_VARS)
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)
242 # simpleperf_cpu_hotplug_test linux host
243 include $(CLEAR_VARS)
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)
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) \
265 # libsimpleperf_cts_test target
266 include $(CLEAR_VARS)
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)
277 # libsimpleperf_cts_test linux host
278 include $(CLEAR_VARS)
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)
292 include $(call first-makefiles-under,$(LOCAL_PATH))