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 \
39 simpleperf_shared_libraries_host := libbase
41 simpleperf_shared_libraries_host_linux := libbacktrace libbacktrace_offline
43 simpleperf_shared_libraries_host_darwin := libLLVM
45 simpleperf_shared_libraries_host_windows := libLLVM
47 simpleperf_ldlibs_host_linux := -lrt
51 # =========================================================
52 libsimpleperf_src_files := \
64 record_file_reader.cpp \
69 libsimpleperf_src_files_linux := \
76 event_selection_set.cpp \
77 record_file_writer.cpp \
80 libsimpleperf_src_files_darwin := \
81 nonlinux_support/nonlinux_support.cpp \
83 libsimpleperf_src_files_windows := \
84 nonlinux_support/nonlinux_support.cpp \
86 # libsimpleperf target
89 LOCAL_MODULE := libsimpleperf
90 LOCAL_MODULE_TAGS := debug
91 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
92 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
94 $(libsimpleperf_src_files) \
95 $(libsimpleperf_src_files_linux) \
97 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
98 LOCAL_MULTILIB := first
99 include $(LLVM_DEVICE_BUILD_MK)
100 include $(BUILD_STATIC_LIBRARY)
103 include $(CLEAR_VARS)
104 #LOCAL_CLANG := true # Comment it to build on windows.
105 LOCAL_MODULE := libsimpleperf
106 LOCAL_MODULE_HOST_OS := darwin linux windows
107 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
108 LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin)
109 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
110 LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
111 LOCAL_SRC_FILES := $(libsimpleperf_src_files)
112 LOCAL_SRC_FILES_darwin := $(libsimpleperf_src_files_darwin)
113 LOCAL_SRC_FILES_linux := $(libsimpleperf_src_files_linux)
114 LOCAL_SRC_FILES_windows := $(libsimpleperf_src_files_windows)
115 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host)
116 LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
117 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
118 LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
119 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
120 LOCAL_MULTILIB := first
121 include $(LLVM_HOST_BUILD_MK)
122 include $(BUILD_HOST_STATIC_LIBRARY)
126 # =========================================================
129 include $(CLEAR_VARS)
131 LOCAL_MODULE := simpleperf
132 LOCAL_MODULE_TAGS := debug
133 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
134 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
135 LOCAL_SRC_FILES := main.cpp
136 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
137 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
138 LOCAL_MULTILIB := first
139 include $(BUILD_EXECUTABLE)
142 include $(CLEAR_VARS)
143 LOCAL_MODULE := simpleperf
144 LOCAL_MODULE_HOST_OS := darwin linux windows
145 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
146 LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin)
147 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
148 LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
149 LOCAL_SRC_FILES := main.cpp
150 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
151 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host)
152 LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
153 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
154 LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
155 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
156 LOCAL_MULTILIB := first
157 include $(BUILD_HOST_EXECUTABLE)
160 # simpleperf_unit_test
161 # =========================================================
162 simpleperf_unit_test_src_files := \
166 sample_tree_test.cpp \
168 simpleperf_unit_test_src_files_linux := \
169 cmd_dumprecord_test.cpp \
171 cmd_record_test.cpp \
172 cmd_report_test.cpp \
174 environment_test.cpp \
176 record_file_test.cpp \
179 # simpleperf_unit_test target
180 include $(CLEAR_VARS)
182 LOCAL_MODULE := simpleperf_unit_test
183 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
185 $(simpleperf_unit_test_src_files) \
186 $(simpleperf_unit_test_src_files_linux) \
188 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
189 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
190 LOCAL_MULTILIB := first
191 include $(BUILD_NATIVE_TEST)
193 # simpleperf_unit_test host
194 include $(CLEAR_VARS)
195 LOCAL_MODULE := simpleperf_unit_test
196 LOCAL_MODULE_HOST_OS := darwin linux windows
197 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
198 LOCAL_CPPFLAGS_darwin := $(simpleperf_cppflags_host_darwin)
199 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
200 LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
201 LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
202 LOCAL_SRC_FILES_linux := $(simpleperf_unit_test_src_files_linux)
203 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
204 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host)
205 LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
206 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
207 LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
208 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
209 LOCAL_MULTILIB := first
210 include $(BUILD_HOST_NATIVE_TEST)
213 # simpleperf_cpu_hotplug_test
214 # =========================================================
215 simpleperf_cpu_hotplug_test_src_files := \
217 cpu_hotplug_test.cpp \
219 # simpleperf_cpu_hotplug_test target
220 include $(CLEAR_VARS)
222 LOCAL_MODULE := simpleperf_cpu_hotplug_test
223 LOCAL_CPPFLAGS := $(simpleperf_cppflags_target)
224 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
225 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
226 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_target)
227 LOCAL_MULTILIB := first
228 include $(BUILD_NATIVE_TEST)
230 # simpleperf_cpu_hotplug_test linux host
231 include $(CLEAR_VARS)
233 LOCAL_MODULE := simpleperf_cpu_hotplug_test
234 LOCAL_MODULE_HOST_OS := linux
235 LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
236 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
237 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
238 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
239 LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host)
240 LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
241 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
242 LOCAL_MULTILIB := first
243 include $(BUILD_HOST_NATIVE_TEST)
245 include $(call first-makefiles-under,$(LOCAL_PATH))