| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 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 | |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 19 | simpleperf_common_cppflags := -std=c++11 -Wall -Wextra -Werror -Wunused |
| Yabin Cui | 76769e5 | 2015-07-13 12:23:54 -0700 | [diff] [blame] | 20 | |
| Yabin Cui | 9fd3cc1 | 2015-06-25 17:42:23 -0700 | [diff] [blame] | 21 | simpleperf_host_common_cppflags := $(simpleperf_common_cppflags) \ |
| Yabin Cui | 8ca8ae8 | 2015-07-13 21:41:05 -0700 | [diff] [blame] | 22 | -DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \ |
| Yabin Cui | 9fd3cc1 | 2015-06-25 17:42:23 -0700 | [diff] [blame] | 23 | |
| 24 | simpleperf_host_darwin_cppflags := $(simpleperf_host_common_cppflags) \ |
| 25 | -I $(LOCAL_PATH)/darwin_support \ |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 26 | |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 27 | simpleperf_common_shared_libraries := \ |
| Yabin Cui | 9759e1b | 2015-04-28 15:54:13 -0700 | [diff] [blame] | 28 | libbase \ |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 29 | libLLVM \ |
| 30 | |
| 31 | LLVM_ROOT_PATH := external/llvm |
| Yabin Cui | 9759e1b | 2015-04-28 15:54:13 -0700 | [diff] [blame] | 32 | |
| Yabin Cui | 9fd3cc1 | 2015-06-25 17:42:23 -0700 | [diff] [blame] | 33 | # libsimpleperf |
| 34 | # ========================================================= |
| 35 | libsimpleperf_common_src_files := \ |
| Yabin Cui | ecb9a30 | 2015-07-01 10:00:52 -0700 | [diff] [blame] | 36 | callchain.cpp \ |
| Yabin Cui | 9759e1b | 2015-04-28 15:54:13 -0700 | [diff] [blame] | 37 | cmd_dumprecord.cpp \ |
| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 38 | cmd_help.cpp \ |
| Yabin Cui | 2672dea | 2015-05-21 12:17:23 -0700 | [diff] [blame] | 39 | cmd_report.cpp \ |
| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 40 | command.cpp \ |
| Yabin Cui | ec12ed9 | 2015-06-08 10:38:10 -0700 | [diff] [blame] | 41 | dso.cpp \ |
| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 42 | event_attr.cpp \ |
| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 43 | event_type.cpp \ |
| Yabin Cui | 76769e5 | 2015-07-13 12:23:54 -0700 | [diff] [blame] | 44 | perf_regs.cpp \ |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 45 | read_elf.cpp \ |
| Yabin Cui | 9759e1b | 2015-04-28 15:54:13 -0700 | [diff] [blame] | 46 | record.cpp \ |
| Yabin Cui | 9fd3cc1 | 2015-06-25 17:42:23 -0700 | [diff] [blame] | 47 | record_file_reader.cpp \ |
| Yabin Cui | 2672dea | 2015-05-21 12:17:23 -0700 | [diff] [blame] | 48 | sample_tree.cpp \ |
| Yabin Cui | 60a0ea9 | 2015-07-22 20:30:43 -0700 | [diff] [blame] | 49 | thread_tree.cpp \ |
| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 50 | utils.cpp \ |
| Yabin Cui | 9fd3cc1 | 2015-06-25 17:42:23 -0700 | [diff] [blame] | 51 | |
| 52 | libsimpleperf_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 Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 61 | workload.cpp \ |
| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 62 | |
| Yabin Cui | 9fd3cc1 | 2015-06-25 17:42:23 -0700 | [diff] [blame] | 63 | libsimpleperf_darwin_src_files := \ |
| 64 | $(libsimpleperf_common_src_files) \ |
| 65 | environment_fake.cpp \ |
| 66 | |
| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 67 | include $(CLEAR_VARS) |
| 68 | LOCAL_CLANG := true |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 69 | LOCAL_CPPFLAGS := $(simpleperf_common_cppflags) |
| 70 | LOCAL_SRC_FILES := $(libsimpleperf_src_files) |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 71 | LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries) |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 72 | LOCAL_MODULE := libsimpleperf |
| Dehao Chen | d455de4 | 2015-04-27 15:34:09 -0700 | [diff] [blame] | 73 | LOCAL_MODULE_TAGS := debug |
| 74 | LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 75 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 76 | include $(LLVM_ROOT_PATH)/llvm.mk |
| 77 | include $(LLVM_DEVICE_BUILD_MK) |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 78 | include $(BUILD_STATIC_LIBRARY) |
| 79 | |
| 80 | ifeq ($(HOST_OS),linux) |
| 81 | include $(CLEAR_VARS) |
| 82 | LOCAL_CLANG := true |
| Yabin Cui | ddddc06 | 2015-06-02 17:54:52 -0700 | [diff] [blame] | 83 | LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags) |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 84 | LOCAL_SRC_FILES := $(libsimpleperf_src_files) |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 85 | LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries) |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 86 | LOCAL_LDLIBS := -lrt |
| 87 | LOCAL_MODULE := libsimpleperf |
| 88 | LOCAL_MODULE_TAGS := optional |
| 89 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 90 | include $(LLVM_ROOT_PATH)/llvm.mk |
| 91 | include $(LLVM_HOST_BUILD_MK) |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 92 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 93 | endif |
| 94 | |
| Yabin Cui | 9fd3cc1 | 2015-06-25 17:42:23 -0700 | [diff] [blame] | 95 | ifeq ($(HOST_OS),darwin) |
| 96 | include $(CLEAR_VARS) |
| 97 | LOCAL_CLANG := true |
| 98 | LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags) |
| 99 | LOCAL_SRC_FILES := $(libsimpleperf_darwin_src_files) |
| 100 | LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries) |
| 101 | LOCAL_MODULE := libsimpleperf |
| 102 | LOCAL_MODULE_TAGS := optional |
| 103 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 104 | include $(LLVM_ROOT_PATH)/llvm.mk |
| 105 | include $(LLVM_HOST_BUILD_MK) |
| 106 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 107 | endif |
| 108 | |
| 109 | # simpleperf |
| 110 | # ========================================================= |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 111 | include $(CLEAR_VARS) |
| 112 | LOCAL_CLANG := true |
| 113 | LOCAL_CPPFLAGS := $(simpleperf_common_cppflags) |
| 114 | LOCAL_SRC_FILES := main.cpp |
| 115 | LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 116 | LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries) |
| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 117 | LOCAL_MODULE := simpleperf |
| Dehao Chen | d455de4 | 2015-04-27 15:34:09 -0700 | [diff] [blame] | 118 | LOCAL_MODULE_TAGS := debug |
| 119 | LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) |
| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 120 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 121 | include $(BUILD_EXECUTABLE) |
| 122 | |
| 123 | ifeq ($(HOST_OS),linux) |
| 124 | include $(CLEAR_VARS) |
| 125 | LOCAL_CLANG := true |
| Yabin Cui | ddddc06 | 2015-06-02 17:54:52 -0700 | [diff] [blame] | 126 | LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags) |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 127 | LOCAL_SRC_FILES := main.cpp |
| 128 | LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 129 | LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries) |
| Yabin Cui | 67d3abd | 2015-04-16 15:26:31 -0700 | [diff] [blame] | 130 | LOCAL_LDLIBS := -lrt |
| 131 | LOCAL_MODULE := simpleperf |
| 132 | LOCAL_MODULE_TAGS := optional |
| 133 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 134 | include $(BUILD_HOST_EXECUTABLE) |
| 135 | endif |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 136 | |
| Yabin Cui | 9fd3cc1 | 2015-06-25 17:42:23 -0700 | [diff] [blame] | 137 | ifeq ($(HOST_OS),darwin) |
| 138 | include $(CLEAR_VARS) |
| 139 | LOCAL_CLANG := true |
| 140 | LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags) |
| 141 | LOCAL_SRC_FILES := main.cpp |
| 142 | LOCAL_SHARED_LIBRARIES := libsimpleperf $(simpleperf_common_shared_libraries) |
| 143 | LOCAL_MODULE := simpleperf |
| 144 | LOCAL_MODULE_TAGS := optional |
| 145 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 146 | include $(BUILD_HOST_EXECUTABLE) |
| 147 | endif |
| 148 | |
| 149 | # simpleperf_unit_test |
| 150 | # ========================================================= |
| 151 | simpleperf_unit_test_common_src_files := \ |
| 152 | command_test.cpp \ |
| 153 | gtest_main.cpp \ |
| 154 | record_test.cpp \ |
| 155 | sample_tree_test.cpp \ |
| 156 | |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 157 | simpleperf_unit_test_src_files := \ |
| Yabin Cui | 9fd3cc1 | 2015-06-25 17:42:23 -0700 | [diff] [blame] | 158 | $(simpleperf_unit_test_common_src_files) \ |
| Yabin Cui | 9759e1b | 2015-04-28 15:54:13 -0700 | [diff] [blame] | 159 | cmd_dumprecord_test.cpp \ |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 160 | cmd_list_test.cpp \ |
| Yabin Cui | 9759e1b | 2015-04-28 15:54:13 -0700 | [diff] [blame] | 161 | cmd_record_test.cpp \ |
| Yabin Cui | 2672dea | 2015-05-21 12:17:23 -0700 | [diff] [blame] | 162 | cmd_report_test.cpp \ |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 163 | cmd_stat_test.cpp \ |
| Yabin Cui | 9764169 | 2015-05-28 19:57:01 -0700 | [diff] [blame] | 164 | cpu_offline_test.cpp \ |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 165 | environment_test.cpp \ |
| Yabin Cui | ec12ed9 | 2015-06-08 10:38:10 -0700 | [diff] [blame] | 166 | read_elf_test.cpp \ |
| Yabin Cui | 9759e1b | 2015-04-28 15:54:13 -0700 | [diff] [blame] | 167 | record_file_test.cpp \ |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 168 | workload_test.cpp \ |
| 169 | |
| 170 | include $(CLEAR_VARS) |
| 171 | LOCAL_CLANG := true |
| 172 | LOCAL_CPPFLAGS := $(simpleperf_common_cppflags) |
| 173 | LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files) |
| 174 | LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 175 | LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries) |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 176 | LOCAL_MODULE := simpleperf_unit_test |
| 177 | LOCAL_MODULE_TAGS := optional |
| 178 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 179 | include $(BUILD_NATIVE_TEST) |
| 180 | |
| 181 | ifeq ($(HOST_OS),linux) |
| 182 | include $(CLEAR_VARS) |
| 183 | LOCAL_CLANG := true |
| Yabin Cui | ddddc06 | 2015-06-02 17:54:52 -0700 | [diff] [blame] | 184 | LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags) |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 185 | LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files) |
| 186 | LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf |
| Yabin Cui | 8f62251 | 2015-05-05 19:58:07 -0700 | [diff] [blame] | 187 | LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries) |
| Yabin Cui | 323e945 | 2015-04-20 18:07:17 -0700 | [diff] [blame] | 188 | LOCAL_MODULE := simpleperf_unit_test |
| 189 | LOCAL_MODULE_TAGS := optional |
| 190 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 191 | include $(BUILD_HOST_NATIVE_TEST) |
| 192 | endif |
| Yabin Cui | 9fd3cc1 | 2015-06-25 17:42:23 -0700 | [diff] [blame] | 193 | |
| 194 | ifeq ($(HOST_OS),darwin) |
| 195 | include $(CLEAR_VARS) |
| 196 | LOCAL_CLANG := true |
| 197 | LOCAL_CPPFLAGS := $(simpleperf_host_darwin_cppflags) |
| 198 | LOCAL_SRC_FILES := $(simpleperf_unit_test_common_src_files) |
| 199 | LOCAL_SHARED_LIBRARIES := libsimpleperf $(simpleperf_common_shared_libraries) |
| 200 | LOCAL_MODULE := simpleperf_unit_test |
| 201 | LOCAL_MODULE_TAGS := optional |
| 202 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 203 | include $(BUILD_HOST_NATIVE_TEST) |
| 204 | endif |