blob: 35bec549466201f59cae9542ec589256c6b6cf72 [file] [log] [blame]
Yabin Cui67d3abd2015-04-16 15:26:31 -07001#
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
17LOCAL_PATH := $(call my-dir)
18
Yabin Cui323e9452015-04-20 18:07:17 -070019simpleperf_common_cppflags := -std=c++11 -Wall -Wextra -Werror -Wunused
Yabin Cui76769e52015-07-13 12:23:54 -070020
Yabin Cui9fd3cc12015-06-25 17:42:23 -070021simpleperf_host_common_cppflags := $(simpleperf_common_cppflags) \
Yabin Cui8ca8ae82015-07-13 21:41:05 -070022 -DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \
Yabin Cui9fd3cc12015-06-25 17:42:23 -070023
24simpleperf_host_darwin_cppflags := $(simpleperf_host_common_cppflags) \
25 -I $(LOCAL_PATH)/darwin_support \
Yabin Cui323e9452015-04-20 18:07:17 -070026
Yabin Cui8f622512015-05-05 19:58:07 -070027simpleperf_common_shared_libraries := \
Yabin Cui9759e1b2015-04-28 15:54:13 -070028 libbase \
Yabin Cui8f622512015-05-05 19:58:07 -070029 libLLVM \
30
31LLVM_ROOT_PATH := external/llvm
Yabin Cui9759e1b2015-04-28 15:54:13 -070032
Yabin Cui9fd3cc12015-06-25 17:42:23 -070033# libsimpleperf
34# =========================================================
35libsimpleperf_common_src_files := \
Yabin Cuiecb9a302015-07-01 10:00:52 -070036 callchain.cpp \
Yabin Cui9759e1b2015-04-28 15:54:13 -070037 cmd_dumprecord.cpp \
Yabin Cui67d3abd2015-04-16 15:26:31 -070038 cmd_help.cpp \
Yabin Cui2672dea2015-05-21 12:17:23 -070039 cmd_report.cpp \
Yabin Cui67d3abd2015-04-16 15:26:31 -070040 command.cpp \
Yabin Cuiec12ed92015-06-08 10:38:10 -070041 dso.cpp \
Yabin Cui67d3abd2015-04-16 15:26:31 -070042 event_attr.cpp \
Yabin Cui67d3abd2015-04-16 15:26:31 -070043 event_type.cpp \
Yabin Cui76769e52015-07-13 12:23:54 -070044 perf_regs.cpp \
Yabin Cui8f622512015-05-05 19:58:07 -070045 read_elf.cpp \
Yabin Cui9759e1b2015-04-28 15:54:13 -070046 record.cpp \
Yabin Cui9fd3cc12015-06-25 17:42:23 -070047 record_file_reader.cpp \
Yabin Cui2672dea2015-05-21 12:17:23 -070048 sample_tree.cpp \
Yabin Cui60a0ea92015-07-22 20:30:43 -070049 thread_tree.cpp \
Yabin Cui67d3abd2015-04-16 15:26:31 -070050 utils.cpp \
Yabin Cui9fd3cc12015-06-25 17:42:23 -070051
52libsimpleperf_src_files := \
53 $(libsimpleperf_common_src_files) \
54 cmd_list.cpp \
55 cmd_record.cpp \
56 cmd_stat.cpp \
57 environment.cpp \
58 event_fd.cpp \
59 event_selection_set.cpp \
60 record_file_writer.cpp \
Yabin Cui323e9452015-04-20 18:07:17 -070061 workload.cpp \
Yabin Cui67d3abd2015-04-16 15:26:31 -070062
Yabin Cui9fd3cc12015-06-25 17:42:23 -070063libsimpleperf_darwin_src_files := \
64 $(libsimpleperf_common_src_files) \
65 environment_fake.cpp \
66
Yabin Cui67d3abd2015-04-16 15:26:31 -070067include $(CLEAR_VARS)
68LOCAL_CLANG := true
Yabin Cui323e9452015-04-20 18:07:17 -070069LOCAL_CPPFLAGS := $(simpleperf_common_cppflags)
70LOCAL_SRC_FILES := $(libsimpleperf_src_files)
Yabin Cui8f622512015-05-05 19:58:07 -070071LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
Yabin Cui323e9452015-04-20 18:07:17 -070072LOCAL_MODULE := libsimpleperf
Dehao Chend455de42015-04-27 15:34:09 -070073LOCAL_MODULE_TAGS := debug
74LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
Yabin Cui323e9452015-04-20 18:07:17 -070075LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Yabin Cui8f622512015-05-05 19:58:07 -070076include $(LLVM_ROOT_PATH)/llvm.mk
77include $(LLVM_DEVICE_BUILD_MK)
Yabin Cui323e9452015-04-20 18:07:17 -070078include $(BUILD_STATIC_LIBRARY)
79
80ifeq ($(HOST_OS),linux)
81include $(CLEAR_VARS)
82LOCAL_CLANG := true
Yabin Cuiddddc062015-06-02 17:54:52 -070083LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags)
Yabin Cui323e9452015-04-20 18:07:17 -070084LOCAL_SRC_FILES := $(libsimpleperf_src_files)
Yabin Cui8f622512015-05-05 19:58:07 -070085LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
Yabin Cui323e9452015-04-20 18:07:17 -070086LOCAL_LDLIBS := -lrt
87LOCAL_MODULE := libsimpleperf
88LOCAL_MODULE_TAGS := optional
89LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Yabin Cui8f622512015-05-05 19:58:07 -070090include $(LLVM_ROOT_PATH)/llvm.mk
91include $(LLVM_HOST_BUILD_MK)
Yabin Cui323e9452015-04-20 18:07:17 -070092include $(BUILD_HOST_STATIC_LIBRARY)
93endif
94
Yabin Cui9fd3cc12015-06-25 17:42:23 -070095ifeq ($(HOST_OS),darwin)
96include $(CLEAR_VARS)
97LOCAL_CLANG := true
98LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags)
99LOCAL_SRC_FILES := $(libsimpleperf_darwin_src_files)
100LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
101LOCAL_MODULE := libsimpleperf
102LOCAL_MODULE_TAGS := optional
103LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
104include $(LLVM_ROOT_PATH)/llvm.mk
105include $(LLVM_HOST_BUILD_MK)
106include $(BUILD_HOST_SHARED_LIBRARY)
107endif
108
109# simpleperf
110# =========================================================
Yabin Cui323e9452015-04-20 18:07:17 -0700111include $(CLEAR_VARS)
112LOCAL_CLANG := true
113LOCAL_CPPFLAGS := $(simpleperf_common_cppflags)
114LOCAL_SRC_FILES := main.cpp
115LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
Yabin Cui8f622512015-05-05 19:58:07 -0700116LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
Yabin Cui67d3abd2015-04-16 15:26:31 -0700117LOCAL_MODULE := simpleperf
Dehao Chend455de42015-04-27 15:34:09 -0700118LOCAL_MODULE_TAGS := debug
119LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
Yabin Cui67d3abd2015-04-16 15:26:31 -0700120LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
121include $(BUILD_EXECUTABLE)
122
123ifeq ($(HOST_OS),linux)
124include $(CLEAR_VARS)
125LOCAL_CLANG := true
Yabin Cuiddddc062015-06-02 17:54:52 -0700126LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags)
Yabin Cui323e9452015-04-20 18:07:17 -0700127LOCAL_SRC_FILES := main.cpp
128LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
Yabin Cui8f622512015-05-05 19:58:07 -0700129LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
Yabin Cui67d3abd2015-04-16 15:26:31 -0700130LOCAL_LDLIBS := -lrt
131LOCAL_MODULE := simpleperf
132LOCAL_MODULE_TAGS := optional
133LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
134include $(BUILD_HOST_EXECUTABLE)
135endif
Yabin Cui323e9452015-04-20 18:07:17 -0700136
Yabin Cui9fd3cc12015-06-25 17:42:23 -0700137ifeq ($(HOST_OS),darwin)
138include $(CLEAR_VARS)
139LOCAL_CLANG := true
140LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags)
141LOCAL_SRC_FILES := main.cpp
142LOCAL_SHARED_LIBRARIES := libsimpleperf $(simpleperf_common_shared_libraries)
143LOCAL_MODULE := simpleperf
144LOCAL_MODULE_TAGS := optional
145LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
146include $(BUILD_HOST_EXECUTABLE)
147endif
148
149# simpleperf_unit_test
150# =========================================================
151simpleperf_unit_test_common_src_files := \
152 command_test.cpp \
153 gtest_main.cpp \
154 record_test.cpp \
155 sample_tree_test.cpp \
156
Yabin Cui323e9452015-04-20 18:07:17 -0700157simpleperf_unit_test_src_files := \
Yabin Cui9fd3cc12015-06-25 17:42:23 -0700158 $(simpleperf_unit_test_common_src_files) \
Yabin Cui9759e1b2015-04-28 15:54:13 -0700159 cmd_dumprecord_test.cpp \
Yabin Cui323e9452015-04-20 18:07:17 -0700160 cmd_list_test.cpp \
Yabin Cui9759e1b2015-04-28 15:54:13 -0700161 cmd_record_test.cpp \
Yabin Cui2672dea2015-05-21 12:17:23 -0700162 cmd_report_test.cpp \
Yabin Cui323e9452015-04-20 18:07:17 -0700163 cmd_stat_test.cpp \
Yabin Cui97641692015-05-28 19:57:01 -0700164 cpu_offline_test.cpp \
Yabin Cui323e9452015-04-20 18:07:17 -0700165 environment_test.cpp \
Yabin Cuiec12ed92015-06-08 10:38:10 -0700166 read_elf_test.cpp \
Yabin Cui9759e1b2015-04-28 15:54:13 -0700167 record_file_test.cpp \
Yabin Cui323e9452015-04-20 18:07:17 -0700168 workload_test.cpp \
169
170include $(CLEAR_VARS)
171LOCAL_CLANG := true
172LOCAL_CPPFLAGS := $(simpleperf_common_cppflags)
173LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
174LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
Yabin Cui8f622512015-05-05 19:58:07 -0700175LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
Yabin Cui323e9452015-04-20 18:07:17 -0700176LOCAL_MODULE := simpleperf_unit_test
177LOCAL_MODULE_TAGS := optional
178LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
179include $(BUILD_NATIVE_TEST)
180
181ifeq ($(HOST_OS),linux)
182include $(CLEAR_VARS)
183LOCAL_CLANG := true
Yabin Cuiddddc062015-06-02 17:54:52 -0700184LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags)
Yabin Cui323e9452015-04-20 18:07:17 -0700185LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
186LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
Yabin Cui8f622512015-05-05 19:58:07 -0700187LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
Yabin Cui323e9452015-04-20 18:07:17 -0700188LOCAL_MODULE := simpleperf_unit_test
189LOCAL_MODULE_TAGS := optional
190LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
191include $(BUILD_HOST_NATIVE_TEST)
192endif
Yabin Cui9fd3cc12015-06-25 17:42:23 -0700193
194ifeq ($(HOST_OS),darwin)
195include $(CLEAR_VARS)
196LOCAL_CLANG := true
197LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags)
198LOCAL_SRC_FILES := $(simpleperf_unit_test_common_src_files)
199LOCAL_SHARED_LIBRARIES := libsimpleperf $(simpleperf_common_shared_libraries)
200LOCAL_MODULE := simpleperf_unit_test
201LOCAL_MODULE_TAGS := optional
202LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
203include $(BUILD_HOST_NATIVE_TEST)
204endif