OSDN Git Service

Merge "Add switches for compressor"
[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 := -std=c++11 -Wall -Wextra -Werror -Wunused
20
21 simpleperf_host_common_cppflags := $(simpleperf_common_cppflags) \
22                                    -DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \
23
24 simpleperf_host_darwin_cppflags := $(simpleperf_host_common_cppflags) \
25                                    -I $(LOCAL_PATH)/darwin_support \
26
27 simpleperf_common_shared_libraries := \
28   libbase \
29   libLLVM \
30
31 LLVM_ROOT_PATH := external/llvm
32
33 # libsimpleperf
34 # =========================================================
35 libsimpleperf_common_src_files := \
36   callchain.cpp \
37   cmd_dumprecord.cpp \
38   cmd_help.cpp \
39   cmd_report.cpp \
40   command.cpp \
41   dso.cpp \
42   event_attr.cpp \
43   event_type.cpp \
44   perf_regs.cpp \
45   read_elf.cpp \
46   record.cpp \
47   record_file_reader.cpp \
48   sample_tree.cpp \
49   thread_tree.cpp \
50   utils.cpp \
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 \
61   workload.cpp \
62
63 libsimpleperf_darwin_src_files := \
64   $(libsimpleperf_common_src_files) \
65   environment_fake.cpp \
66
67 include $(CLEAR_VARS)
68 LOCAL_CLANG := true
69 LOCAL_CPPFLAGS := $(simpleperf_common_cppflags)
70 LOCAL_SRC_FILES := $(libsimpleperf_src_files)
71 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
72 LOCAL_MODULE := libsimpleperf
73 LOCAL_MODULE_TAGS := debug
74 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
75 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
76 include $(LLVM_ROOT_PATH)/llvm.mk
77 include $(LLVM_DEVICE_BUILD_MK)
78 include $(BUILD_STATIC_LIBRARY)
79
80 ifeq ($(HOST_OS),linux)
81 include $(CLEAR_VARS)
82 LOCAL_CLANG := true
83 LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags)
84 LOCAL_SRC_FILES := $(libsimpleperf_src_files)
85 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
86 LOCAL_LDLIBS := -lrt
87 LOCAL_MODULE := libsimpleperf
88 LOCAL_MODULE_TAGS := optional
89 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
90 include $(LLVM_ROOT_PATH)/llvm.mk
91 include $(LLVM_HOST_BUILD_MK)
92 include $(BUILD_HOST_STATIC_LIBRARY)
93 endif
94
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 # =========================================================
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
116 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
117 LOCAL_MODULE := simpleperf
118 LOCAL_MODULE_TAGS := debug
119 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
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
126 LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags)
127 LOCAL_SRC_FILES := main.cpp
128 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
129 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
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
136
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
157 simpleperf_unit_test_src_files := \
158   $(simpleperf_unit_test_common_src_files) \
159   cmd_dumprecord_test.cpp \
160   cmd_list_test.cpp \
161   cmd_record_test.cpp \
162   cmd_report_test.cpp \
163   cmd_stat_test.cpp \
164   cpu_offline_test.cpp \
165   environment_test.cpp \
166   read_elf_test.cpp \
167   record_file_test.cpp \
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
175 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
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
184 LOCAL_CPPFLAGS := $(simpleperf_host_common_cppflags)
185 LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
186 LOCAL_WHOLE_STATIC_LIBRARIES := libsimpleperf
187 LOCAL_SHARED_LIBRARIES := $(simpleperf_common_shared_libraries)
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
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